Package com.mongodb.gridfs
Class GridFSDBFile
java.lang.Object
com.mongodb.gridfs.GridFSFile
com.mongodb.gridfs.GridFSDBFile
- All Implemented Interfaces:
- DBObject,- BSONObject
This class enables retrieving a GridFS file metadata and content. Operations include:
 
- Writing data to a file on disk or an OutputStream
- Creating an InputStreamto stream the data into
- MongoDB documentation
- GridFS
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionReturns an InputStream from which data can be read.longWrites the file's data to a file on disk.longwriteTo(OutputStream out) Writes the file's data to an OutputStream.longWrites the file's data to a file on disk.Methods inherited from class com.mongodb.gridfs.GridFSFilecontainsField, get, getAliases, getChunkSize, getContentType, getFilename, getGridFS, getId, getLength, getMetaData, getUploadDate, isPartialObject, keySet, markAsPartialObject, numChunks, put, putAll, putAll, removeField, save, setGridFS, setMetaData, toMap, toString
- 
Constructor Details- 
GridFSDBFilepublic GridFSDBFile()
 
- 
- 
Method Details- 
getInputStreamReturns an InputStream from which data can be read.- Returns:
- the input stream
 
- 
writeToWrites the file's data to a file on disk.- Parameters:
- filename- the file name on disk
- Returns:
- number of bytes written
- Throws:
- IOException- if there are problems writing to the file
 
- 
writeToWrites the file's data to a file on disk.- Parameters:
- file- the File object
- Returns:
- number of bytes written
- Throws:
- IOException- if there are problems writing to the- file
 
- 
writeToWrites the file's data to an OutputStream.- Parameters:
- out- the OutputStream
- Returns:
- number of bytes written
- Throws:
- IOException- if there are problems writing to- out
 
 
-