public static interface FirebirdBlob.BlobInputStream
extends java.lang.AutoCloseable
InputStream
only because it is abstract class and not interface
that we can extend.Modifier and Type | Field and Description |
---|---|
static int |
SEEK_MODE_ABSOLUTE
Seek based on the absolute beginning of the stream
|
static int |
SEEK_MODE_FROM_TAIL
Seek relative to the tail end of the stream
|
static int |
SEEK_MODE_RELATIVE
Seek relative to the current position in the stream
|
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[] buffer,
int offset,
int length)
Read some bytes from the stream into
buffer . |
void |
readFully(byte[] buffer)
Read
buffer.length bytes from the buffer. |
void |
readFully(byte[] buffer,
int offset,
int length)
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,
int seekMode)
Move current position in the Blob stream.
|
static final int SEEK_MODE_ABSOLUTE
static final int SEEK_MODE_RELATIVE
static final int SEEK_MODE_FROM_TAIL
FirebirdBlob getBlob()
FirebirdBlob
to which this stream belongs to.
Note, code
FirebirdBlob.BlobInputStream otherStream = (FirebirdBlob.BlobInputStream) inputStream.getBlob().getBinaryStream();will return new stream object.
FirebirdBlob
.int available() throws java.io.IOException
java.io.IOException
- if I/O error occurred.void close() throws java.io.IOException
close
in interface java.lang.AutoCloseable
java.io.IOException
- if I/O error occurs.long length() throws java.io.IOException
inputStream.getBlob().length()
call, and is more resource
friendly, because no new Blob handle is created.java.io.IOException
- if I/O error occursint read() throws java.io.IOException
-1
if end of stream was reachedjava.io.IOException
- if I/O error occursInputStream.read()
int read(byte[] buffer, int offset, int length) throws java.io.IOException
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.
buffer
- buffer into which data should be readoffset
- offset in the buffer where to startlength
- 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)
void readFully(byte[] buffer, int offset, int length) throws java.io.IOException
length
from the stream into the specified buffer.
This method will throw an EOFException
if end-of-blob was reached before reading length
bytes.
buffer
- buffer where data should be readoffset
- offset in the buffer where to startlength
- number of bytes to readjava.io.EOFException
- if stream end was reached when reading data.java.io.IOException
- if I/O error occurs.void readFully(byte[] buffer) throws java.io.IOException
buffer.length
bytes from the buffer. This is a shortcut method for
readFully(buffer, 0, buffer.length)
call.buffer
- buffer where data should be readjava.io.IOException
- if I/O error occursint readNBytes(byte[] b, int off, int len) throws java.io.IOException
InputStream#readNBytes(byte[], int, int)
java.io.IOException
byte[] readNBytes(int len) throws java.io.IOException
InputStream#readNBytes(int)
.java.io.IOException
void seek(int position) throws java.io.IOException
seek(int, int)
passing
SEEK_MODE_ABSOLUTE
as seek mode.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.void seek(int position, int seekMode) throws java.io.IOException
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 SEEK_MODE_ABSOLUTE
, SEEK_MODE_RELATIVE
or
SEEK_MODE_FROM_TAIL
java.io.IOException
- if I/O error occursCopyright © 2001-2025 Jaybird (Firebird JDBC) team. All rights reserved.