Package com.mongodb.client.gridfs.model
Class GridFSFile
java.lang.Object
com.mongodb.client.gridfs.model.GridFSFile
The GridFSFile
- Since:
- 3.1
-
Constructor Summary
ConstructorDescriptionGridFSFile
(BsonValue id, String filename, long length, int chunkSize, Date uploadDate, Document metadata) Creates a new GridFSFile -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
The size, in bytes, of each data chunk of this fileThe filenamegetId()
TheBsonValue
id for this file.long
The length, in bytes of this fileAny additional metadata stored along with the fileTheObjectId
for this file.The date and time this file was added to GridFSint
hashCode()
toString()
-
Constructor Details
-
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 Details
-
getObjectId
TheObjectId
for this file. Throws a MongoGridFSException if the file id is not an ObjectId.- Returns:
- the id for this file.
-
getId
TheBsonValue
id for this file.- Returns:
- the id for this file
-
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
The date and time this file was added to GridFS- Returns:
- the date and time this file was added to GridFS
-
getMetadata
Any additional metadata stored along with the file- Returns:
- the metadata document or null
-
equals
-
hashCode
public int hashCode() -
toString
-