public abstract class GridFSFile extends java.lang.Object implements DBObject
Constructor and Description |
---|
GridFSFile() |
Modifier and Type | Method and Description |
---|---|
boolean |
containsField(java.lang.String s)
Checks if this object contains a field with the given name.
|
boolean |
containsKey(java.lang.String key)
Deprecated.
|
java.lang.Object |
get(java.lang.String key)
Gets a field from this object by a given name.
|
java.util.List<java.lang.String> |
getAliases()
Gets the aliases from the metadata.
|
long |
getChunkSize()
Gets the size of a chunk.
|
java.lang.String |
getContentType()
Gets the content type.
|
java.lang.String |
getFilename()
Gets the filename.
|
protected GridFS |
getGridFS()
Gets the GridFS associated with this file
|
java.lang.Object |
getId()
Gets the id.
|
long |
getLength()
Gets the file's length.
|
java.lang.String |
getMD5()
Gets the observed MD5 during transfer
|
DBObject |
getMetaData()
Gets the file metadata.
|
java.util.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. |
java.util.Set<java.lang.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.
|
java.lang.Object |
put(java.lang.String key,
java.lang.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(java.util.Map m)
Sets all key/value pairs from a map into this object
|
java.lang.Object |
removeField(java.lang.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.
|
java.util.Map<?,?> |
toMap()
Returns a map representing this BSONObject.
|
java.lang.String |
toString() |
void |
validate()
Verifies that the MD5 matches between the database and the local file.
|
public void save()
MongoException
- if there's a failurepublic void validate()
MongoException
- if there's a failurepublic int numChunks()
public java.lang.Object getId()
public java.lang.String getFilename()
public java.lang.String getContentType()
public long getLength()
public long getChunkSize()
public java.util.Date getUploadDate()
public java.util.List<java.lang.String> getAliases()
put(String, Object)
with "aliases" , List<String>
.public DBObject getMetaData()
public void setMetaData(DBObject metadata)
metadata
- metadata to be setpublic java.lang.String getMD5()
public java.lang.Object put(java.lang.String key, java.lang.Object v)
BSONObject
put
in interface BSONObject
key
- Name to setv
- Corresponding valuepublic java.lang.Object get(java.lang.String key)
BSONObject
get
in interface BSONObject
key
- The name of the field fetch@Deprecated public boolean containsKey(java.lang.String key)
BSONObject
containsKey
in interface BSONObject
key
- the key to checkpublic boolean containsField(java.lang.String s)
BSONObject
containsField
in interface BSONObject
s
- Field name for which to checkpublic java.util.Set<java.lang.String> keySet()
BSONObject
keySet
in interface BSONObject
public boolean isPartialObject()
DBObject
DBObject.markAsPartialObject()
was ever called only matters if you are going to upsert and do not want to risk losing fields.isPartialObject
in interface DBObject
public void markAsPartialObject()
DBObject
markAsPartialObject
in interface DBObject
public java.lang.String toString()
toString
in class java.lang.Object
protected void setGridFS(GridFS fs)
fs
- gridFS instanceprotected GridFS getGridFS()
public void putAll(BSONObject o)
BSONObject
putAll
in interface BSONObject
o
- the objectpublic void putAll(java.util.Map m)
BSONObject
putAll
in interface BSONObject
m
- the mappublic java.util.Map<?,?> toMap()
BSONObject
toMap
in interface BSONObject
public java.lang.Object removeField(java.lang.String key)
BSONObject
removeField
in interface BSONObject
key
- The name of the field to remove