public final class GridFSFile
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private int |
chunkSize |
private Document |
extraElements |
private java.lang.String |
filename |
private BsonValue |
id |
private long |
length |
private java.lang.String |
md5 |
private Document |
metadata |
private java.util.Date |
uploadDate |
Constructor and Description |
---|
GridFSFile(BsonValue id,
java.lang.String filename,
long length,
int chunkSize,
java.util.Date uploadDate,
java.lang.String md5,
Document metadata)
Creates a new GridFSFile
|
GridFSFile(BsonValue id,
java.lang.String filename,
long length,
int chunkSize,
java.util.Date uploadDate,
java.lang.String md5,
Document metadata,
Document extraElements)
Creates a legacy implementation of the GridFSFile
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
java.util.List<java.lang.String> |
getAliases()
Deprecated.
aliases should be stored in the metadata document.
|
int |
getChunkSize()
The size, in bytes, of each data chunk of this file
|
java.lang.String |
getContentType()
Deprecated.
content type information stored in the metadata document.
|
Document |
getExtraElements()
Deprecated.
any extra information should be stored in the metadata document.
|
java.lang.String |
getFilename()
The filename
|
BsonValue |
getId()
The
BsonValue id for this file. |
long |
getLength()
The length, in bytes of this file
|
java.lang.String |
getMD5()
The hash of the contents of the stored file
|
Document |
getMetadata()
Any additional metadata stored along with the file
|
ObjectId |
getObjectId()
The
ObjectId for this file. |
java.util.Date |
getUploadDate()
The date and time this file was added to GridFS
|
int |
hashCode() |
java.lang.String |
toString() |
private final BsonValue id
private final java.lang.String filename
private final long length
private final int chunkSize
private final java.util.Date uploadDate
private final java.lang.String md5
private final Document metadata
private final Document extraElements
public GridFSFile(BsonValue id, java.lang.String filename, long length, int chunkSize, java.util.Date uploadDate, java.lang.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, java.lang.String filename, long length, int chunkSize, java.util.Date uploadDate, java.lang.String md5, Document metadata, 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 java.lang.String getFilename()
public long getLength()
public int getChunkSize()
public java.util.Date getUploadDate()
public java.lang.String getMD5()
public Document getMetadata()
@Deprecated public Document getExtraElements()
@Deprecated public java.lang.String getContentType()
@Deprecated public java.util.List<java.lang.String> getAliases()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object