@NotThreadSafe public abstract class GridFSDownloadStream extends InputStream
Provides the GridFSFile for the file to being downloaded as well as the read methods of a InputStream
This implementation of a InputStream will not throw IOExceptions. However, it will throw a
MongoException if there is an error reading from MongoDB.
| Constructor and Description |
|---|
GridFSDownloadStream() |
| Modifier and Type | Method and Description |
|---|---|
abstract int |
available() |
abstract GridFSDownloadStream |
batchSize(int batchSize)
Sets the number of chunks to return per batch.
|
abstract void |
close() |
abstract GridFSFile |
getGridFSFile()
Gets the corresponding
GridFSFile for the file being downloaded |
abstract void |
mark()
Marks the current position in this input stream.
|
abstract int |
read() |
abstract int |
read(byte[] b) |
abstract int |
read(byte[] b,
int off,
int len) |
abstract void |
reset() |
abstract long |
skip(long n) |
mark, markSupportedpublic abstract GridFSFile getGridFSFile()
GridFSFile for the file being downloadedpublic abstract GridFSDownloadStream batchSize(int batchSize)
Can be used to control the memory consumption of this InputStream. The smaller the batchSize the lower the memory consumption and higher latency.
batchSize - the batch sizepublic abstract int read()
read in class InputStreampublic abstract int read(byte[] b)
read in class InputStreampublic abstract int read(byte[] b,
int off,
int len)
read in class InputStreampublic abstract long skip(long n)
skip in class InputStreampublic abstract int available()
available in class InputStreampublic abstract void mark()
A subsequent call to the reset method repositions this stream at the last marked position so that subsequent reads
re-read the same bytes.
public abstract void reset()
reset in class InputStreampublic abstract void close()
close in interface Closeableclose in interface AutoCloseableclose in class InputStream