|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mongodb.gridfs.GridFS
public class GridFS
Implementation of GridFS v1.0 GridFS 1.0 spec
Field Summary | |
---|---|
protected String |
_bucketName
|
protected DBCollection |
_chunkCollection
|
protected DB |
_db
|
protected DBCollection |
_filesCollection
|
static String |
DEFAULT_BUCKET
|
static int |
DEFAULT_CHUNKSIZE
|
Constructor Summary | |
---|---|
GridFS(DB db)
Creates a GridFS instance for the default bucket "fs" in the given database. |
|
GridFS(DB db,
String bucket)
Creates a GridFS instance for the specified bucket in the given database. |
Method Summary | |
---|---|
GridFSInputFile |
createFile()
This method creates an empty GridFSInputFile instance. |
GridFSInputFile |
createFile(byte[] data)
after calling this method, you have to call save() on the GridFSInputFile file |
GridFSInputFile |
createFile(File f)
after calling this method, you have to call save() on the GridFSInputFile file |
GridFSInputFile |
createFile(InputStream in)
after calling this method, you have to call save() on the GridFSInputFile file |
GridFSInputFile |
createFile(InputStream in,
String filename)
after calling this method, you have to call save() on the GridFSInputFile file on that, you can call setFilename, setContentType and control meta data by modifying the result of getMetaData |
GridFSInputFile |
createFile(String filename)
This method creates an empty GridFSInputFile instance. |
List<GridFSDBFile> |
find(DBObject query)
|
GridFSDBFile |
find(ObjectId id)
|
List<GridFSDBFile> |
find(String filename)
|
GridFSDBFile |
findOne(DBObject query)
|
GridFSDBFile |
findOne(ObjectId id)
|
GridFSDBFile |
findOne(String filename)
|
String |
getBucketName()
|
DB |
getDB()
|
DBCursor |
getFileList()
Returns a cursor for this filestore |
DBCursor |
getFileList(DBObject query)
Returns a cursor for this filestore |
void |
remove(DBObject query)
|
void |
remove(ObjectId id)
|
void |
remove(String filename)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_CHUNKSIZE
public static final String DEFAULT_BUCKET
protected final DB _db
protected final String _bucketName
protected final DBCollection _filesCollection
protected final DBCollection _chunkCollection
Constructor Detail |
---|
public GridFS(DB db)
db
- database to work withpublic GridFS(DB db, String bucket)
db
- database to work withbucket
- bucket to use in the given databaseMethod Detail |
---|
public DBCursor getFileList()
public DBCursor getFileList(DBObject query)
query
- filter to apply
public GridFSDBFile find(ObjectId id)
public GridFSDBFile findOne(ObjectId id)
public GridFSDBFile findOne(String filename)
public GridFSDBFile findOne(DBObject query)
public List<GridFSDBFile> find(String filename)
public List<GridFSDBFile> find(DBObject query)
public void remove(ObjectId id)
public void remove(String filename)
public void remove(DBObject query)
public GridFSInputFile createFile(byte[] data)
public GridFSInputFile createFile(File f) throws IOException
IOException
public GridFSInputFile createFile(InputStream in)
public GridFSInputFile createFile(InputStream in, String filename)
public GridFSInputFile createFile(String filename)
GridFSInputFile
instance. On this
instance an OutputStream
can be obtained using the
GridFSInputFile.getOutputStream()
method. You can still call
GridFSInputFile.setContentType(String)
and
GridFSInputFile.setFilename(String)
. The file will be completely
written and closed after calling the OutputStream.close()
method on the output stream.
filename
- Name of the file to be created.
public GridFSInputFile createFile()
GridFSInputFile
instance. On this
instance an OutputStream
can be obtained using the
GridFSInputFile.getOutputStream()
method. You can still call
GridFSInputFile.setContentType(String)
and
GridFSInputFile.setFilename(String)
. The file will be completely
written and closed after calling the OutputStream.close()
method on the output stream.
public String getBucketName()
public DB getDB()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |