com.mongodb.gridfs
Class GridFSDBFile
java.lang.Object
com.mongodb.gridfs.GridFSFile
com.mongodb.gridfs.GridFSDBFile
- All Implemented Interfaces:
- DBObject, BSONObject
public class GridFSDBFile
- extends GridFSFile
This class enables to retrieve a GridFS file metadata and content.
Operations include:
- writing data to a file on disk or an OutputStream
- getting each chunk as a byte array
- getting an InputStream to stream the data into
- Author:
- antoine
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, save, setGridFS, setMetaData, toMap, toString, validate |
GridFSDBFile
public GridFSDBFile()
getInputStream
public InputStream getInputStream()
- Returns an InputStream from which data can be read
- Returns:
writeTo
public long writeTo(String filename)
throws IOException
- Writes the file's data to a file on disk
- Parameters:
filename
- the file name on disk
- Returns:
-
- Throws:
IOException
MongoException
writeTo
public long writeTo(File f)
throws IOException
- Writes the file's data to a file on disk
- Parameters:
f
- the File object
- Returns:
-
- Throws:
IOException
MongoException
writeTo
public long writeTo(OutputStream out)
throws IOException
- Writes the file's data to an OutputStream
- Parameters:
out
- the OutputStream
- Returns:
-
- Throws:
IOException
MongoException