|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mongodb.gridfs.GridFSFile
com.mongodb.gridfs.GridFSInputFile
public class GridFSInputFile
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
Field Summary |
---|
Fields inherited from class com.mongodb.gridfs.GridFSFile |
---|
_fs |
Method Summary | |
---|---|
OutputStream |
getOutputStream()
After retrieving this OutputStream , this object will be
capable of accepting successively written data to the output stream. |
void |
save()
calls save(long) with the existing chunk size |
void |
save(long chunkSize)
This method first calls saveChunks(long) if the file data has not been saved yet. |
int |
saveChunks()
|
int |
saveChunks(long chunkSize)
Saves all data into chunks from configured InputStream input stream
to GridFS. |
void |
setChunkSize(long _chunkSize)
Set the chunk size. |
void |
setContentType(String ct)
Sets the content type (MIME type) on the GridFS entry. |
void |
setFilename(String fn)
Sets the file name on the GridFS entry. |
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, setGridFS, setMetaData, toMap, toString, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public void setFilename(String fn)
fn
- File name.public void setContentType(String ct)
ct
- Content type.public void setChunkSize(long _chunkSize)
_chunkSize
- public void save()
save(long)
with the existing chunk size
save
in class GridFSFile
public void save(long chunkSize)
chunkSize
- Size of chunks for file in bytes.public int saveChunks() throws IOException
IOException
- on problems reading the new entry's
InputStream
.saveChunks(long)
public int saveChunks(long chunkSize) throws IOException
InputStream
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.
chunkSize
- Size of chunks for file in bytes.
IOException
- on problems reading the new entry's
InputStream
.public OutputStream getOutputStream()
OutputStream
, this object will be
capable of accepting successively written data to the output stream.
To completely persist this GridFS object, you must finally call the OutputStream.close()
method on the output stream. Note that calling the save() and saveChunks()
methods will throw Exceptions once you obtained the OutputStream.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |