public final class FBBlobInputStream extends java.io.InputStream implements FirebirdBlob.BlobInputStream
SEEK_MODE_ABSOLUTE, SEEK_MODE_FROM_TAIL, SEEK_MODE_RELATIVE
Modifier and Type | Method and Description |
---|---|
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 a single byte from the stream.
|
int |
read(byte[] b,
int off,
int len)
Read some bytes from the stream into
buffer . |
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. |
int |
readNBytes(byte[] b,
int off,
int len)
Similar to Java 9's
InputStream#readNBytes(byte[], int, int) |
byte[] |
readNBytes(int len)
Similar to Java 9's
InputStream#readNBytes(int) . |
void |
seek(int position)
Move current position in the Blob stream.
|
void |
seek(int position,
FbBlob.SeekMode seekMode) |
void |
seek(int position,
int seekMode)
Move current position in the Blob stream.
|
long |
transferTo(java.io.OutputStream out) |
public FirebirdBlob getBlob()
FirebirdBlob.BlobInputStream
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
FirebirdBlob
.public void seek(int position) throws java.io.IOException
FirebirdBlob.BlobInputStream
FirebirdBlob.BlobInputStream.seek(int, int)
passing
FirebirdBlob.BlobInputStream.SEEK_MODE_ABSOLUTE
as seek mode.seek
in interface FirebirdBlob.BlobInputStream
position
- absolute position to seek, starting position is 0 (note, in Blob.getBytes(long, int)
starting
position is 1).java.io.IOException
- if I/O error occurs.public void seek(int position, int seekMode) throws java.io.IOException
FirebirdBlob.BlobInputStream
seek
in interface FirebirdBlob.BlobInputStream
position
- position in the stream, starting position is 0 (note, in Blob.getBytes(long, int)
starting
position is 1)seekMode
- mode of seek operation, one of FirebirdBlob.BlobInputStream.SEEK_MODE_ABSOLUTE
, FirebirdBlob.BlobInputStream.SEEK_MODE_RELATIVE
or
FirebirdBlob.BlobInputStream.SEEK_MODE_FROM_TAIL
java.io.IOException
- if I/O error occurspublic void seek(int position, FbBlob.SeekMode seekMode) throws java.io.IOException
java.io.IOException
public long length() throws java.io.IOException
FirebirdBlob.BlobInputStream
inputStream.getBlob().length()
call, and is more resource
friendly, because no new Blob handle is created.length
in interface FirebirdBlob.BlobInputStream
java.io.IOException
- if I/O error occurspublic int available() throws java.io.IOException
FirebirdBlob.BlobInputStream
available
in interface FirebirdBlob.BlobInputStream
available
in class java.io.InputStream
java.io.IOException
- if I/O error occurred.public int read() throws java.io.IOException
FirebirdBlob.BlobInputStream
read
in interface FirebirdBlob.BlobInputStream
read
in class java.io.InputStream
-1
if end of stream was reachedjava.io.IOException
- if I/O error occursInputStream.read()
public int read(byte[] b, int off, int len) throws java.io.IOException
FirebirdBlob.BlobInputStream
buffer
.
The implementation may read less bytes than requested. Implementations may perform multiple roundtrips to
the server to fill buffer
up to the requested length.
read
in interface FirebirdBlob.BlobInputStream
read
in class java.io.InputStream
b
- buffer into which data should be readoff
- offset in the buffer where to startlen
- number of bytes to read0
if len == 0
, -1
if
end-of-blob was reached without reading any bytesjava.io.IOException
- if I/O error occursInputStream.read(byte[], int, int)
public int readNBytes(byte[] b, int off, int len) throws java.io.IOException
FirebirdBlob.BlobInputStream
InputStream#readNBytes(byte[], int, int)
readNBytes
in interface FirebirdBlob.BlobInputStream
java.io.IOException
public byte[] readNBytes(int len) throws java.io.IOException
FirebirdBlob.BlobInputStream
InputStream#readNBytes(int)
.readNBytes
in interface FirebirdBlob.BlobInputStream
java.io.IOException
public void readFully(byte[] b, int off, int len) throws java.io.IOException
FirebirdBlob.BlobInputStream
length
from the stream into the specified buffer.
This method will throw an EOFException
if end-of-blob was reached before reading length
bytes.
readFully
in interface FirebirdBlob.BlobInputStream
b
- buffer where data should be readoff
- offset in the buffer where to startlen
- number of bytes to readjava.io.EOFException
- if stream end was reached when reading data.java.io.IOException
- if I/O error occurs.public void readFully(byte[] b) throws java.io.IOException
FirebirdBlob.BlobInputStream
buffer.length
bytes from the buffer. This is a shortcut method for
readFully(buffer, 0, buffer.length)
call.readFully
in interface FirebirdBlob.BlobInputStream
b
- buffer where data should be readjava.io.IOException
- if I/O error occurspublic long transferTo(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
FirebirdBlob.BlobInputStream
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface FirebirdBlob.BlobInputStream
close
in class java.io.InputStream
java.io.IOException
- if I/O error occurs.Copyright © 2001-2025 Jaybird (Firebird JDBC) team. All rights reserved.