public final class FBCachedBlob extends java.lang.Object implements FirebirdBlob, Synchronizable
FirebirdBlob.BlobInputStream, FirebirdBlob.BlobOutputStream
Constructor and Description |
---|
FBCachedBlob(byte[] data)
Create an instance using the cached data.
|
Modifier and Type | Method and Description |
---|---|
FirebirdBlob |
detach()
Detach this blob.
|
void |
free() |
java.io.InputStream |
getBinaryStream() |
java.io.InputStream |
getBinaryStream(long pos,
long length) |
byte[] |
getBytes(long pos,
int length)
Get part of the blob field.
|
java.lang.Object |
getSynchronizationObject()
Get synchronization object.
|
boolean |
isSegmented()
Check if blob is segmented.
|
long |
length()
Get the length of the cached blob field.
|
long |
position(java.sql.Blob pattern,
long start)
Find the first entry of the specified pattern.
|
long |
position(byte[] pattern,
long start)
Find the first entry of the specified pattern.
|
java.io.OutputStream |
setBinaryStream(long pos)
Set the contents of blob as binary stream.
|
int |
setBytes(long pos,
byte[] bytes)
Set contents of the blob.
|
int |
setBytes(long pos,
byte[] bytes,
int offset,
int len)
Set the contents of blob.
|
void |
truncate(long length)
Truncate the blob to specified length.
|
public FBCachedBlob(byte[] data)
data
- array of bytes containing the cached data.public FirebirdBlob detach() throws java.sql.SQLException
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.
As FBCachedBlob
is already detached, it will return itself.
detach
in interface FirebirdBlob
FirebirdBlob
that is not under result set
control.java.sql.SQLException
- if Blob cannot be detached.public boolean isSegmented() throws java.sql.SQLException
FirebirdBlob.BlobInputStream.seek(int)
method.
An instance of FBCachedBlob
returns false
always.
isSegmented
in interface FirebirdBlob
true
if this blob is segmented,
otherwise false
java.sql.SQLException
public long length() throws java.sql.SQLException
length
in interface java.sql.Blob
java.sql.SQLException
public byte[] getBytes(long pos, int length) throws java.sql.SQLException
getBytes
in interface java.sql.Blob
pos
- starting position to copy.length
- amount of bytes to copy.java.sql.SQLException
public long position(byte[] pattern, long start) throws java.sql.SQLException
position
in interface java.sql.Blob
java.sql.SQLException
- always, not yet implemented.public long position(java.sql.Blob pattern, long start) throws java.sql.SQLException
position
in interface java.sql.Blob
java.sql.SQLException
- always, not yet implemented.public java.io.InputStream getBinaryStream() throws java.sql.SQLException
getBinaryStream
in interface java.sql.Blob
java.sql.SQLException
public java.io.InputStream getBinaryStream(long pos, long length) throws java.sql.SQLException
getBinaryStream
in interface java.sql.Blob
java.sql.SQLException
public int setBytes(long pos, byte[] bytes) throws java.sql.SQLException
setBytes
in interface java.sql.Blob
java.sql.SQLException
- always, set methods are not relevant in cached state.public int setBytes(long pos, byte[] bytes, int offset, int len) throws java.sql.SQLException
setBytes
in interface java.sql.Blob
java.sql.SQLException
- always, set methods are not relevant in cached state.public java.io.OutputStream setBinaryStream(long pos) throws java.sql.SQLException
setBinaryStream
in interface java.sql.Blob
java.sql.SQLException
- always, set methods are not relevant in cached state.public void truncate(long length) throws java.sql.SQLException
truncate
in interface java.sql.Blob
java.sql.SQLException
- always, truncate is not relevant in cached state.public final java.lang.Object getSynchronizationObject()
Synchronizable
getSynchronizationObject
in interface Synchronizable
null
.public void free() throws java.sql.SQLException
free
in interface java.sql.Blob
java.sql.SQLException
Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.