public class JnaBlob extends AbstractFbBlob implements FbBlob, DatabaseListener
FbBlob for native client access.AbstractFbBlob.BlobStateFbBlob.SeekModeexceptionListenerDispatcherNO_BLOB_ID| Constructor and Description |
|---|
JnaBlob(JnaDatabase database,
JnaTransaction transaction,
BlobParameterBuffer blobParameterBuffer)
Creates a blob for output (writing to the database).
|
JnaBlob(JnaDatabase database,
JnaTransaction transaction,
BlobParameterBuffer blobParameterBuffer,
long blobId)
Creates a blob for input (reading from the database).
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
cancelImpl()
Internal implementation of
AbstractFbBlob.cancel(). |
protected void |
closeImpl()
Internal implementation of
AbstractFbBlob.close(). |
protected int |
get(byte[] b,
int off,
int len,
int minLen)
Default implementation for
AbstractFbBlob.get(byte[], int, int) and AbstractFbBlob.get(byte[], int, int, float). |
long |
getBlobId()
Returns the blob id.
|
byte[] |
getBlobInfo(byte[] requestItems,
int bufferLength)
Request blob info.
|
JnaDatabase |
getDatabase() |
int |
getHandle()
Returns the blob handle identifier.
|
com.sun.jna.ptr.IntByReference |
getJnaHandle() |
byte[] |
getSegment(int sizeRequested)
Gets a segment of blob data.
|
JnaTransaction |
getTransaction() |
boolean |
isOutput() |
void |
open()
Opens an existing input blob, or creates an output blob.
|
void |
put(byte[] b,
int off,
int len)
Writes content of
b starting at off for length bytes to the blob. |
protected void |
releaseResources()
Release Java resources held.
|
void |
seek(int offset,
FbBlob.SeekMode seekMode)
Performs a seek on a blob with the specified
seekMode and offset. |
addExceptionListener, cancel, checkBlobClosed, checkBlobOpen, checkDatabaseAttached, checkTransactionActive, clearDatabase, clearDeferredException, clearTransaction, close, createBlobLengthProcessor, detached, detaching, errorOccurred, get, get, getBlobInfo, getBlobParameterBuffer, getKnownBlobInfoItems, getMaximumSegmentSize, getState, isEndingTransaction, isEof, isOpen, length, putSegment, registerDeferredException, removeExceptionListener, resetEof, setEof, setState, throwAndClearDeferredException, transactionStateChanged, transferDeferredExceptionTo, warningReceived, withLockclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcancel, close, get, get, getBlobInfo, getMaximumSegmentSize, isEof, isOpen, length, putSegmentaddExceptionListener, removeExceptionListenerdetached, detaching, warningReceivedpublic JnaBlob(JnaDatabase database, JnaTransaction transaction, BlobParameterBuffer blobParameterBuffer) throws java.sql.SQLException
database - databasetransaction - transactionblobParameterBuffer - blob parameter bufferjava.sql.SQLExceptionpublic JnaBlob(JnaDatabase database, JnaTransaction transaction, BlobParameterBuffer blobParameterBuffer, long blobId) throws java.sql.SQLException
database - databasetransaction - transactionblobParameterBuffer - blob parameter bufferblobId - blob idjava.sql.SQLExceptionpublic JnaDatabase getDatabase()
getDatabase in interface FbBlobgetDatabase in class AbstractFbBlobpublic JnaTransaction getTransaction()
getTransaction in class AbstractFbBlobpublic int getHandle()
FbBlob
If the blob wasn't opened yet, this will return 0. If the blob was deferred opened (client-side only),
this will return an invalid blob handle value (e.g. 0xFFFF, though this value is potentially
protocol/implementation specific).
public final com.sun.jna.ptr.IntByReference getJnaHandle()
public final long getBlobId()
FbBlob
For output blobs, this will return FbBlob.NO_BLOB_ID (0L) if the blob wasn't opened yet, or if the blob
is deferred opened (client-side only). The value FbBlob.NO_BLOB_ID is technically invalid, but Firebird will
handle it as an empty blob (both for input and output).
public void open()
throws java.sql.SQLException
FbBlobpublic final boolean isOutput()
public byte[] getSegment(int sizeRequested)
throws java.sql.SQLException
FbBlob
When sizeRequested exceeds FbBlob.getMaximumSegmentSize() it is silently reduced to the maximum
segment size.
getSegment in interface FbBlobsizeRequested - Requested segment size (> 0).java.sql.SQLException - If this is an output blob, the blob is closed, the transaction is not active, or a database connection
error occurred.FbBlob.get(byte[], int, int)protected int get(byte[] b,
int off,
int len,
int minLen)
throws java.sql.SQLException
AbstractFbBlobAbstractFbBlob.get(byte[], int, int) and AbstractFbBlob.get(byte[], int, int, float).get in class AbstractFbBlobb - target byte arrayoff - offset to startlen - number of bytesminLen - minimum number of bytes to fill (must be 0 < minLen <= len if len != 00 if len == 0, will only be less than minLen if
end-of-blob is reachedjava.sql.SQLException - for database access errors, if off < 0, len < 0, or if off + len > b.length,
or len != 0 && (minLen <= 0 || minLen > len)public void put(byte[] b,
int off,
int len)
throws java.sql.SQLException
FbBlobb starting at off for length bytes to the blob.
Implementations must write all bytes to the blob, using multiple round-trips if necessary.
If the implementation cannot perform writes without additional allocation, it should use at most
DatabaseConnectionProperties.getBlobBufferSize() as an internal buffer. If the implementation can
perform writes without additional allocation, it is recommended it performs reads using (at most)
FbBlob.getMaximumSegmentSize().
public void seek(int offset,
FbBlob.SeekMode seekMode)
throws java.sql.SQLException
FbBlobseekMode and offset.
Firebird only supports seek on stream blobs.
seek in interface FbBloboffset - Offset of the seek, effect depends on value of seekModeseekMode - Value of FbBlob.SeekModejava.sql.SQLException - If the blob is closed, the transaction is not active, or a database error occurred.public byte[] getBlobInfo(byte[] requestItems,
int bufferLength)
throws java.sql.SQLException
FbBlobgetBlobInfo in interface FbBlobrequestItems - Array of info items to requestbufferLength - Response buffer length to usejava.sql.SQLExceptionprotected void closeImpl()
throws java.sql.SQLException
AbstractFbBlobAbstractFbBlob.close(). The implementation does not need
to check for attached database and active transaction, nor does it need to mark this blob as closed.closeImpl in class AbstractFbBlobjava.sql.SQLExceptionprotected void cancelImpl()
throws java.sql.SQLException
AbstractFbBlobAbstractFbBlob.cancel(). The implementation does not need
to check for attached database and active transaction, nor does it need to mark this blob as closed.cancelImpl in class AbstractFbBlobjava.sql.SQLExceptionprotected void releaseResources()
AbstractFbBlobreleaseResources in class AbstractFbBlobCopyright © 2001-2025 Jaybird (Firebird JDBC) team. All rights reserved.