final class GridFSUploadStreamImpl extends GridFSUploadStream
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
buffer |
private int |
bufferOffset |
private int |
chunkIndex |
private MongoCollection<Document> |
chunksCollection |
private int |
chunkSizeBytes |
private boolean |
closed |
private java.lang.Object |
closeLock |
private BsonValue |
fileId |
private java.lang.String |
filename |
private MongoCollection<GridFSFile> |
filesCollection |
private long |
lengthInBytes |
private java.security.MessageDigest |
md5 |
private Document |
metadata |
| Constructor and Description |
|---|
GridFSUploadStreamImpl(MongoCollection<GridFSFile> filesCollection,
MongoCollection<Document> chunksCollection,
BsonValue fileId,
java.lang.String filename,
int chunkSizeBytes,
Document metadata) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Aborts the upload and deletes any data.
|
private void |
checkClosed() |
void |
close() |
private Binary |
getData() |
ObjectId |
getFileId()
Deprecated.
|
BsonValue |
getId()
Gets the
BsonValue for the file to be uploaded |
ObjectId |
getObjectId()
Gets the
ObjectId for the file to be uploaded or throws an error if an alternative BsonType has been used for the id. |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
private void |
writeChunk() |
flushprivate final MongoCollection<GridFSFile> filesCollection
private final MongoCollection<Document> chunksCollection
private final BsonValue fileId
private final java.lang.String filename
private final int chunkSizeBytes
private final Document metadata
private final java.security.MessageDigest md5
private byte[] buffer
private long lengthInBytes
private int bufferOffset
private int chunkIndex
private final java.lang.Object closeLock
private boolean closed
GridFSUploadStreamImpl(MongoCollection<GridFSFile> filesCollection, MongoCollection<Document> chunksCollection, BsonValue fileId, java.lang.String filename, int chunkSizeBytes, Document metadata)
@Deprecated public ObjectId getFileId()
GridFSUploadStreamObjectId for the file to be uploaded
Throws a MongoGridFSException if the file id is not an ObjectId.getFileId in class GridFSUploadStreampublic ObjectId getObjectId()
GridFSUploadStreamObjectId for the file to be uploaded or throws an error if an alternative BsonType has been used for the id.
Throws a MongoGridFSException if the file id is not an ObjectId.getObjectId in class GridFSUploadStreampublic BsonValue getId()
GridFSUploadStreamBsonValue for the file to be uploadedgetId in class GridFSUploadStreampublic void abort()
GridFSUploadStreamabort in class GridFSUploadStreampublic void write(int b)
write in class GridFSUploadStreampublic void write(byte[] b)
write in class GridFSUploadStreampublic void write(byte[] b,
int off,
int len)
write in class GridFSUploadStreampublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class GridFSUploadStreamprivate void writeChunk()
private Binary getData()
private void checkClosed()