com.mongodb.gridfs
Class GridFSDBFile

java.lang.Object
  extended by com.mongodb.gridfs.GridFSFile
      extended by 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

Field Summary
 
Fields inherited from class com.mongodb.gridfs.GridFSFile
_fs
 
Constructor Summary
GridFSDBFile()
           
 
Method Summary
 InputStream getInputStream()
          Returns an InputStream from which data can be read
 long writeTo(File f)
          Writes the file's data to a file on disk
 long writeTo(OutputStream out)
          Writes the file's data to an OutputStream
 long writeTo(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
 

Constructor Detail

GridFSDBFile

public GridFSDBFile()
Method Detail

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