org.firebirdsql.jdbc
Class FBBlob.FBBlobInputStream
InputStream
org.firebirdsql.jdbc.FBBlob.FBBlobInputStream
- FBBlob
- FirebirdBlob.BlobInputStream
public class FBBlob.FBBlobInputStream
extends InputStream
An input stream for reading directly from a FBBlob instance.
int | available() - Get number of available bytes that can be read without blocking.
|
void | close() - Close this stream.
|
FirebirdBlob | getBlob() - Get instance of
FirebirdBlob to which this stream belongs to.
|
long | length() - Get Blob length.
|
int | read() - Read single byte from the stream.
|
int | read(byte[] b, int off, int len) - Read some bytes from the stream without blocking.
|
void | readFully(byte[] b) - Read
buffer.length bytes from the buffer.
|
void | readFully(byte[] b, int off, int len) - Read
length from the stream into the specified buffer.
|
void | seek(int position) - Move current position in the Blob stream.
|
void | seek(int position, int seekMode) - Move current position in the Blob stream.
|
available
public int available()
throws IOException
Get number of available bytes that can be read without blocking.
This method will return number of bytes of the last read blob segment
in the blob buffer.
- available in interface FirebirdBlob.BlobInputStream
- number of bytes available without blocking or -1 if end of
stream is reached.
getBlob
public FirebirdBlob getBlob()
Get instance of
FirebirdBlob
to which this stream belongs to.
Note, code
FirebirdBlob.BlobInputStream otherStream = (FirebirdBlob.BlobInputStream)
inputStream.getBlob().getBinaryStream();
will return new stream object.
- getBlob in interface FirebirdBlob.BlobInputStream
length
public long length()
throws IOException
Get Blob length. This is shortcut method for the
inputStream.getBlob().length()
call, however is more
resource friendly, because no new Blob handle is created.
- length in interface FirebirdBlob.BlobInputStream
read
public int read()
throws IOException
Read single byte from the stream.
- read in interface FirebirdBlob.BlobInputStream
- next byte read from the stream or -1 if end of stream was
reached.
read
public int read(byte[] b,
int off,
int len)
throws IOException
Read some bytes from the stream without blocking.
- read in interface FirebirdBlob.BlobInputStream
- number of bytes that were read.
readFully
public void readFully(byte[] b)
throws IOException
Read buffer.length
bytes from the buffer. This is a
shortcut method for readFully(buffer, 0, buffer.length)
call.
- readFully in interface FirebirdBlob.BlobInputStream
readFully
public void readFully(byte[] b,
int off,
int len)
throws IOException
Read length
from the stream into the specified buffer.
This method can block until desired number of bytes is read, it can
throw an exception if end of stream was reached during read.
- readFully in interface FirebirdBlob.BlobInputStream
seek
public void seek(int position)
throws IOException
- seek in interface FirebirdBlob.BlobInputStream
position
- absolute position to seek, starting position is
0 (note, in Blob.getBytes(long, int)
starting position is 1).
seek
public void seek(int position,
int seekMode)
throws IOException
Move current position in the Blob stream. Depending on the specified
seek mode, position can be either positive or negative.
Note, this method allows to move position in the Blob stream only
forward. If you need to read data before the current position, new
stream must be opened.
- seek in interface FirebirdBlob.BlobInputStream
Copyright B) 2001 David Jencks and other authors. All rights reserved.