Package org.firebirdsql.gds.ng.wire.version10

## Class V10InputBlob

- java.lang.Object
- - org.firebirdsql.gds.ng.AbstractFbBlob
  - - org.firebirdsql.gds.ng.wire.AbstractFbWireBlob
    - - org.firebirdsql.gds.ng.wire.AbstractFbWireInputBlob
      - - org.firebirdsql.gds.ng.wire.version10.V10InputBlob

- All Implemented Interfaces:
    `java.lang.AutoCloseable`, `FbBlob`, `DatabaseListener`, `ExceptionListenable`, `TransactionListener`, `FbWireBlob`

      public class V10InputBlob
      extends AbstractFbWireInputBlob
      implements FbWireBlob, DatabaseListener

  Since:
    3.0
  Author:
    Mark Rotteveel

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.firebirdsql.gds.ng.FbBlob

      `FbBlob.SeekMode`

  - ### Field Summary

    - ### Fields inherited from class org.firebirdsql.gds.ng.AbstractFbBlob

      `exceptionListenerDispatcher`

    - ### Fields inherited from interface org.firebirdsql.gds.ng.FbBlob

      `NO_BLOB_ID`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `V10InputBlob​(FbWireDatabase database, FbWireTransaction transaction, BlobParameterBuffer blobParameterBuffer, long blobId)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `byte[]` | `getSegment​(int sizeRequested)` | Gets a segment of blob data.
    `void` | `open()` | Opens an existing input blob, or creates an output blob.
    `void` | `seek​(int offset, FbBlob.SeekMode seekMode)` | Performs a seek on a blob with the specified `seekMode` and `offset`.

    - ### Methods inherited from class org.firebirdsql.gds.ng.wire.AbstractFbWireInputBlob

      `getBlobId, isOutput, putSegment`

    - ### Methods inherited from class org.firebirdsql.gds.ng.wire.AbstractFbWireBlob

      `cancelImpl, closeImpl, getBlobInfo, getDatabase, getHandle, releaseBlob, releaseResources, setHandle`

    - ### Methods inherited from class org.firebirdsql.gds.ng.AbstractFbBlob

      `addExceptionListener, cancel, checkBlobClosed, checkBlobOpen, checkDatabaseAttached, checkTransactionActive, clearDatabase, clearTransaction, close, createBlobLengthProcessor, detached, detaching, getBlobInfo, getBlobParameterBuffer, getMaximumSegmentSize, getSynchronizationObject, getTransaction, isEndingTransaction, isEof, isOpen, length, removeExceptionListener, resetEof, setEof, setOpen, transactionStateChanged, warningReceived`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.firebirdsql.gds.ng.listeners.DatabaseListener

      `detached, detaching, warningReceived`

    - ### Methods inherited from interface org.firebirdsql.gds.ng.listeners.ExceptionListenable

      `addExceptionListener, removeExceptionListener`

    - ### Methods inherited from interface org.firebirdsql.gds.ng.FbBlob

      `cancel, close, getBlobId, getBlobInfo, getBlobInfo, getDatabase, getHandle, getMaximumSegmentSize, getSynchronizationObject, isEof, isOpen, isOutput, length, putSegment`

- - ### Constructor Detail

    - #### V10InputBlob

          public V10InputBlob​(FbWireDatabase database,
                              FbWireTransaction transaction,
                              BlobParameterBuffer blobParameterBuffer,
                              long blobId)

  - ### Method Detail

    - #### open

          public void open()
                    throws java.sql.SQLException

      Description copied from interface: `FbBlob`
      Opens an existing input blob, or creates an output blob.
      Specified by:
        `open` in interface `FbBlob`
      Throws:
        `java.sql.SQLException` - If the blob is already open, this is a (closed) output blob and it already has a blobId, the transaction is not active, or a database connection error occurred

    - #### getSegment

          public byte[] getSegment​(int sizeRequested)
                            throws java.sql.SQLException

      Description copied from interface: `FbBlob`
      Gets a segment of blob data.

      When `sizeRequested` exceeds `FbBlob.getMaximumSegmentSize()` it is silently reduced to the maximum segment size.

      TODO: Consider allowing this and have the implementation handle longer segments by sending multiple (batched?) requests.
      Specified by:
        `getSegment` in interface `FbBlob`
      Parameters:
        `sizeRequested` - Requested segment size (> 0).
      Returns:
        Retrieved segment (size may be less than requested)
      Throws:
        `java.sql.SQLException` - If this is an output blob, the blob is closed, the transaction is not active, or a database connection error occurred.

    - #### seek

          public void seek​(int offset,
                           FbBlob.SeekMode seekMode)
                    throws java.sql.SQLException

      Description copied from interface: `FbBlob`
      Performs a seek on a blob with the specified `seekMode` and `offset`.

      Firebird only supports seek on stream blobs.

      Specified by:
        `seek` in interface `FbBlob`
      Parameters:
        `offset` - Offset of the seek, effect depends on value of `seekMode`
        `seekMode` - Value of `FbBlob.SeekMode`
      Throws:
        `java.sql.SQLException` - If the blob is closed, the transaction is not active, or a database error occurred.