Class AbstractFbWireBlob

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

public abstract class AbstractFbWireBlob extends AbstractFbBlob implements FbWireBlob
Since:
3.0
Author:
Mark Rotteveel
  • Constructor Details

  • Method Details

    • getDatabase

      public FbWireDatabase getDatabase()
      Specified by:
      getDatabase in interface FbBlob
      Overrides:
      getDatabase in class AbstractFbBlob
      Returns:
      The database connection that created this blob
    • getHandle

      public final int getHandle()
      Description copied from interface: FbBlob
      Returns 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).

      Specified by:
      getHandle in interface FbBlob
      Returns:
      The Firebird blob handle identifier
    • setHandle

      protected final void setHandle(int blobHandle)
      Parameters:
      blobHandle - The Firebird blob handle identifier
    • releaseBlob

      protected void releaseBlob(int releaseOperation) throws SQLException
      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 - Either WireProtocolConstants.op_close_blob or WireProtocolConstants.op_cancel_blob
      Throws:
      SQLException - For database communication errors.
    • sendOpen

      protected final void sendOpen(AbstractFbWireBlob.BlobOpenOperation openOperation, boolean flush) throws SQLException
      Throws:
      SQLException
    • receiveOpenResponse

      protected final void receiveOpenResponse() throws SQLException
      Throws:
      SQLException
    • processOpenResponse

      protected void processOpenResponse(GenericResponse genericResponse) throws SQLException
      Throws:
      SQLException
    • closeImpl

      protected void closeImpl() throws SQLException
      Description copied from class: AbstractFbBlob
      Internal implementation of 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.
      Specified by:
      closeImpl in class AbstractFbBlob
      Throws:
      SQLException
    • cancelImpl

      protected void cancelImpl() throws SQLException
      Description copied from class: AbstractFbBlob
      Internal implementation of 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.
      Specified by:
      cancelImpl in class AbstractFbBlob
      Throws:
      SQLException
    • releaseResources

      protected void releaseResources()
      Description copied from class: AbstractFbBlob
      Release Java resources held. This should not communicate with the Firebird server.
      Specified by:
      releaseResources in class AbstractFbBlob
    • getBlobInfo

      public byte[] getBlobInfo(byte[] requestItems, int bufferLength) throws SQLException
      Description copied from interface: FbBlob
      Request blob info.
      Specified by:
      getBlobInfo in interface FbBlob
      Parameters:
      requestItems - Array of info items to request
      bufferLength - Response buffer length to use
      Returns:
      Response buffer
      Throws:
      SQLException
    • getXdrIn

      protected final XdrInputStream getXdrIn() throws SQLException
      Gets the XdrInputStream.
      Returns:
      instance of XdrInputStream
      Throws:
      SQLException - if no connection is opened or when exceptions occur retrieving the InputStream
      Since:
      6
    • getXdrOut

      protected final XdrOutputStream getXdrOut() throws SQLException
      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 using FbWireDatabase.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 Response to the object expected by the deferred response
      Returns:
      deferred action
      Since:
      5.0.7