public interface GridFsOperations extends ResourcePatternResolver
CLASSPATH_ALL_URL_PREFIXCLASSPATH_URL_PREFIX| Modifier and Type | Method and Description |
|---|---|
void |
delete(Query query)
Deletes all files matching the given
Query. |
com.mongodb.client.gridfs.GridFSFindIterable |
find(Query query)
Returns all files matching the given query.
|
com.mongodb.client.gridfs.model.GridFSFile |
findOne(Query query)
Returns a single
GridFSFile matching the given query or null in
case no file matches. |
GridFsResource |
getResource(com.mongodb.client.gridfs.model.GridFSFile file)
Returns the
GridFsResource for a GridFSFile. |
GridFsResource |
getResource(String filename)
Returns the
GridFsResource with the given file name. |
GridFsResource[] |
getResources(String filenamePattern)
Returns all
GridFsResources matching the given file name pattern. |
<T> T |
store(GridFsObject<T,InputStream> upload)
|
default org.bson.types.ObjectId |
store(InputStream content,
org.bson.Document metadata)
Stores the given content into a file with the given name.
|
default org.bson.types.ObjectId |
store(InputStream content,
Object metadata)
Stores the given content into a file with the given name.
|
default org.bson.types.ObjectId |
store(InputStream content,
String filename)
Stores the given content into a file with the given name.
|
default org.bson.types.ObjectId |
store(InputStream content,
String filename,
org.bson.Document metadata)
Stores the given content into a file with the given name using the given metadata.
|
default org.bson.types.ObjectId |
store(InputStream content,
String filename,
Object metadata)
Stores the given content into a file with the given name using the given metadata.
|
default org.bson.types.ObjectId |
store(InputStream content,
String filename,
String contentType)
Stores the given content into a file with the given name and content type.
|
default org.bson.types.ObjectId |
store(InputStream content,
String filename,
String contentType,
org.bson.Document metadata)
Stores the given content into a file with the given name and content type using the given metadata.
|
org.bson.types.ObjectId |
store(InputStream content,
String filename,
String contentType,
Object metadata)
Stores the given content into a file with the given name and content type using the given metadata.
|
getClassLoaderdefault org.bson.types.ObjectId store(InputStream content, String filename)
content - must not be null.filename - must not be null or empty.ObjectId of the GridFSFile just created.default org.bson.types.ObjectId store(InputStream content, @Nullable Object metadata)
content - must not be null.metadata - can be null.ObjectId of the GridFSFile just created.default org.bson.types.ObjectId store(InputStream content, @Nullable org.bson.Document metadata)
content - must not be null.metadata - can be null.ObjectId of the GridFSFile just created.default org.bson.types.ObjectId store(InputStream content, @Nullable String filename, @Nullable String contentType)
content - must not be null.filename - must not be null or empty.contentType - can be null.ObjectId of the GridFSFile just created.default org.bson.types.ObjectId store(InputStream content, @Nullable String filename, @Nullable Object metadata)
content - must not be null.filename - can be null or empty.metadata - can be null.ObjectId of the GridFSFile just created.org.bson.types.ObjectId store(InputStream content, @Nullable String filename, @Nullable String contentType, @Nullable Object metadata)
content - must not be null.filename - must not be null or empty.contentType - can be null.metadata - can be nullObjectId of the GridFSFile just created.default org.bson.types.ObjectId store(InputStream content, @Nullable String filename, @Nullable org.bson.Document metadata)
content - must not be null.filename - must not be null or empty.metadata - can be null.ObjectId of the GridFSFile just created.default org.bson.types.ObjectId store(InputStream content, @Nullable String filename, @Nullable String contentType, @Nullable org.bson.Document metadata)
content - must not be null.filename - must not be null or empty.contentType - can be null. If not empty, may override content type within metadata.metadata - can be null.ObjectId of the GridFSFile just created.<T> T store(GridFsObject<T,InputStream> upload)
GridFsObject, likely a GridFsUpload, into into a file with given
name. If the GridFsObject.getFileId() is set, the file will be stored
with that id, otherwise the server auto creates a new id. T - id type of the underlying GridFSFileupload - the GridFsObject (most likely a GridFsUpload) to be stored.GridFsObject.getFileId(), but never
null.com.mongodb.client.gridfs.GridFSFindIterable find(Query query)
Sort criterias defined at the
Query will not be regarded as MongoDB does not support ordering for GridFS file access.query - must not be null.GridFSFindIterable to obtain results from. Eg. by calling
MongoIterable.into(java.util.Collection).@Nullable com.mongodb.client.gridfs.model.GridFSFile findOne(Query query)
GridFSFile matching the given query or null in
case no file matches.query - must not be null.void delete(Query query)
Query.query - must not be null.GridFsResource getResource(String filename)
GridFsResource with the given file name.getResource in interface ResourceLoaderfilename - must not be null.Resource.exists() to check if the returned
GridFsResource is actually present.ResourceLoader.getResource(String)GridFsResource getResource(com.mongodb.client.gridfs.model.GridFSFile file)
GridFsResource for a GridFSFile.file - must not be null.GridFsResource[] getResources(String filenamePattern)
GridFsResources matching the given file name pattern.getResources in interface ResourcePatternResolverfilenamePattern - must not be null.ResourcePatternResolver.getResources(String)Copyright © 2011–2023 Pivotal Software, Inc.. All rights reserved.