Package org.firebirdsql.jdbc
Class FBCachedBlob
- java.lang.Object
- 
- org.firebirdsql.jdbc.FBCachedBlob
 
- 
- All Implemented Interfaces:
- java.sql.Blob,- FirebirdBlob
 
 public final class FBCachedBlob extends java.lang.Object implements FirebirdBlob This class represents a cached blob field.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.firebirdsql.jdbc.FirebirdBlobFirebirdBlob.BlobInputStream, FirebirdBlob.BlobOutputStream
 
- 
 - 
Constructor SummaryConstructors Constructor Description FBCachedBlob(byte[] data)Create an instance using the cached data.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description FirebirdBlobdetach()Detach this blob.voidfree()java.io.InputStreamgetBinaryStream()java.io.InputStreamgetBinaryStream(long pos, long length)byte[]getBytes(long pos, int length)booleanisSegmented()Check if blob is segmented.longlength()Get the length of the cached blob field.longposition(byte[] pattern, long start)Find the first entry of the specified pattern.longposition(java.sql.Blob pattern, long start)Find the first entry of the specified pattern.java.io.OutputStreamsetBinaryStream(long pos)Set the contents of blob as binary stream.intsetBytes(long pos, byte[] bytes)Set contents of the blob.intsetBytes(long pos, byte[] bytes, int offset, int len)Set the contents of blob.voidtruncate(long length)Truncate the blob to specified length.
 
- 
- 
- 
Method Detail- 
detachpublic FirebirdBlob detach() throws java.sql.SQLException Description copied from interface:FirebirdBlobDetach this blob. This method creates new instance of the same blob database object that is not under result set control. When result set is closed, all associated resources are also released, including open blob streams. This method creates a new instance of blob object with the same blob ID that can be used even when result set is closed.Note, detached blob will not remember the stream position of this object. This means that you cannot start reading data from the blob, then detach it, and then continue reading. Reading from detached blob will begin at the blob start. - Specified by:
- detachin interface- FirebirdBlob
- Returns:
- instance of FirebirdBlobthat is not under result set control.
- Throws:
- java.sql.SQLException- if Blob cannot be detached.
 
 - 
isSegmentedpublic boolean isSegmented() throws java.sql.SQLExceptionCheck if blob is segmented. If Blob is segmented, you cannot useFirebirdBlob.BlobInputStream.seek(int)method.An instance of FBCachedBlobreturnsfalsealways.- Specified by:
- isSegmentedin interface- FirebirdBlob
- Returns:
- trueif this blob is segmented, otherwise- false
- Throws:
- java.sql.SQLException
 
 - 
lengthpublic long length() throws java.sql.SQLExceptionGet the length of the cached blob field.- Specified by:
- lengthin interface- java.sql.Blob
- Returns:
- length of the cached blob field or -1 if the field is null.
- Throws:
- java.sql.SQLException
 
 - 
getBytespublic byte[] getBytes(long pos, int length) throws java.sql.SQLException- Specified by:
- getBytesin interface- java.sql.Blob
- Throws:
- java.sql.SQLException
 
 - 
positionpublic long position(byte[] pattern, long start) throws java.sql.SQLExceptionFind the first entry of the specified pattern.- Specified by:
- positionin interface- java.sql.Blob
- Throws:
- java.sql.SQLException- always, not yet implemented.
 
 - 
positionpublic long position(java.sql.Blob pattern, long start) throws java.sql.SQLExceptionFind the first entry of the specified pattern.- Specified by:
- positionin interface- java.sql.Blob
- Throws:
- java.sql.SQLException- always, not yet implemented.
 
 - 
getBinaryStreampublic java.io.InputStream getBinaryStream() throws java.sql.SQLException- Specified by:
- getBinaryStreamin interface- java.sql.Blob
- Throws:
- java.sql.SQLException
 
 - 
getBinaryStreampublic java.io.InputStream getBinaryStream(long pos, long length) throws java.sql.SQLException- Specified by:
- getBinaryStreamin interface- java.sql.Blob
- Throws:
- java.sql.SQLException
 
 - 
setBytespublic int setBytes(long pos, byte[] bytes) throws java.sql.SQLExceptionSet contents of the blob.- Specified by:
- setBytesin interface- java.sql.Blob
- Throws:
- java.sql.SQLException- always, set methods are not relevant in cached state.
 
 - 
setBytespublic int setBytes(long pos, byte[] bytes, int offset, int len) throws java.sql.SQLExceptionSet the contents of blob.- Specified by:
- setBytesin interface- java.sql.Blob
- Throws:
- java.sql.SQLException- always, set methods are not relevant in cached state.
 
 - 
setBinaryStreampublic java.io.OutputStream setBinaryStream(long pos) throws java.sql.SQLExceptionSet the contents of blob as binary stream.- Specified by:
- setBinaryStreamin interface- java.sql.Blob
- Throws:
- java.sql.SQLException- always, set methods are not relevant in cached state.
 
 - 
truncatepublic void truncate(long length) throws java.sql.SQLExceptionTruncate the blob to specified length.- Specified by:
- truncatein interface- java.sql.Blob
- Throws:
- java.sql.SQLException- always, truncate is not relevant in cached state.
 
 - 
freepublic void free() throws java.sql.SQLException- Specified by:
- freein interface- java.sql.Blob
- Throws:
- java.sql.SQLException
 
 
- 
 
-