public abstract class GridFSFile extends Object implements DBObject
| Modifier and Type | Field and Description |
|---|---|
protected GridFS |
_fs
Deprecated.
Please use
getGridFS() & setGridFS(GridFS) instead. |
| Constructor and Description |
|---|
GridFSFile() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsField(String s)
Checks if this object contains a field with the given name.
|
boolean |
containsKey(String s)
Deprecated.
|
Object |
get(String key)
Gets a field from this object by a given name.
|
List<String> |
getAliases()
Gets the aliases from the metadata.
|
long |
getChunkSize()
Gets the size of a chunk.
|
String |
getContentType()
Gets the content type.
|
String |
getFilename()
Gets the filename.
|
protected GridFS |
getGridFS()
Gets the GridFS associated with this file
|
Object |
getId()
Gets the id.
|
long |
getLength()
Gets the file's length.
|
String |
getMD5()
Gets the observed MD5 during transfer
|
DBObject |
getMetaData()
Gets the file metadata.
|
Date |
getUploadDate()
Gets the upload date.
|
boolean |
isPartialObject()
Whether
DBObject.markAsPartialObject() was ever called only matters if you are going to upsert and do not want to risk losing fields. |
Set<String> |
keySet()
Returns this object's fields' names
|
void |
markAsPartialObject()
If this object was retrieved with only some fields (using a field filter) this method will be called to mark it as such.
|
int |
numChunks()
Returns the number of chunks that store the file data.
|
Object |
put(String key,
Object v)
Sets a name/value pair in this object.
|
void |
putAll(BSONObject o)
Sets all key/value pairs from an object into this object
|
void |
putAll(Map m)
Sets all key/value pairs from a map into this object
|
Object |
removeField(String key)
Removes a field with a given name from this object.
|
void |
save()
Saves the file entry to the files collection
|
protected void |
setGridFS(GridFS fs)
Sets the GridFS associated with this file.
|
void |
setMetaData(DBObject metadata)
Gets the file metadata.
|
Map |
toMap()
Returns a map representing this BSONObject.
|
String |
toString() |
void |
validate()
Verifies that the MD5 matches between the database and the local file.
|
@Deprecated protected GridFS _fs
getGridFS() & setGridFS(GridFS) instead.public void save()
MongoExceptionpublic void validate()
MongoExceptionpublic int numChunks()
public Object getId()
public String getFilename()
public String getContentType()
public long getLength()
public long getChunkSize()
public Date getUploadDate()
public List<String> getAliases()
put(String, Object) with "aliases" , List<String>.public DBObject getMetaData()
public void setMetaData(DBObject metadata)
metadata - metadata to be setpublic String getMD5()
public Object put(String key, Object v)
BSONObjectput in interface BSONObjectkey - Name to setv - Corresponding valuepublic Object get(String key)
BSONObjectget in interface BSONObjectkey - The name of the field fetchpublic void putAll(BSONObject o)
BSONObjectputAll in interface BSONObjecto - the objectpublic void putAll(Map m)
BSONObjectputAll in interface BSONObjectm - the mappublic Map toMap()
BSONObjecttoMap in interface BSONObjectpublic Object removeField(String key)
BSONObjectremoveField in interface BSONObjectkey - The name of the field to remove@Deprecated public boolean containsKey(String s)
BSONObjectcontainsKey in interface BSONObjects - the key to checkpublic boolean containsField(String s)
BSONObjectcontainsField in interface BSONObjects - Field name for which to checkpublic Set<String> keySet()
BSONObjectkeySet in interface BSONObjectpublic boolean isPartialObject()
DBObjectDBObject.markAsPartialObject() was ever called only matters if you are going to upsert and do not want to risk losing fields.isPartialObject in interface DBObjectpublic void markAsPartialObject()
DBObjectmarkAsPartialObject in interface DBObjectprotected GridFS getGridFS()
protected void setGridFS(GridFS fs)
fs - gridFS instance