|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.InputStream
org.firebirdsql.jdbc.FBBlobInputStream
public class FBBlobInputStream
An input stream for reading directly from a FBBlob instance.
| Field Summary |
|---|
| Fields inherited from interface org.firebirdsql.jdbc.FirebirdBlob.BlobInputStream |
|---|
SEEK_MODE_ABSOLUTE, SEEK_MODE_FROM_TAIL, SEEK_MODE_RELATIVE |
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.io.InputStream |
|---|
mark, markSupported, read, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public FirebirdBlob getBlob()
FirebirdBlob.BlobInputStreamFirebirdBlob 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.BlobInputStreamFirebirdBlob.
public void seek(int position)
throws java.io.IOException
FirebirdBlob.BlobInputStreamFirebirdBlob.BlobInputStream.seek(int, int) passing FirebirdBlob.BlobInputStream.SEEK_MODE_ABSOLUTE as
seek mode.
seek in interface FirebirdBlob.BlobInputStreamposition - 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.BlobInputStreamNote, 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.BlobInputStreamposition - 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 erro occurs.
public long length()
throws java.io.IOException
FirebirdBlob.BlobInputStreaminputStream.getBlob().length() call, however is more
resource friendly, because no new Blob handle is created.
length in interface FirebirdBlob.BlobInputStreamjava.io.IOException - if I/O error occurs.
public int available()
throws java.io.IOException
FirebirdBlob.BlobInputStream
available in interface FirebirdBlob.BlobInputStreamavailable in class java.io.InputStreamjava.io.IOException - if I/O error occured.
public int read()
throws java.io.IOException
FirebirdBlob.BlobInputStream
read in interface FirebirdBlob.BlobInputStreamread in class java.io.InputStreamjava.io.IOException - if I/O error occurs.
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
FirebirdBlob.BlobInputStream
read in interface FirebirdBlob.BlobInputStreamread in class java.io.InputStreamb - buffer into which data should be read.off - offset in the buffer where to start.len - number of bytes to read.
java.io.IOException - if I/O error occurs.
public void readFully(byte[] b,
int off,
int len)
throws java.io.IOException
FirebirdBlob.BlobInputStreamlength 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.BlobInputStreamb - buffer where data should be read.off - offset in the buffer where to start.len - number of bytes to read.
java.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.BlobInputStreambuffer.length bytes from the buffer. This is a
shortcut method for readFully(buffer, 0, buffer.length)
call.
readFully in interface FirebirdBlob.BlobInputStreamb - buffer where data should be read.
java.io.IOException - if I/O error occurs.
public void close()
throws java.io.IOException
FirebirdBlob.BlobInputStream
close in interface java.io.Closeableclose in interface FirebirdBlob.BlobInputStreamclose in class java.io.InputStreamjava.io.IOException - if I/O error occurs.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||