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 boolean
equals(Object o)
int
getChunkSize()
The size, in bytes, of each data chunk of this fileString
getFilename()
The filenameBsonValue
getId()
TheBsonValue
id for this file.long
getLength()
The length, in bytes of this fileDocument
getMetadata()
Any additional metadata stored along with the fileObjectId
getObjectId()
TheObjectId
for this file.Date
getUploadDate()
The date and time this file was added to GridFSint
hashCode()
String
toString()
-
-
-
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()
TheObjectId
for 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
-
-