java.lang.Object
org.firebirdsql.jdbc.FBCachedBlob
- All Implemented Interfaces:
Blob,FirebirdBlob
This class represents a cached blob field.
This class is internal API of Jaybird. Future versions may radically change, move, or make inaccessible this type.
For the public API, refer to the Blob and FirebirdBlob interfaces.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.firebirdsql.jdbc.FirebirdBlob
FirebirdBlob.BlobInputStream, FirebirdBlob.BlobOutputStream -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondetach()Detach this blob.voidfree()getBinaryStream(long pos, long length) byte[]getBytes()Gets the byte content of this blob as a byte array.byte[]getBytes(long pos, int length) booleanCheck 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.longFind the first entry of the specified pattern.setBinaryStream(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.
-
Constructor Details
-
FBCachedBlob
public FBCachedBlob(byte[] data) Create an instance using the cached data.- Parameters:
data- array of bytes containing the cached data.
-
-
Method Details
-
detach
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 interfaceFirebirdBlob- Returns:
- instance of
FirebirdBlobthat is not under result set control. - Throws:
SQLException- if Blob cannot be detached.
-
isSegmented
Check if blob is segmented. If Blob is segmented, you cannot useFirebirdBlob.BlobInputStream.seek(int)method.An instance of
FBCachedBlobreturnsfalsealways.- Specified by:
isSegmentedin interfaceFirebirdBlob- Returns:
trueif this blob is segmented, otherwisefalse- Throws:
SQLException
-
length
Get the length of the cached blob field.- Specified by:
lengthin interfaceBlob- Returns:
- length of the cached blob field or -1 if the field is null.
- Throws:
SQLException
-
getBytes
- Specified by:
getBytesin interfaceBlob- Throws:
SQLException
-
getBytes
Description copied from interface:FirebirdBlobGets the byte content of this blob as a byte array.- Specified by:
getBytesin interfaceFirebirdBlob- Returns:
- byte array with blob content (may return
nullfor certain cached blobs) - Throws:
SQLException- for database access errors, or if the blob size exceeds the maximum safe array size (i.e.Integer.MAX_VALUE- 8)
-
position
Find the first entry of the specified pattern.- Specified by:
positionin interfaceBlob- Throws:
SQLException- always, not yet implemented.
-
position
Find the first entry of the specified pattern.- Specified by:
positionin interfaceBlob- Throws:
SQLException- always, not yet implemented.
-
getBinaryStream
- Specified by:
getBinaryStreamin interfaceBlob- Throws:
SQLException
-
getBinaryStream
- Specified by:
getBinaryStreamin interfaceBlob- Throws:
SQLException
-
setBytes
Set contents of the blob.- Specified by:
setBytesin interfaceBlob- Throws:
SQLException- always, set methods are not relevant in cached state.
-
setBytes
Set the contents of blob.- Specified by:
setBytesin interfaceBlob- Throws:
SQLException- always, set methods are not relevant in cached state.
-
setBinaryStream
Set the contents of blob as binary stream.- Specified by:
setBinaryStreamin interfaceBlob- Throws:
SQLException- always, set methods are not relevant in cached state.
-
truncate
Truncate the blob to specified length.- Specified by:
truncatein interfaceBlob- Throws:
SQLException- always, truncate is not relevant in cached state.
-
free
- Specified by:
freein interfaceBlob- Throws:
SQLException
-