Closeable
, AutoCloseable
@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 IOException
s. However, it will throw a
MongoException
if there is an error reading from MongoDB.
Constructor | Description |
---|---|
GridFSDownloadStream() |
Modifier and Type | Method | 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, markSupported, readAllBytes, readNBytes, transferTo
public 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 InputStream
public abstract int read(byte[] b)
read
in class InputStream
public abstract int read(byte[] b, int off, int len)
read
in class InputStream
public abstract long skip(long n)
skip
in class InputStream
public abstract int available()
available
in class InputStream
public 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 InputStream
public abstract void close()
close
in interface AutoCloseable
close
in interface Closeable
close
in class InputStream