Package com.mongodb.client.gridfs.model
Class GridFSFile
- java.lang.Object
-
- com.mongodb.client.gridfs.model.GridFSFile
-
public final class GridFSFile extends Object
The GridFSFile- Since:
- 3.1
-
-
Constructor Summary
Constructors Constructor Description GridFSFile(BsonValue id, String filename, long length, int chunkSize, Date uploadDate, Document metadata)Creates a new GridFSFile
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)intgetChunkSize()The size, in bytes, of each data chunk of this fileStringgetFilename()The filenameBsonValuegetId()TheBsonValueid for this file.longgetLength()The length, in bytes of this fileDocumentgetMetadata()Any additional metadata stored along with the fileObjectIdgetObjectId()TheObjectIdfor this file.DategetUploadDate()The date and time this file was added to GridFSinthashCode()StringtoString()
-
-
-
Constructor Detail
-
GridFSFile
public GridFSFile(BsonValue id, String filename, long length, int chunkSize, Date uploadDate, @Nullable Document metadata)
Creates a new GridFSFile- Parameters:
id- the id of the filefilename- the filenamelength- the length, in bytes of the filechunkSize- the chunkSize, in bytes of the fileuploadDate- the upload date of the filemetadata- the optional metadata for the file
-
-
Method Detail
-
getObjectId
public ObjectId getObjectId()
TheObjectIdfor this file. Throws a MongoGridFSException if the file id is not an ObjectId.- Returns:
- the id for this file.
-
getFilename
public String getFilename()
The filename- Returns:
- the filename
-
getLength
public long getLength()
The length, in bytes of this file- Returns:
- the length, in bytes of this file
-
getChunkSize
public int getChunkSize()
The size, in bytes, of each data chunk of this file- Returns:
- the size, in bytes, of each data chunk of this file
-
getUploadDate
public Date getUploadDate()
The date and time this file was added to GridFS- Returns:
- the date and time this file was added to GridFS
-
getMetadata
@Nullable public Document getMetadata()
Any additional metadata stored along with the file- Returns:
- the metadata document or null
-
-