Package com.mongodb.gridfs
Class GridFSInputFile
- java.lang.Object
-
- com.mongodb.gridfs.GridFSFile
-
- com.mongodb.gridfs.GridFSInputFile
-
- All Implemented Interfaces:
DBObject
,BSONObject
@Deprecated(since="2021-05-27") public class GridFSInputFile extends GridFSFile
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
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.io.OutputStream
getOutputStream()
Deprecated.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
saveChunks()
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(java.lang.String contentType)
Deprecated.Sets the content type (MIME type) on the GridFS entry.void
setFilename(java.lang.String filename)
Deprecated.Sets the file name on the GridFS entry.void
setId(java.lang.Object id)
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 Detail
-
setId
public void setId(java.lang.Object id)
Deprecated.Sets the ID of this GridFS file.- Parameters:
id
- the file's ID.
-
setFilename
public void setFilename(java.lang.String filename)
Deprecated.Sets the file name on the GridFS entry.- Parameters:
filename
- File name.
-
setContentType
public void setContentType(java.lang.String contentType)
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
public int saveChunks() throws java.io.IOException
Deprecated.Saves all data into chunks from configuredInputStream
input stream to GridFS.- Returns:
- Number of the next chunk.
- Throws:
java.io.IOException
- on problems reading the new entry'sInputStream
.MongoException
- if there's a failure- See Also:
saveChunks(long)
-
saveChunks
public int saveChunks(long chunkSize) throws java.io.IOException
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:
java.io.IOException
- on problems reading the new entry'sInputStream
.MongoException
- if there's a failure
-
getOutputStream
public java.io.OutputStream 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.
-
-