public abstract class GridFSFile extends Object implements DBObject
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 key)
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.
|
public void save()
MongoException
- if there's a failurepublic void validate()
MongoException
- if there's a failurepublic 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)
BSONObject
put
in interface BSONObject
key
- Name to setv
- Corresponding valuepublic Object get(String key)
BSONObject
get
in interface BSONObject
key
- The name of the field fetch@Deprecated public boolean containsKey(String key)
BSONObject
containsKey
in interface BSONObject
key
- the key to checkpublic boolean containsField(String s)
BSONObject
containsField
in interface BSONObject
s
- Field name for which to checkpublic Set<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
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(Map m)
BSONObject
putAll
in interface BSONObject
m
- the mappublic Map<?,?> toMap()
BSONObject
toMap
in interface BSONObject
public Object removeField(String key)
BSONObject
removeField
in interface BSONObject
key
- The name of the field to remove