Java 类com.mongodb.client.gridfs.model.GridFSUploadOptions 实例源码
项目:mandrel
文件:MongoBlobStore.java
@Override
public Uri putBlob(Uri uri, Blob blob) {
GridFSUploadOptions options = new GridFSUploadOptions();
Document document = JsonBsonCodec.toBson(mapper, blob.getMetadata());
options.metadata(document);
GridFSUploadStream file = bucket.openUploadStream(uri.toString(), options);
try {
IOUtils.copy(blob.getPayload().openStream(), file);
} catch (IOException e) {
throw Throwables.propagate(e);
}
file.close();
return Uri.create("mongodb://" + databaseName + "/" + bucket.getBucketName() + "/" + file.getFileId().toString());
}
项目:opensearchserver
文件:MongoDbCrawlCache.java
@Override
public InputStream store(DownloadItem downloadItem) throws IOException, JSONException {
rwl.r.lock();
try {
final URI uri = downloadItem.getUri();
if (!uri.equals(this.uri))
throw new IOException("The URI does not match: " + uri + " / " + this.uri);
final Document newDocument = Document.parse(downloadItem.getMetaAsJson());
newDocument.put("uri", uriString);
final BsonValue id = metaCollection.replaceOne(eq("uri", uriString), newDocument, UPSERT)
.getUpsertedId();
final GridFSUploadOptions options = new GridFSUploadOptions().metadata(new Document("_id", id));
contentGrid.uploadFromStream(id, uriString, downloadItem.getContentInputStream(), options);
return contentGrid.openDownloadStream(id);
} finally {
rwl.r.unlock();
}
}
项目:mongo-obj-framework
文件:SmofGridStreamManagerImpl.java
private void uploadStream(SmofGridRef ref, String name, InputStream stream) {
final String bucketName = ref.getBucketName();
final ObjectId id;
final GridFSBucket bucket;
Preconditions.checkNotNull(bucketName, "No bucket specified");
final GridFSUploadOptions options = new GridFSUploadOptions().metadata(ref.getMetadata());
bucket = pool.getBucket(bucketName);
id = bucket.uploadFromStream(name, stream, options);
ref.setId(id);
}
项目:mongo-java-driver-rx
文件:GridFSBucketImpl.java
@Override
public Observable<ObjectId> uploadFromStream(final String filename, final AsyncInputStream source, final GridFSUploadOptions options) {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<ObjectId>>() {
@Override
public void apply(final SingleResultCallback<ObjectId> callback) {
wrapped.uploadFromStream(filename, toCallbackAsyncInputStream(source), options, callback);
}
}), observableAdapter);
}
项目:mongo-java-driver-rx
文件:GridFSBucketImpl.java
@Override
public Observable<Success> uploadFromStream(final BsonValue id, final String filename, final AsyncInputStream source,
final GridFSUploadOptions options) {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.uploadFromStream(id, filename, toCallbackAsyncInputStream(source), options, voidToSuccessCallback(callback));
}
}), observableAdapter);
}
项目:mongo-java-driver-reactivestreams
文件:GridFSBucketImpl.java
@Override
public Publisher<ObjectId> uploadFromStream(final String filename, final AsyncInputStream source, final GridFSUploadOptions options) {
return new ObservableToPublisher<ObjectId>(observe(new Block<SingleResultCallback<ObjectId>>() {
@Override
public void apply(final SingleResultCallback<ObjectId> callback) {
wrapped.uploadFromStream(filename, toCallbackAsyncInputStream(source), options, callback);
}
}));
}
项目:mongo-java-driver-reactivestreams
文件:GridFSBucketImpl.java
@Override
public Publisher<Success> uploadFromStream(final BsonValue id, final String filename, final AsyncInputStream source,
final GridFSUploadOptions options) {
return new ObservableToPublisher<Success>(observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.uploadFromStream(id, filename, toCallbackAsyncInputStream(source), options, voidToSuccessCallback(callback));
}
}));
}
项目:mongo-java-driver-reactivestreams
文件:GridFSBucketImpl.java
@Override
public Publisher<ObjectId> uploadFromStream(final ClientSession clientSession, final String filename, final AsyncInputStream source,
final GridFSUploadOptions options) {
return new ObservableToPublisher<ObjectId>(observe(new Block<SingleResultCallback<ObjectId>>() {
@Override
public void apply(final SingleResultCallback<ObjectId> callback) {
wrapped.uploadFromStream(clientSession, filename, toCallbackAsyncInputStream(source), options, callback);
}
}));
}
项目:mongo-java-driver-reactivestreams
文件:GridFSBucketImpl.java
@Override
public Publisher<Success> uploadFromStream(final ClientSession clientSession, final BsonValue id, final String filename,
final AsyncInputStream source, final GridFSUploadOptions options) {
return new ObservableToPublisher<Success>(observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.uploadFromStream(clientSession, id, filename, toCallbackAsyncInputStream(source), options,
voidToSuccessCallback(callback));
}
}));
}
项目:lumongo
文件:MongoDocumentStorage.java
private GridFSUploadOptions getGridFSUploadOptions(String uniqueId, String fileName, boolean compress, long timestamp, Map<String, String> metadataMap) {
Document metadata = new Document();
if (metadataMap != null) {
for (String key : metadataMap.keySet()) {
metadata.put(key, metadataMap.get(key));
}
}
metadata.put(TIMESTAMP, timestamp);
metadata.put(COMPRESSED_FLAG, compress);
metadata.put(DOCUMENT_UNIQUE_ID_KEY, uniqueId);
metadata.put(FILE_UNIQUE_ID_KEY, getGridFsId(uniqueId, fileName));
return new GridFSUploadOptions().chunkSizeBytes(1024).metadata(metadata);
}
项目:otus-api
文件:FileStoreBucket.java
public FileStoreBucket() {
gridFSUploadOptions = new GridFSUploadOptions();
gridFSUploadOptions.chunkSizeBytes(CHUNK_SIZE_BYTES);
}
项目:mongo-java-driver-rx
文件:GridFSBucketImpl.java
@Override
public GridFSUploadStream openUploadStream(final String filename, final GridFSUploadOptions options) {
return new GridFSUploadStreamImpl(wrapped.openUploadStream(filename, options), observableAdapter);
}
项目:mongo-java-driver-rx
文件:GridFSBucketImpl.java
@Override
public GridFSUploadStream openUploadStream(final BsonValue id, final String filename, final GridFSUploadOptions options) {
return new GridFSUploadStreamImpl(wrapped.openUploadStream(id, filename, options), observableAdapter);
}
项目:mongo-java-driver-reactivestreams
文件:GridFSBucketImpl.java
@Override
public GridFSUploadStream openUploadStream(final String filename) {
return openUploadStream(filename, new GridFSUploadOptions());
}
项目:mongo-java-driver-reactivestreams
文件:GridFSBucketImpl.java
@Override
public GridFSUploadStream openUploadStream(final String filename, final GridFSUploadOptions options) {
return new GridFSUploadStreamImpl(wrapped.openUploadStream(filename, options));
}
项目:mongo-java-driver-reactivestreams
文件:GridFSBucketImpl.java
@Override
public GridFSUploadStream openUploadStream(final BsonValue id, final String filename) {
return openUploadStream(id, filename, new GridFSUploadOptions());
}
项目:mongo-java-driver-reactivestreams
文件:GridFSBucketImpl.java
@Override
public GridFSUploadStream openUploadStream(final BsonValue id, final String filename, final GridFSUploadOptions options) {
return new GridFSUploadStreamImpl(wrapped.openUploadStream(id, filename, options));
}
项目:mongo-java-driver-reactivestreams
文件:GridFSBucketImpl.java
@Override
public GridFSUploadStream openUploadStream(final ClientSession clientSession, final String filename) {
return openUploadStream(clientSession, filename, new GridFSUploadOptions());
}
项目:mongo-java-driver-reactivestreams
文件:GridFSBucketImpl.java
@Override
public GridFSUploadStream openUploadStream(final ClientSession clientSession, final String filename,
final GridFSUploadOptions options) {
return new GridFSUploadStreamImpl(wrapped.openUploadStream(clientSession, filename, options));
}
项目:mongo-java-driver-reactivestreams
文件:GridFSBucketImpl.java
@Override
public GridFSUploadStream openUploadStream(final ClientSession clientSession, final BsonValue id, final String filename) {
return openUploadStream(clientSession, id, filename, new GridFSUploadOptions());
}
项目:mongo-java-driver-reactivestreams
文件:GridFSBucketImpl.java
@Override
public GridFSUploadStream openUploadStream(final ClientSession clientSession, final BsonValue id, final String filename,
final GridFSUploadOptions options) {
return new GridFSUploadStreamImpl(wrapped.openUploadStream(clientSession, id, filename, options));
}
项目:mongo-java-driver-reactivestreams
文件:GridFSBucketImpl.java
@Override
public Publisher<ObjectId> uploadFromStream(final String filename, final AsyncInputStream source) {
return uploadFromStream(filename, source, new GridFSUploadOptions());
}
项目:mongo-java-driver-reactivestreams
文件:GridFSBucketImpl.java
@Override
public Publisher<Success> uploadFromStream(final BsonValue id, final String filename, final AsyncInputStream source) {
return uploadFromStream(id, filename, source, new GridFSUploadOptions());
}
项目:mongo-java-driver-reactivestreams
文件:GridFSBucketImpl.java
@Override
public Publisher<ObjectId> uploadFromStream(final ClientSession clientSession, final String filename, final AsyncInputStream source) {
return uploadFromStream(clientSession, filename, source, new GridFSUploadOptions());
}
项目:mongo-java-driver-reactivestreams
文件:GridFSBucketImpl.java
@Override
public Publisher<Success> uploadFromStream(final ClientSession clientSession, final BsonValue id, final String filename,
final AsyncInputStream source) {
return uploadFromStream(clientSession, id, filename, source, new GridFSUploadOptions());
}
项目:mongo-java-driver-rx
文件:GridFSBucket.java
/**
* Opens a AsyncOutputStream that the application can write the contents of the file to.
* <p>
* As the application writes the contents to the returned Stream, the contents are uploaded as chunks in the chunks collection. When
* the application signals it is done writing the contents of the file by calling close on the returned Stream, a files collection
* document is created in the files collection.
* </p>
*
* @param filename the filename for the stream
* @param options the GridFSUploadOptions
* @return the GridFSUploadStream that provides the ObjectId for the file to be uploaded and the Stream to which the
* application will write the contents.
*/
GridFSUploadStream openUploadStream(String filename, GridFSUploadOptions options);
项目:mongo-java-driver-rx
文件:GridFSBucket.java
/**
* Opens a AsyncOutputStream that the application can write the contents of the file to.
* <p>
* As the application writes the contents to the returned Stream, the contents are uploaded as chunks in the chunks collection. When
* the application signals it is done writing the contents of the file by calling close on the returned Stream, a files collection
* document is created in the files collection.
* </p>
*
* @param id the custom id value of the file
* @param filename the filename for the stream
* @param options the GridFSUploadOptions
* @return the GridFSUploadStream that provides the ObjectId for the file to be uploaded and the Stream to which the
* application will write the contents.
*/
GridFSUploadStream openUploadStream(BsonValue id, String filename, GridFSUploadOptions options);
项目:mongo-java-driver-rx
文件:GridFSBucket.java
/**
* Uploads the contents of the given {@code AsyncInputStream} to a GridFS bucket.
* <p>
* Reads the contents of the user file from the {@code source} and uploads it as chunks in the chunks collection. After all the
* chunks have been uploaded, it creates a files collection document for {@code filename} in the files collection.
* </p>
*
* @param filename the filename for the stream
* @param source the Stream providing the file data
* @param options the GridFSUploadOptions
* @return an observable with a single element, the ObjectId of the uploaded file.
*/
Observable<ObjectId> uploadFromStream(String filename, AsyncInputStream source, GridFSUploadOptions options);
项目:mongo-java-driver-rx
文件:GridFSBucket.java
/**
* Uploads the contents of the given {@code AsyncInputStream} to a GridFS bucket.
* <p>
* Reads the contents of the user file from the {@code source} and uploads it as chunks in the chunks collection. After all the
* chunks have been uploaded, it creates a files collection document for {@code filename} in the files collection.
* </p>
*
* @param id the custom id value of the file
* @param filename the filename for the stream
* @param source the Stream providing the file data
* @param options the GridFSUploadOptions
* @return an observable with a single element, representing when the successful upload of the source.
*/
Observable<Success> uploadFromStream(BsonValue id, String filename, AsyncInputStream source, GridFSUploadOptions options);
项目:mongo-java-driver-reactivestreams
文件:GridFSBucket.java
/**
* Opens a AsyncOutputStream that the application can write the contents of the file to.
* <p>
* As the application writes the contents to the returned Stream, the contents are uploaded as chunks in the chunks collection. When
* the application signals it is done writing the contents of the file by calling close on the returned Stream, a files collection
* document is created in the files collection.
* </p>
*
* @param filename the filename for the stream
* @param options the GridFSUploadOptions
* @return the GridFSUploadStream that provides the ObjectId for the file to be uploaded and the Stream to which the
* application will write the contents.
*/
GridFSUploadStream openUploadStream(String filename, GridFSUploadOptions options);
项目:mongo-java-driver-reactivestreams
文件:GridFSBucket.java
/**
* Opens a AsyncOutputStream that the application can write the contents of the file to.
* <p>
* As the application writes the contents to the returned Stream, the contents are uploaded as chunks in the chunks collection. When
* the application signals it is done writing the contents of the file by calling close on the returned Stream, a files collection
* document is created in the files collection.
* </p>
*
* @param id the custom id value of the file
* @param filename the filename for the stream
* @param options the GridFSUploadOptions
* @return the GridFSUploadStream that provides the ObjectId for the file to be uploaded and the Stream to which the
* application will write the contents.
*/
GridFSUploadStream openUploadStream(BsonValue id, String filename, GridFSUploadOptions options);
项目:mongo-java-driver-reactivestreams
文件:GridFSBucket.java
/**
* Opens a AsyncOutputStream that the application can write the contents of the file to.
* <p>
* As the application writes the contents to the returned Stream, the contents are uploaded as chunks in the chunks collection. When
* the application signals it is done writing the contents of the file by calling close on the returned Stream, a files collection
* document is created in the files collection.
* </p>
*
* @param clientSession the client session with which to associate this operation
* @param filename the filename for the stream
* @param options the GridFSUploadOptions
* @return the GridFSUploadStream that provides the ObjectId for the file to be uploaded and the Stream to which the
* application will write the contents.
* @mongodb.server.release 3.6
* @since 1.7
*/
GridFSUploadStream openUploadStream(ClientSession clientSession, String filename, GridFSUploadOptions options);
项目:mongo-java-driver-reactivestreams
文件:GridFSBucket.java
/**
* Opens a AsyncOutputStream that the application can write the contents of the file to.
* <p>
* As the application writes the contents to the returned Stream, the contents are uploaded as chunks in the chunks collection. When
* the application signals it is done writing the contents of the file by calling close on the returned Stream, a files collection
* document is created in the files collection.
* </p>
*
* @param clientSession the client session with which to associate this operation
* @param id the custom id value of the file
* @param filename the filename for the stream
* @param options the GridFSUploadOptions
* @return the GridFSUploadStream that provides the ObjectId for the file to be uploaded and the Stream to which the
* application will write the contents.
* @mongodb.server.release 3.6
* @since 1.7
*/
GridFSUploadStream openUploadStream(ClientSession clientSession, BsonValue id, String filename, GridFSUploadOptions options);
项目:mongo-java-driver-reactivestreams
文件:GridFSBucket.java
/**
* Uploads the contents of the given {@code AsyncInputStream} to a GridFS bucket.
* <p>
* Reads the contents of the user file from the {@code source} and uploads it as chunks in the chunks collection. After all the
* chunks have been uploaded, it creates a files collection document for {@code filename} in the files collection.
* </p>
*
* @param filename the filename for the stream
* @param source the Stream providing the file data
* @param options the GridFSUploadOptions
* @return a publisher with a single element, the ObjectId of the uploaded file.
*/
Publisher<ObjectId> uploadFromStream(String filename, AsyncInputStream source, GridFSUploadOptions options);
项目:mongo-java-driver-reactivestreams
文件:GridFSBucket.java
/**
* Uploads the contents of the given {@code AsyncInputStream} to a GridFS bucket.
* <p>
* Reads the contents of the user file from the {@code source} and uploads it as chunks in the chunks collection. After all the
* chunks have been uploaded, it creates a files collection document for {@code filename} in the files collection.
* </p>
*
* @param id the custom id value of the file
* @param filename the filename for the stream
* @param source the Stream providing the file data
* @param options the GridFSUploadOptions
* @return a publisher with a single element, representing when the successful upload of the source.
*/
Publisher<Success> uploadFromStream(BsonValue id, String filename, AsyncInputStream source, GridFSUploadOptions options);
项目:mongo-java-driver-reactivestreams
文件:GridFSBucket.java
/**
* Uploads the contents of the given {@code AsyncInputStream} to a GridFS bucket.
* <p>
* Reads the contents of the user file from the {@code source} and uploads it as chunks in the chunks collection. After all the
* chunks have been uploaded, it creates a files collection document for {@code filename} in the files collection.
* </p>
*
* @param clientSession the client session with which to associate this operation
* @param filename the filename for the stream
* @param source the Stream providing the file data
* @param options the GridFSUploadOptions
* @return a publisher with a single element, the ObjectId of the uploaded file.
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher<ObjectId> uploadFromStream(ClientSession clientSession, String filename, AsyncInputStream source,
GridFSUploadOptions options);
项目:mongo-java-driver-reactivestreams
文件:GridFSBucket.java
/**
* Uploads the contents of the given {@code AsyncInputStream} to a GridFS bucket.
* <p>
* Reads the contents of the user file from the {@code source} and uploads it as chunks in the chunks collection. After all the
* chunks have been uploaded, it creates a files collection document for {@code filename} in the files collection.
* </p>
*
* @param clientSession the client session with which to associate this operation
* @param id the custom id value of the file
* @param filename the filename for the stream
* @param source the Stream providing the file data
* @param options the GridFSUploadOptions
* @return a publisher with a single element, representing when the successful upload of the source.
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher<Success> uploadFromStream(ClientSession clientSession, BsonValue id, String filename, AsyncInputStream source,
GridFSUploadOptions options);