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() |
flush
private 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()
GridFSUploadStream
ObjectId
for the file to be uploaded
Throws a MongoGridFSException
if the file id is not an ObjectId.getFileId
in class GridFSUploadStream
public ObjectId getObjectId()
GridFSUploadStream
ObjectId
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 GridFSUploadStream
public BsonValue getId()
GridFSUploadStream
BsonValue
for the file to be uploadedgetId
in class GridFSUploadStream
public void abort()
GridFSUploadStream
abort
in class GridFSUploadStream
public void write(int b)
write
in class GridFSUploadStream
public void write(byte[] b)
write
in class GridFSUploadStream
public void write(byte[] b, int off, int len)
write
in class GridFSUploadStream
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class GridFSUploadStream
private void writeChunk()
private Binary getData()
private void checkClosed()