public abstract class AbstractFbBlob extends java.lang.Object implements FbBlob, TransactionListener, DatabaseListener
FbBlob.SeekMode| Modifier and Type | Field and Description |
|---|---|
protected ExceptionListenerDispatcher |
exceptionListenerDispatcher |
NO_BLOB_ID| Modifier | Constructor and Description |
|---|---|
protected |
AbstractFbBlob(FbDatabase database,
FbTransaction transaction,
BlobParameterBuffer blobParameterBuffer) |
| Modifier and Type | Method and Description |
|---|---|
void |
addExceptionListener(ExceptionListener listener)
Adds an exception listener to this object.
|
void |
cancel()
Cancels an output blob (which means its contents will be thrown away).
|
protected abstract void |
cancelImpl()
Internal implementation of
cancel(). |
protected void |
checkBlobClosed() |
protected void |
checkBlobOpen() |
protected void |
checkDatabaseAttached() |
protected void |
checkTransactionActive() |
protected void |
clearDatabase() |
protected void |
clearTransaction() |
void |
close()
Closes the blob.
|
protected abstract void |
closeImpl()
Internal implementation of
close(). |
protected BlobLengthProcessor |
createBlobLengthProcessor() |
void |
detached(FbDatabase database)
Called when the
database connection has been detached |
void |
detaching(FbDatabase database)
Called before the
database will be detached. |
<T> T |
getBlobInfo(byte[] requestItems,
int bufferLength,
InfoProcessor<T> infoProcessor)
Request blob info.
|
protected BlobParameterBuffer |
getBlobParameterBuffer() |
FbDatabase |
getDatabase() |
int |
getMaximumSegmentSize()
The maximum segment size allowed by the protocol for
FbBlob.getSegment(int) and FbBlob.putSegment(byte[]). |
java.lang.Object |
getSynchronizationObject()
Get synchronization object.
|
protected FbTransaction |
getTransaction() |
protected boolean |
isEndingTransaction() |
boolean |
isEof() |
boolean |
isOpen() |
long |
length()
Requests the blob length from the server.
|
protected abstract void |
releaseResources()
Release Java resources held.
|
void |
removeExceptionListener(ExceptionListener listener)
Removes an exception listener to this object.
|
protected void |
resetEof()
Resets the eof state of the blob to false (not eof).
|
protected void |
setEof()
Marks this blob as EOF (End of file).
|
protected void |
setOpen(boolean open)
Sets the open state of the blob to the specified value.
|
void |
transactionStateChanged(FbTransaction transaction,
TransactionState newState,
TransactionState previousState)
Signals that the transaction state changed.
|
void |
warningReceived(FbDatabase database,
java.sql.SQLWarning warning)
Called when a warning was received for the
database connection. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetBlobId, getBlobInfo, getHandle, getSegment, isOutput, open, putSegment, seekprotected final ExceptionListenerDispatcher exceptionListenerDispatcher
protected AbstractFbBlob(FbDatabase database, FbTransaction transaction, BlobParameterBuffer blobParameterBuffer)
public final boolean isOpen()
public final boolean isEof()
protected final void setEof()
For an output blob this is a no-op (as those are never end of file, unless explicitly closed)
protected final void resetEof()
This method should only be called by sub-classes of this class.
protected final void setOpen(boolean open)
This method should only be called by sub-classes of this class.
open - New value of open.public final void close()
throws java.sql.SQLException
FbBlobClosing an already closed blob is a no-op.
protected abstract void closeImpl()
throws java.sql.SQLException
close(). The implementation does not need
to check for attached database and active transaction, nor does it need to mark this blob as closed.java.sql.SQLExceptionpublic final void cancel()
throws java.sql.SQLException
FbBlob
Calling cancel on an input blob will close it. Contrary to FbBlob.close(), calling cancel on an
already closed (or cancelled) blob will throw an SQLException.
protected abstract void cancelImpl()
throws java.sql.SQLException
cancel(). The implementation does not need
to check for attached database and active transaction, nor does it need to mark this blob as closed.java.sql.SQLExceptionprotected abstract void releaseResources()
public final java.lang.Object getSynchronizationObject()
FbBlobgetSynchronizationObject in interface FbBlobnull.public void transactionStateChanged(FbTransaction transaction, TransactionState newState, TransactionState previousState)
TransactionListenertransactionStateChanged in interface TransactionListenertransaction - FbTransaction that changed statepublic void detaching(FbDatabase database)
DatabaseListenerdatabase will be detached.
This event is intended for cleanup action, implementer should take care that no exceptions are thrown from this method.
detaching in interface DatabaseListenerdatabase - The database object that is detachingpublic void detached(FbDatabase database)
DatabaseListenerdatabase connection has been detacheddetached in interface DatabaseListenerdatabase - The database object that was detachedpublic void warningReceived(FbDatabase database, java.sql.SQLWarning warning)
DatabaseListenerdatabase connection.
In implementation it is possible that some warnings are not sent to listeners on the database, but only to
listeners on
specific connection derived objects (like an FbStatement implementation).
warningReceived in interface DatabaseListenerdatabase - Database receiving the warningwarning - Warningprotected final boolean isEndingTransaction()
true if the transaction is committing, rolling back or preparingprotected final void checkTransactionActive()
throws java.sql.SQLException
java.sql.SQLException - When no transaction is set, or the transaction state is not TransactionState.ACTIVEprotected void checkDatabaseAttached()
throws java.sql.SQLException
java.sql.SQLException - When no database is set, or the database is not attachedprotected void checkBlobOpen()
throws java.sql.SQLException
java.sql.SQLException - When the blob is closed.protected void checkBlobClosed()
throws java.sql.SQLException
java.sql.SQLException - When the blob is open.protected FbTransaction getTransaction()
protected final void clearTransaction()
public FbDatabase getDatabase()
getDatabase in interface FbBlobpublic <T> T getBlobInfo(byte[] requestItems,
int bufferLength,
InfoProcessor<T> infoProcessor)
throws java.sql.SQLException
FbBlobgetBlobInfo in interface FbBlobrequestItems - Array of info items to requestbufferLength - Response buffer length to useinfoProcessor - Implementation of InfoProcessor to transform
the info responsejava.sql.SQLException - For errors retrieving or transforming the response.public long length()
throws java.sql.SQLException
FbBlobpublic final void addExceptionListener(ExceptionListener listener)
ExceptionListenable
Implementations use WeakReference.
addExceptionListener in interface ExceptionListenablelistener - Listener to registerpublic final void removeExceptionListener(ExceptionListener listener)
ExceptionListenableremoveExceptionListener in interface ExceptionListenablelistener - Listener to removeprotected final void clearDatabase()
protected BlobParameterBuffer getBlobParameterBuffer()
protected BlobLengthProcessor createBlobLengthProcessor()
BlobLengthProcessor (or subclass) for this blob.public int getMaximumSegmentSize()
FbBlobFbBlob.getSegment(int) and FbBlob.putSegment(byte[]).
This value is not the segment size (optionally) defined for the column.
getMaximumSegmentSize in interface FbBlobCopyright © 2001-2022 Jaybird (Firebird JDBC/JCA) team. All rights reserved.