public final class GridFSFile extends Object
Constructor | Description |
---|---|
GridFSFile(BsonValue id,
String filename,
long length,
int chunkSize,
Date uploadDate,
String md5,
Document metadata) |
Creates a new GridFSFile
|
GridFSFile(BsonValue id,
String filename,
long length,
int chunkSize,
Date uploadDate,
String md5,
Document metadata,
Document extraElements) |
Creates a legacy implementation of the GridFSFile
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(Object o) |
|
List<String> |
getAliases() |
Deprecated.
any aliases should be stored in the metadata document instead.
|
int |
getChunkSize() |
The size, in bytes, of each data chunk of this file
|
String |
getContentType() |
Deprecated.
content type information should be stored the metadata document instead.
|
Document |
getExtraElements() |
Deprecated.
any extra information should be stored in the metadata document instead.
|
String |
getFilename() |
The filename
|
BsonValue |
getId() |
The
BsonValue id for this file. |
long |
getLength() |
The length, in bytes of this file
|
String |
getMD5() |
Deprecated.
file hashing is deprecated and may be removed in the future.
|
Document |
getMetadata() |
Any additional metadata stored along with the file
|
ObjectId |
getObjectId() |
The
ObjectId for this file. |
Date |
getUploadDate() |
The date and time this file was added to GridFS
|
int |
hashCode() |
|
String |
toString() |
public GridFSFile(BsonValue id, String filename, long length, int chunkSize, Date uploadDate, @Nullable String md5, Document metadata)
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 filemd5
- the hash of the files contentsmetadata
- the optional metadata for the filepublic GridFSFile(BsonValue id, String filename, long length, int chunkSize, Date uploadDate, @Nullable String md5, @Nullable Document metadata, @Nullable Document extraElements)
For GridFS files created in older versions of the driver.
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 filemd5
- the hash of the files contentsmetadata
- the optional metadata for the fileextraElements
- any extra data stored in the documentpublic ObjectId getObjectId()
ObjectId
for this file.
Throws a MongoGridFSException if the file id is not an ObjectId.public String getFilename()
public long getLength()
public int getChunkSize()
public Date getUploadDate()
@Deprecated @Nullable public String getMD5()
@Nullable public Document getMetadata()
@Deprecated @Nullable public Document getExtraElements()
@Deprecated public String getContentType()
@Deprecated public List<String> getAliases()