java.lang.Object
org.firebirdsql.gds.ng.AbstractFbBlob
org.firebirdsql.gds.ng.wire.AbstractFbWireBlob
- All Implemented Interfaces:
AutoCloseable,FbBlob,DatabaseListener,ExceptionListenable,TransactionListener,FbWireBlob
- Direct Known Subclasses:
AbstractFbWireInputBlob,AbstractFbWireOutputBlob
- Since:
- 3.0
- Author:
- Mark Rotteveel
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumOperation codes to open an input or output blob.Nested classes/interfaces inherited from class org.firebirdsql.gds.ng.AbstractFbBlob
AbstractFbBlob.BlobStateNested classes/interfaces inherited from interface org.firebirdsql.gds.ng.FbBlob
FbBlob.SeekMode -
Field Summary
Fields inherited from class org.firebirdsql.gds.ng.AbstractFbBlob
exceptionListenerDispatcherFields inherited from interface org.firebirdsql.gds.ng.FbBlob
NO_BLOB_ID -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractFbWireBlob(FbWireDatabase database, FbWireTransaction transaction, BlobParameterBuffer blobParameterBuffer) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidInternal implementation ofAbstractFbBlob.cancel().protected voidInternal implementation ofAbstractFbBlob.close().byte[]getBlobInfo(byte[] requestItems, int bufferLength) Request blob info.final intReturns the blob handle identifier.protected final XdrInputStreamgetXdrIn()Gets the XdrInputStream.protected final XdrOutputStreamGets the XdrOutputStream.protected voidprocessOpenResponse(GenericResponse genericResponse) protected final voidprotected voidreleaseBlob(int releaseOperation) Release this blob with the specified operation.protected voidRelease Java resources held.protected final voidsendOpen(AbstractFbWireBlob.BlobOpenOperation openOperation, boolean flush) protected final voidsetHandle(int blobHandle) protected final <T> DeferredActionwrapDeferredResponse(DeferredResponse<T> deferredResponse, Function<Response, T> responseMapper) Wraps a deferred response to produce a deferred action that can be added usingFbWireDatabase.enqueueDeferredAction(DeferredAction), notifying the exception listener of this blob for exceptions.Methods inherited from class org.firebirdsql.gds.ng.AbstractFbBlob
addExceptionListener, cancel, checkBlobClosed, checkBlobOpen, checkDatabaseAttached, checkTransactionActive, clearDatabase, clearDeferredException, clearTransaction, close, createBlobLengthProcessor, detached, detaching, errorOccurred, get, get, get, getBlobInfo, getBlobParameterBuffer, getKnownBlobInfoItems, getMaximumSegmentSize, getState, getTransaction, isEndingTransaction, isEof, isOpen, length, putSegment, registerDeferredException, removeExceptionListener, resetEof, setEof, setState, throwAndClearDeferredException, transactionStateChanged, transferDeferredExceptionTo, validateBufferLength, warningReceived, withLockMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.firebirdsql.gds.ng.listeners.ExceptionListenable
addExceptionListener, removeExceptionListenerMethods inherited from interface org.firebirdsql.gds.ng.FbBlob
cancel, close, get, get, getBlobId, getBlobInfo, getMaximumSegmentSize, getSegment, isEof, isOpen, isOutput, length, open, put, putSegment, seek
-
Constructor Details
-
AbstractFbWireBlob
protected AbstractFbWireBlob(FbWireDatabase database, FbWireTransaction transaction, BlobParameterBuffer blobParameterBuffer) throws SQLException - Throws:
SQLException
-
-
Method Details
-
getDatabase
- Specified by:
getDatabasein interfaceFbBlob- Overrides:
getDatabasein classAbstractFbBlob- Returns:
- The database connection that created this blob
-
getHandle
public final int getHandle()Description copied from interface:FbBlobReturns the blob handle identifier.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). -
setHandle
protected final void setHandle(int blobHandle) - Parameters:
blobHandle- The Firebird blob handle identifier
-
releaseBlob
Release this blob with the specified operation.Implementations should only do the operation and not perform any further clean up or checks on attached database and active transaction, as those checks and clean up should be done by the caller.
If the blob state is
AbstractFbBlob.BlobState.DELAYED_OPEN, this method is effectively a no-op.- Parameters:
releaseOperation- EitherWireProtocolConstants.op_close_bloborWireProtocolConstants.op_cancel_blob- Throws:
SQLException- For database communication errors.
-
sendOpen
protected final void sendOpen(AbstractFbWireBlob.BlobOpenOperation openOperation, boolean flush) throws SQLException - Throws:
SQLException
-
receiveOpenResponse
- Throws:
SQLException
-
processOpenResponse
- Throws:
SQLException
-
closeImpl
Description copied from class:AbstractFbBlobInternal implementation ofAbstractFbBlob.close(). The implementation does not need to check for attached database and active transaction, nor does it need to mark this blob as closed.- Specified by:
closeImplin classAbstractFbBlob- Throws:
SQLException
-
cancelImpl
Description copied from class:AbstractFbBlobInternal implementation ofAbstractFbBlob.cancel(). The implementation does not need to check for attached database and active transaction, nor does it need to mark this blob as closed.- Specified by:
cancelImplin classAbstractFbBlob- Throws:
SQLException
-
releaseResources
protected void releaseResources()Description copied from class:AbstractFbBlobRelease Java resources held. This should not communicate with the Firebird server.- Specified by:
releaseResourcesin classAbstractFbBlob
-
getBlobInfo
Description copied from interface:FbBlobRequest blob info.- Specified by:
getBlobInfoin interfaceFbBlob- Parameters:
requestItems- Array of info items to requestbufferLength- Response buffer length to use- Returns:
- Response buffer
- Throws:
SQLException
-
getXdrIn
Gets the XdrInputStream.- Returns:
- instance of XdrInputStream
- Throws:
SQLException- if no connection is opened or when exceptions occur retrieving the InputStream- Since:
- 6
-
getXdrOut
Gets the XdrOutputStream.- Returns:
- instance of XdrOutputStream
- Throws:
SQLException- if no connection is opened or when exceptions occur retrieving the OutputStream- Since:
- 6
-
wrapDeferredResponse
protected final <T> DeferredAction wrapDeferredResponse(DeferredResponse<T> deferredResponse, Function<Response, T> responseMapper) Wraps a deferred response to produce a deferred action that can be added usingFbWireDatabase.enqueueDeferredAction(DeferredAction), notifying the exception listener of this blob for exceptions.This should only be used with protocol versions that support deferred responses. Its placement in the hierarchy is due to support for both input and output blobs.
- Type Parameters:
T- type of deferred response- Parameters:
deferredResponse- deferred response to wrapresponseMapper- Function to map aResponseto the object expected by the deferred response- Returns:
- deferred action
- Since:
- 5.0.7
-