Package com.mongodb.gridfs
Class GridFSInputFile
java.lang.Object
com.mongodb.gridfs.GridFSFile
com.mongodb.gridfs.GridFSInputFile
- All Implemented Interfaces:
DBObject
,BSONObject
Deprecated.
Usage of this API is not supported in AEM as a Cloud Service.
This class represents a GridFS file to be written to the database. Operations include:
- Writing data obtained from an InputStream
- Getting an OutputStream to stream the data out to
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated.After retrieving thisOutputStream
, this object will be capable of accepting successively written data to the output stream.void
save()
Deprecated.Callssave(long)
with the existing chunk size.void
save
(long chunkSize) Deprecated.This method first calls saveChunks(long) if the file data has not been saved yet.int
Deprecated.Saves all data into chunks from configuredInputStream
input stream to GridFS.int
saveChunks
(long chunkSize) Deprecated.Saves all data into chunks from configuredInputStream
input stream to GridFS.void
setChunkSize
(long chunkSize) Deprecated.Set the chunk size.void
setContentType
(String contentType) Deprecated.Sets the content type (MIME type) on the GridFS entry.void
setFilename
(String filename) Deprecated.Sets the file name on the GridFS entry.void
Deprecated.Sets the ID of this GridFS file.Methods inherited from class com.mongodb.gridfs.GridFSFile
containsField, containsKey, get, getAliases, getChunkSize, getContentType, getFilename, getId, getLength, getMD5, getMetaData, getUploadDate, isPartialObject, keySet, markAsPartialObject, numChunks, put, putAll, putAll, removeField, setMetaData, toMap, toString, validate
-
Method Details
-
setId
Deprecated.Sets the ID of this GridFS file.- Parameters:
id
- the file's ID.
-
setFilename
Deprecated.Sets the file name on the GridFS entry.- Parameters:
filename
- File name.
-
setContentType
Deprecated.Sets the content type (MIME type) on the GridFS entry.- Parameters:
contentType
- Content type.
-
setChunkSize
public void setChunkSize(long chunkSize) Deprecated.Set the chunk size. This must be called before saving any data.- Parameters:
chunkSize
- The size in bytes.
-
save
public void save()Deprecated.Callssave(long)
with the existing chunk size.- Overrides:
save
in classGridFSFile
- Throws:
MongoException
- if there's a problem saving the file.
-
save
public void save(long chunkSize) Deprecated.This method first calls saveChunks(long) if the file data has not been saved yet. Then it persists the file entry to GridFS.- Parameters:
chunkSize
- Size of chunks for file in bytes.- Throws:
MongoException
- if there's a problem saving the file.
-
saveChunks
Deprecated.Saves all data into chunks from configuredInputStream
input stream to GridFS.- Returns:
- Number of the next chunk.
- Throws:
IOException
- on problems reading the new entry'sInputStream
.MongoException
- if there's a failure- See Also:
-
saveChunks
Deprecated.Saves all data into chunks from configuredInputStream
input stream to GridFS. A non-default chunk size can be specified. This method does NOT save the file object itself, one must call save() to do so.- Parameters:
chunkSize
- Size of chunks for file in bytes.- Returns:
- Number of the next chunk.
- Throws:
IOException
- on problems reading the new entry'sInputStream
.MongoException
- if there's a failure
-
getOutputStream
Deprecated.After retrieving thisOutputStream
, this object will be capable of accepting successively written data to the output stream. To completely persist this GridFS object, you must finally call theOutputStream.close()
method on the output stream. Note that calling the save() and saveChunks() methods will throw Exceptions once you obtained the OutputStream.- Returns:
- Writable stream object.
-