Package org.firebirdsql.jdbc
Interface FirebirdBlob.BlobInputStream
- 
- All Superinterfaces:
- java.lang.AutoCloseable
 - All Known Implementing Classes:
- FBBlobInputStream
 - Enclosing interface:
- FirebirdBlob
 
 public static interface FirebirdBlob.BlobInputStream extends java.lang.AutoCloseableBlob input stream. This interface defines methods to access contents of the Blob field. Some method signatures are copied from theInputStreamonly because it is abstract class and not interface that we can extend.
- 
- 
Field SummaryFields Modifier and Type Field Description static intSEEK_MODE_ABSOLUTESeek based on the absolute beginning of the streamstatic intSEEK_MODE_FROM_TAILSeek relative to the tail end of the streamstatic intSEEK_MODE_RELATIVESeek relative to the current position in the stream
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description intavailable()Get number of available bytes that can be read without blocking.voidclose()Close this stream.FirebirdBlobgetBlob()Get instance ofFirebirdBlobto which this stream belongs to.longlength()Get Blob length.intread()Read a single byte from the stream.intread(byte[] buffer, int offset, int length)Read some bytes from the stream intobuffer.voidreadFully(byte[] buffer)Readbuffer.lengthbytes from the buffer.voidreadFully(byte[] buffer, int offset, int length)Readlengthfrom the stream into the specified buffer.intreadNBytes(byte[] b, int off, int len)Similar to Java 9'sInputStream#readNBytes(byte[], int, int)byte[]readNBytes(int len)Similar to Java 9'sInputStream#readNBytes(int).voidseek(int position)Move current position in the Blob stream.voidseek(int position, int seekMode)Move current position in the Blob stream.
 
- 
- 
- 
Field Detail- 
SEEK_MODE_ABSOLUTEstatic final int SEEK_MODE_ABSOLUTE Seek based on the absolute beginning of the stream- See Also:
- Constant Field Values
 
 - 
SEEK_MODE_RELATIVEstatic final int SEEK_MODE_RELATIVE Seek relative to the current position in the stream- See Also:
- Constant Field Values
 
 - 
SEEK_MODE_FROM_TAILstatic final int SEEK_MODE_FROM_TAIL Seek relative to the tail end of the stream- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getBlobFirebirdBlob getBlob() Get instance ofFirebirdBlobto which this stream belongs to.Note, code FirebirdBlob.BlobInputStream otherStream = (FirebirdBlob.BlobInputStream) inputStream.getBlob().getBinaryStream();will return new stream object.- Returns:
- instance of FirebirdBlob.
 
 - 
availableint available() throws java.io.IOExceptionGet 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.- Returns:
- number of bytes available without blocking or -1 if end of stream is reached.
- Throws:
- java.io.IOException- if I/O error occurred.
 
 - 
closevoid close() throws java.io.IOExceptionClose this stream.- Specified by:
- closein interface- java.lang.AutoCloseable
- Throws:
- java.io.IOException- if I/O error occurs.
 
 - 
lengthlong length() throws java.io.IOExceptionGet Blob length. This is a shortcut forinputStream.getBlob().length()call, and is more resource friendly, because no new Blob handle is created.- Returns:
- length of the blob
- Throws:
- java.io.IOException- if I/O error occurs
 
 - 
readint read() throws java.io.IOException Read a single byte from the stream.- Returns:
- next byte read from the stream or -1if end of stream was reached
- Throws:
- java.io.IOException- if I/O error occurs
- See Also:
- InputStream.read()
 
 - 
readint read(byte[] buffer, int offset, int length) throws java.io.IOExceptionRead some bytes from the stream intobuffer.The implementation may read less bytes than requested. Implementations may perform multiple roundtrips to the server to fill bufferup to the requested length.- Parameters:
- buffer- buffer into which data should be read
- offset- offset in the buffer where to start
- length- number of bytes to read
- Returns:
- number of bytes that were actually read, returns 0iflen == 0,-1if end-of-blob was reached without reading any bytes
- Throws:
- java.io.IOException- if I/O error occurs
- See Also:
- InputStream.read(byte[], int, int)
 
 - 
readFullyvoid readFully(byte[] buffer, int offset, int length) throws java.io.IOExceptionReadlengthfrom the stream into the specified buffer.This method will throw an EOFExceptionif end-of-blob was reached before readinglengthbytes.- Parameters:
- buffer- buffer where data should be read
- offset- offset in the buffer where to start
- length- number of bytes to read
- Throws:
- java.io.EOFException- if stream end was reached when reading data.
- java.io.IOException- if I/O error occurs.
 
 - 
readFullyvoid readFully(byte[] buffer) throws java.io.IOExceptionReadbuffer.lengthbytes from the buffer. This is a shortcut method forreadFully(buffer, 0, buffer.length)call.- Parameters:
- buffer- buffer where data should be read
- Throws:
- java.io.IOException- if I/O error occurs
 
 - 
readNBytesint readNBytes(byte[] b, int off, int len) throws java.io.IOExceptionSimilar to Java 9'sInputStream#readNBytes(byte[], int, int)- Throws:
- java.io.IOException
 
 - 
readNBytesbyte[] readNBytes(int len) throws java.io.IOExceptionSimilar to Java 9'sInputStream#readNBytes(int).- Throws:
- java.io.IOException
 
 - 
seekvoid seek(int position) throws java.io.IOException Move current position in the Blob stream. This is a shortcut method toseek(int, int)passingSEEK_MODE_ABSOLUTEas seek mode.- Parameters:
- position- absolute position to seek, starting position is 0 (note, in- Blob.getBytes(long, int)starting position is 1).
- Throws:
- java.io.IOException- if I/O error occurs.
 
 - 
seekvoid seek(int position, int seekMode) throws java.io.IOExceptionMove current position in the Blob stream. Depending on the specified seek mode, position can be either positive or negative.- Parameters:
- 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_RELATIVEor- SEEK_MODE_FROM_TAIL
- Throws:
- java.io.IOException- if I/O error occurs
 
 
- 
 
-