Package org.firebirdsql.gds.ng.wire
Class AbstractFbWireBlob
- java.lang.Object
- 
- org.firebirdsql.gds.ng.AbstractFbBlob
- 
- org.firebirdsql.gds.ng.wire.AbstractFbWireBlob
 
 
- 
- All Implemented Interfaces:
- java.lang.AutoCloseable,- FbBlob,- DatabaseListener,- ExceptionListenable,- TransactionListener,- FbWireBlob
 - Direct Known Subclasses:
- AbstractFbWireInputBlob,- AbstractFbWireOutputBlob
 
 public abstract class AbstractFbWireBlob extends AbstractFbBlob implements FbWireBlob - Since:
- 3.0
- Author:
- Mark Rotteveel
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected static classAbstractFbWireBlob.BlobOpenOperationOperation codes to open an input or output blob.- 
Nested classes/interfaces inherited from class org.firebirdsql.gds.ng.AbstractFbBlobAbstractFbBlob.BlobState
 - 
Nested classes/interfaces inherited from interface org.firebirdsql.gds.ng.FbBlobFbBlob.SeekMode
 
- 
 - 
Field Summary- 
Fields inherited from class org.firebirdsql.gds.ng.AbstractFbBlobexceptionListenerDispatcher
 - 
Fields inherited from interface org.firebirdsql.gds.ng.FbBlobNO_BLOB_ID
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractFbWireBlob(FbWireDatabase database, FbWireTransaction transaction, BlobParameterBuffer blobParameterBuffer)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcancelImpl()Internal implementation ofAbstractFbBlob.cancel().protected voidcloseImpl()Internal implementation ofAbstractFbBlob.close().byte[]getBlobInfo(byte[] requestItems, int bufferLength)Request blob info.FbWireDatabasegetDatabase()intgetHandle()Returns the blob handle identifier.protected XdrInputStreamgetXdrIn()Gets the XdrInputStream.protected XdrOutputStreamgetXdrOut()Gets the XdrOutputStream.protected voidprocessOpenResponse(GenericResponse genericResponse)protected voidreceiveOpenResponse()protected voidreleaseBlob(int releaseOperation)Release this blob with the specified operation.protected voidreleaseResources()Release Java resources held.protected voidsendOpen(AbstractFbWireBlob.BlobOpenOperation openOperation, boolean flush)protected voidsetHandle(int blobHandle)protected <T> DeferredActionwrapDeferredResponse(DeferredResponse<T> deferredResponse, java.util.function.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.AbstractFbBlobaddExceptionListener, 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, warningReceived, withLock
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.firebirdsql.gds.ng.listeners.ExceptionListenableaddExceptionListener, removeExceptionListener
 - 
Methods inherited from interface org.firebirdsql.gds.ng.FbBlobcancel, close, get, get, getBlobId, getBlobInfo, getMaximumSegmentSize, getSegment, isEof, isOpen, isOutput, length, open, put, putSegment, seek
 
- 
 
- 
- 
- 
Constructor Detail- 
AbstractFbWireBlobprotected AbstractFbWireBlob(FbWireDatabase database, FbWireTransaction transaction, BlobParameterBuffer blobParameterBuffer) throws java.sql.SQLException - Throws:
- java.sql.SQLException
 
 
- 
 - 
Method Detail- 
getDatabasepublic FbWireDatabase getDatabase() - Specified by:
- getDatabasein interface- FbBlob
- Overrides:
- getDatabasein class- AbstractFbBlob
- Returns:
- The database connection that created this blob
 
 - 
getHandlepublic 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).
 - 
setHandleprotected final void setHandle(int blobHandle) - Parameters:
- blobHandle- The Firebird blob handle identifier
 
 - 
releaseBlobprotected void releaseBlob(int releaseOperation) throws java.sql.SQLExceptionRelease 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- Either- WireProtocolConstants.op_close_blobor- WireProtocolConstants.op_cancel_blob
- Throws:
- java.sql.SQLException- For database communication errors.
 
 - 
sendOpenprotected final void sendOpen(AbstractFbWireBlob.BlobOpenOperation openOperation, boolean flush) throws java.sql.SQLException - Throws:
- java.sql.SQLException
 
 - 
receiveOpenResponseprotected final void receiveOpenResponse() throws java.sql.SQLException- Throws:
- java.sql.SQLException
 
 - 
processOpenResponseprotected void processOpenResponse(GenericResponse genericResponse) throws java.sql.SQLException - Throws:
- java.sql.SQLException
 
 - 
closeImplprotected void closeImpl() throws java.sql.SQLExceptionDescription 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 class- AbstractFbBlob
- Throws:
- java.sql.SQLException
 
 - 
cancelImplprotected void cancelImpl() throws java.sql.SQLExceptionDescription 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 class- AbstractFbBlob
- Throws:
- java.sql.SQLException
 
 - 
releaseResourcesprotected void releaseResources() Description copied from class:AbstractFbBlobRelease Java resources held. This should not communicate with the Firebird server.- Specified by:
- releaseResourcesin class- AbstractFbBlob
 
 - 
getBlobInfopublic byte[] getBlobInfo(byte[] requestItems, int bufferLength) throws java.sql.SQLExceptionDescription copied from interface:FbBlobRequest blob info.- Specified by:
- getBlobInfoin interface- FbBlob
- Parameters:
- requestItems- Array of info items to request
- bufferLength- Response buffer length to use
- Returns:
- Response buffer
- Throws:
- java.sql.SQLException
 
 - 
getXdrInprotected final XdrInputStream getXdrIn() throws java.sql.SQLException Gets the XdrInputStream.- Returns:
- instance of XdrInputStream
- Throws:
- java.sql.SQLException- if no connection is opened or when exceptions occur retrieving the InputStream
- Since:
- 5.0.7
 
 - 
getXdrOutprotected final XdrOutputStream getXdrOut() throws java.sql.SQLException Gets the XdrOutputStream.- Returns:
- instance of XdrOutputStream
- Throws:
- java.sql.SQLException- if no connection is opened or when exceptions occur retrieving the OutputStream
- Since:
- 5.0.7
 
 - 
wrapDeferredResponseprotected final <T> DeferredAction wrapDeferredResponse(DeferredResponse<T> deferredResponse, java.util.function.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 wrap
- responseMapper- Function to map a- Responseto the object expected by the deferred response
- Returns:
- deferred action
- Since:
- 5.0.7
 
 
- 
 
-