Top Description Fields Constructors Methods
org.hsqldb.types

public Class BlobInputStream

extends InputStream
Class Inheritance
Imports
java.io.IOException, .InputStream, org.hsqldb.SessionInterface, org.hsqldb.error.Error, .ErrorCode, org.hsqldb.lib.java.JavaSystem

This class is used as an InputStream to retrieve data from a Blob. mark() and reset() are not supported.
Author
Fred Toussi (fredt@users dot sourceforge.net)
Since
1.9.0
Version
2.0.1

Field Summary

Modifier and TypeField and Description
pack-priv final long
pack-priv final BlobData
pack-priv byte[]
pack-priv long
pack-priv long
pack-priv boolean
public final SessionInterface
pack-priv int

Constructor Summary

AccessConstructor and Description
public
BlobInputStream(SessionInterface session, BlobData blob, long offset, long length)

Method Summary

Modifier and TypeMethod and Description
public int
available()

Overrides java.io.InputStream.available.

Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking, which may be 0, or 0 when end of stream is detected.

private void
public void
close()

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

Closes this input stream and releases any system resources associated with the stream.

pack-priv static boolean
isInLimits(long fullLength, long pos, long len)

public int
read()

Implements abstract java.io.InputStream.read.

Reads the next byte of data from the input stream.

private void
public long
skip(long n)

Overrides java.io.InputStream.skip.

Skips over and discards n bytes of data from this input stream.

Inherited from java.io.InputStream:
markmarkSupportednullInputStreamreadreadreadAllBytesreadNBytesreadNBytesresetskipNBytestransferTo

Field Detail

availableLengthback to summary
pack-priv final long availableLength
blobback to summary
pack-priv final BlobData blob
bufferback to summary
pack-priv byte[] buffer
bufferOffsetback to summary
pack-priv long bufferOffset
currentPositionback to summary
pack-priv long currentPosition
isClosedback to summary
pack-priv boolean isClosed
sessionback to summary
public final SessionInterface session
streamBlockSizeback to summary
pack-priv int streamBlockSize

Constructor Detail

BlobInputStreamback to summary
public BlobInputStream(SessionInterface session, BlobData blob, long offset, long length)

Method Detail

availableback to summary
public int available()

Overrides java.io.InputStream.available.

Doc from java.io.InputStream.available.

Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking, which may be 0, or 0 when end of stream is detected. The read might be on the same thread or another thread. A single read or skip of this many bytes will not block, but may read or skip fewer bytes.

Note that while some implementations of InputStream will return the total number of bytes in the stream, many will not. It is never correct to use the return value of this method to allocate a buffer intended to hold all data in this stream.

A subclass's implementation of this method may choose to throw an IOException if this input stream has been closed by invoking the close() method.

checkClosedback to summary
private void checkClosed() throws IOException
closeback to summary
public void close()

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

Doc from java.io.InputStream.close.

Closes this input stream and releases any system resources associated with the stream.

isInLimitsback to summary
pack-priv static boolean isInLimits(long fullLength, long pos, long len)
readback to summary
public int read() throws IOException

Implements abstract java.io.InputStream.read.

Doc from java.io.InputStream.read.

Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

Exceptions
IOException:
if an I/O error occurs.
readIntoBufferback to summary
private void readIntoBuffer()
skipback to summary
public long skip(long n) throws IOException

Overrides java.io.InputStream.skip.

Doc from java.io.InputStream.skip.

Skips over and discards n bytes of data from this input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. This may result from any of a number of conditions; reaching end of file before n bytes have been skipped is only one possibility. The actual number of bytes skipped is returned. If n is negative, the skip method for class InputStream always returns 0, and no bytes are skipped. Subclasses may handle the negative value differently.

Exceptions
IOException:
if an I/O error occurs.