public class BlobInputStream
extends java.io.InputStream
| Modifier and Type | Field and Description |
|---|---|
private long |
absolutePosition
The absolute position.
|
private byte[] |
buffer
Buffer used to improve performance.
|
private int |
bufferPosition
Position within buffer.
|
(package private) static int |
DEFAULT_MAX_BUFFER_SIZE |
(package private) static int |
INITIAL_BUFFER_SIZE |
private int |
lastBufferSize
The amount of bytes to read on the next read.
|
private long |
limit
The limit.
|
private LargeObject |
lo
The parent LargeObject.
|
private ResourceLock |
lock |
private long |
markPosition
The mark position.
|
private int |
maxBufferSize
The buffer size.
|
| Constructor and Description |
|---|
BlobInputStream(LargeObject lo) |
BlobInputStream(LargeObject lo,
int bsize) |
BlobInputStream(LargeObject lo,
int bsize,
long limit) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this input stream and releases any system resources associated with the stream.
|
private LargeObject |
getLo() |
private int |
getNextBufferSize(int len)
Computes the next buffer size to use for reading data from the large object.
|
void |
mark(int readlimit)
Marks the current position in this input stream.
|
boolean |
markSupported()
Tests if this input stream supports the
mark and reset methods. |
int |
read()
The minimum required to implement input stream.
|
int |
read(byte[] dest,
int off,
int len) |
void |
reset()
Repositions this stream to the position at the time the
mark method was last
called on this input stream. |
static final int DEFAULT_MAX_BUFFER_SIZE
static final int INITIAL_BUFFER_SIZE
private LargeObject lo
private final ResourceLock lock
private long absolutePosition
private byte[] buffer
private int bufferPosition
private int lastBufferSize
buffer, so we can't use buffer.length.private final int maxBufferSize
private long markPosition
private final long limit
public BlobInputStream(LargeObject lo)
lo - LargeObject to read frompublic BlobInputStream(LargeObject lo, int bsize)
lo - LargeObject to read frombsize - buffer sizepublic BlobInputStream(LargeObject lo, int bsize, long limit)
lo - LargeObject to read frombsize - buffer sizelimit - max number of bytes to readpublic int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionprivate int getNextBufferSize(int len)
len - estimated read requestmaxBufferSize if the buffer should not be increasedpublic int read(byte[] dest,
int off,
int len)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
Closes this input stream and releases any system resources associated with the stream.
The close method of InputStream does nothing.
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOException - if an I/O error occurs.public void mark(int readlimit)
Marks the current position in this input stream. A subsequent call to the reset
method repositions this stream at the last marked position so that subsequent reads re-read the
same bytes.
The readlimit arguments tells this input stream to allow that many bytes to be
read before the mark position gets invalidated.
The general contract of mark is that, if the method markSupported
returns true, the stream somehow remembers all the bytes read after the call to
mark and stands ready to supply those same bytes again if and whenever the method
reset is called. However, the stream is not required to remember any data at all
if more than readlimit bytes are read from the stream before reset is
called.
Marking a closed stream should not have any effect on the stream.
mark in class java.io.InputStreamreadlimit - the maximum limit of bytes that can be read before the mark position becomes
invalid.InputStream.reset()public void reset()
throws java.io.IOException
mark method was last
called on this input stream. NB: If mark is not called we move to the beginning.reset in class java.io.InputStreamjava.io.IOExceptionInputStream.mark(int),
IOExceptionpublic boolean markSupported()
mark and reset methods. The
markSupported method of InputStream returns false.markSupported in class java.io.InputStreamtrue if this true type supports the mark and reset method;
false otherwise.InputStream.mark(int),
InputStream.reset()private LargeObject getLo() throws java.io.IOException
java.io.IOException