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 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
public void save()
MongoException
public void validate()
MongoException
public int numChunks()
public Object getId()
public String getFilename()
public String getContentType()
public long getLength()
public long getChunkSize()
public Date getUploadDate()
public List<String> getAliases()
public DBObject getMetaData()
public void setMetaData(DBObject metadata)
public 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 fetchpublic 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@Deprecated public boolean containsKey(String s)
BSONObject
containsKey
in interface BSONObject
public 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
isPartialObject
in interface DBObject
public void markAsPartialObject()
DBObject
markAsPartialObject
in interface DBObject
protected GridFS getGridFS()
protected void setGridFS(GridFS fs)
fs
-