Class BlobInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Constructor Summary
ConstructorsConstructorDescriptionBlobInputStream(LargeObject lo, int bsize) BlobInputStream(LargeObject lo, int bsize, long limit) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this input stream and releases any system resources associated with the stream.voidmark(int readlimit) Marks the current position in this input stream.booleanTests if this input stream supports themarkandresetmethods.intread()The minimum required to implement input stream.intread(byte[] dest, int off, int len) voidreset()Repositions this stream to the position at the time themarkmethod was last called on this input stream.longskip(long n) Skips over and discardsnbytes of data from this input stream.Methods inherited from class java.io.InputStream
available, nullInputStream, read, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
BlobInputStream
- Parameters:
lo- LargeObject to read from
-
BlobInputStream
- Parameters:
lo- LargeObject to read frombsize- buffer size
-
BlobInputStream
- Parameters:
lo- LargeObject to read frombsize- buffer sizelimit- max number of bytes to read
-
-
Method Details
-
read
The minimum required to implement input stream.- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
close
Closes this input stream and releases any system resources associated with the stream.The
closemethod ofInputStreamdoes nothing.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException- if an I/O error occurs.
-
mark
public void mark(int readlimit) Marks the current position in this input stream. A subsequent call to theresetmethod repositions this stream at the last marked position so that subsequent reads re-read the same bytes.The
readlimitarguments tells this input stream to allow that many bytes to be read before the mark position gets invalidated.The general contract of
markis that, if the methodmarkSupportedreturnstrue, the stream somehow remembers all the bytes read after the call tomarkand stands ready to supply those same bytes again if and whenever the methodresetis called. However, the stream is not required to remember any data at all if more thanreadlimitbytes are read from the stream beforeresetis called.Marking a closed stream should not have any effect on the stream.
- Overrides:
markin classInputStream- Parameters:
readlimit- the maximum limit of bytes that can be read before the mark position becomes invalid.- See Also:
-
reset
Repositions this stream to the position at the time themarkmethod was last called on this input stream. NB: If mark is not called we move to the beginning.- Overrides:
resetin classInputStream- Throws:
IOException- See Also:
-
markSupported
public boolean markSupported()Tests if this input stream supports themarkandresetmethods. ThemarkSupportedmethod ofInputStreamreturnsfalse.- Overrides:
markSupportedin classInputStream- Returns:
trueif this true type supports the mark and reset method;falseotherwise.- See Also:
-
skip
Skips over and discardsnbytes of data from this input stream.Unlike the default implementation, this seeks instead of reading and discarding the bytes, so the cost does not grow with
n.Large objects are sparse, so the stream allows skipping past the current end of the object. Subsequent reads then return
-1, and the skipped count still reflects the requested distance, as theInputStream.skip(long)contract permits.- Overrides:
skipin classInputStream- Parameters:
n- the number of bytes to be skipped- Returns:
- the actual number of bytes skipped, which may be zero
- Throws:
IOException- if the underlying seek fails, in particular when the target position exceeds the maximum large object size the server accepts- See Also:
-