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
Method Summary |
java.io.InputStream |
getInputStream()
Returns an InputStream from which data can be read |
long |
writeTo(java.io.File f)
Writes the file's data to a file on disk |
long |
writeTo(java.io.OutputStream out)
Writes the file's data to an OutputStream |
long |
writeTo(java.lang.String filename)
Writes the file's data to a file on disk |
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 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
GridFSDBFile
public GridFSDBFile()
getInputStream
public java.io.InputStream getInputStream()
- Returns an InputStream from which data can be read
- Returns:
writeTo
public long writeTo(java.lang.String filename)
throws java.io.IOException
- Writes the file's data to a file on disk
- Parameters:
filename
- the file name on disk
- Returns:
-
- Throws:
java.io.IOException
writeTo
public long writeTo(java.io.File f)
throws java.io.IOException
- Writes the file's data to a file on disk
- Parameters:
f
- the File object
- Returns:
-
- Throws:
java.io.IOException
writeTo
public long writeTo(java.io.OutputStream out)
throws java.io.IOException
- Writes the file's data to an OutputStream
- Parameters:
out
- the OutputStream
- Returns:
-
- Throws:
java.io.IOException