com.mongodb.gridfs
Class GridFSFile

java.lang.Object
  extended by com.mongodb.gridfs.GridFSFile
All Implemented Interfaces:
DBObject, BSONObject
Direct Known Subclasses:
GridFSDBFile, GridFSInputFile

public abstract class GridFSFile
extends Object
implements DBObject


Field Summary
protected  GridFS _fs
           
 
Constructor Summary
GridFSFile()
           
 
Method Summary
 boolean containsField(String s)
          Checks if this object contains a field with the given name.
 boolean containsKey(String s)
           
 Object get(String key)
          Gets a field from this object by a given name.
 List<String> getAliases()
          note: to set aliases, call put( "aliases" , List )
 long getChunkSize()
           
 String getContentType()
           
 String getFilename()
           
 Object getId()
           
 long getLength()
           
 String getMD5()
           
 DBObject getMetaData()
           
 Date getUploadDate()
           
 boolean isPartialObject()
          whether markAsPartialObject was ever called only matters if you are going to upsert and dont' want to risk losing fields
 Set<String> keySet()
          Returns this object's fields' names
 void markAsPartialObject()
          if this object was loaded with only some fields (using a field filter) this method will be called to notify
 int numChunks()
           
 Object put(String key, Object v)
          Sets a name/value pair in this object.
 void putAll(BSONObject o)
           
 void putAll(Map m)
           
 Object removeField(String key)
          Remove a field with a given name from this object.
 void save()
           
protected  void setGridFS(GridFS fs)
           
 Map toMap()
          Returns a map representing this BSONObject.
 String toString()
           
 void validate()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_fs

protected GridFS _fs
Constructor Detail

GridFSFile

public GridFSFile()
Method Detail

save

public void save()

validate

public void validate()

numChunks

public int numChunks()

getId

public Object getId()

getFilename

public String getFilename()

getContentType

public String getContentType()

getLength

public long getLength()

getChunkSize

public long getChunkSize()

getUploadDate

public Date getUploadDate()

getAliases

public List<String> getAliases()
note: to set aliases, call put( "aliases" , List )


getMetaData

public DBObject getMetaData()

getMD5

public String getMD5()

put

public Object put(String key,
                  Object v)
Description copied from interface: BSONObject
Sets a name/value pair in this object.

Specified by:
put in interface BSONObject
Parameters:
key - Name to set
v - Corresponding value
Returns:
v

get

public Object get(String key)
Description copied from interface: BSONObject
Gets a field from this object by a given name.

Specified by:
get in interface BSONObject
Parameters:
key - The name of the field fetch
Returns:
The field, if found

putAll

public void putAll(BSONObject o)
Specified by:
putAll in interface BSONObject

putAll

public void putAll(Map m)
Specified by:
putAll in interface BSONObject

toMap

public Map toMap()
Description copied from interface: BSONObject
Returns a map representing this BSONObject.

Specified by:
toMap in interface BSONObject
Returns:
the map

removeField

public Object removeField(String key)
Description copied from interface: BSONObject
Remove a field with a given name from this object.

Specified by:
removeField in interface BSONObject
Parameters:
key - The name of the field to remove
Returns:
The value removed from this object

containsKey

public boolean containsKey(String s)
Specified by:
containsKey in interface BSONObject

containsField

public boolean containsField(String s)
Description copied from interface: BSONObject
Checks if this object contains a field with the given name.

Specified by:
containsField in interface BSONObject
Parameters:
s - Field name for which to check
Returns:
if this object contains a field with the given name

keySet

public Set<String> keySet()
Description copied from interface: BSONObject
Returns this object's fields' names

Specified by:
keySet in interface BSONObject
Returns:
The names of the fields in this object

isPartialObject

public boolean isPartialObject()
Description copied from interface: DBObject
whether markAsPartialObject was ever called only matters if you are going to upsert and dont' want to risk losing fields

Specified by:
isPartialObject in interface DBObject

markAsPartialObject

public void markAsPartialObject()
Description copied from interface: DBObject
if this object was loaded with only some fields (using a field filter) this method will be called to notify

Specified by:
markAsPartialObject in interface DBObject

toString

public String toString()
Overrides:
toString in class Object

setGridFS

protected void setGridFS(GridFS fs)