public class JnaBlob extends AbstractFbBlob implements FbBlob, DatabaseListener
FbBlob
for native client access.FbBlob.SeekMode
exceptionListenerDispatcher
NO_BLOB_ID
Constructor and Description |
---|
JnaBlob(JnaDatabase database,
JnaTransaction transaction,
BlobParameterBuffer blobParameterBuffer) |
JnaBlob(JnaDatabase database,
JnaTransaction transaction,
BlobParameterBuffer blobParameterBuffer,
long blobId) |
Modifier and Type | Method and Description |
---|---|
protected void |
cancelImpl()
Internal implementation of
AbstractFbBlob.cancel() . |
protected void |
closeImpl()
Internal implementation of
AbstractFbBlob.close() . |
long |
getBlobId() |
byte[] |
getBlobInfo(byte[] requestItems,
int bufferLength)
Request blob info.
|
JnaDatabase |
getDatabase() |
int |
getHandle() |
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 |
putSegment(byte[] segment)
Writes a segment of blob data.
|
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, clearTransaction, close, createBlobLengthProcessor, detached, detaching, getBlobInfo, getBlobParameterBuffer, getMaximumSegmentSize, getSynchronizationObject, isEndingTransaction, isEof, isOpen, length, removeExceptionListener, resetEof, setEof, setOpen, transactionStateChanged, warningReceived
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cancel, close, getBlobInfo, getMaximumSegmentSize, getSynchronizationObject, isEof, isOpen, length
addExceptionListener, removeExceptionListener
detached, detaching, warningReceived
public JnaBlob(JnaDatabase database, JnaTransaction transaction, BlobParameterBuffer blobParameterBuffer)
public JnaBlob(JnaDatabase database, JnaTransaction transaction, BlobParameterBuffer blobParameterBuffer, long blobId)
public JnaDatabase getDatabase()
getDatabase
in interface FbBlob
getDatabase
in class AbstractFbBlob
public JnaTransaction getTransaction()
getTransaction
in class AbstractFbBlob
public int getHandle()
public final com.sun.jna.ptr.IntByReference getJnaHandle()
public final long getBlobId()
public void open() throws java.sql.SQLException
FbBlob
public 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 FbBlob
sizeRequested
- 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.public void putSegment(byte[] segment) throws java.sql.SQLException
FbBlob
Implementation must handle segment length exceeding FbBlob.getMaximumSegmentSize()
by batching. TODO: reconsider and let caller handle that?
Passing a section that is length 0 will throw an SQLException
.
putSegment
in interface FbBlob
segment
- Segment to writejava.sql.SQLException
- If this is an input blob, the blob is closed, the transaction is not active, the segment is length 0 or
longer than the maximum segment size, or a database connection error occurred.public void seek(int offset, FbBlob.SeekMode seekMode) throws java.sql.SQLException
FbBlob
seekMode
and offset
.
Firebird only supports seek on stream blobs.
seek
in interface FbBlob
offset
- Offset of the seek, effect depends on value of seekMode
seekMode
- Value of FbBlob.SeekMode
java.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
FbBlob
getBlobInfo
in interface FbBlob
requestItems
- Array of info items to requestbufferLength
- Response buffer length to usejava.sql.SQLException
protected void closeImpl() throws java.sql.SQLException
AbstractFbBlob
AbstractFbBlob.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 AbstractFbBlob
java.sql.SQLException
protected void cancelImpl() throws java.sql.SQLException
AbstractFbBlob
AbstractFbBlob.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 AbstractFbBlob
java.sql.SQLException
protected void releaseResources()
AbstractFbBlob
releaseResources
in class AbstractFbBlob
Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.