Package org.firebirdsql.gds.ng.wire
Class AbstractFbWireOutputBlob
- java.lang.Object
-
- org.firebirdsql.gds.ng.AbstractFbBlob
-
- org.firebirdsql.gds.ng.wire.AbstractFbWireBlob
-
- org.firebirdsql.gds.ng.wire.AbstractFbWireOutputBlob
-
- All Implemented Interfaces:
java.lang.AutoCloseable,FbBlob,DatabaseListener,ExceptionListenable,TransactionListener,FbWireBlob
- Direct Known Subclasses:
V10OutputBlob
public abstract class AbstractFbWireOutputBlob extends AbstractFbWireBlob
- Since:
- 3.0
- Author:
- Mark Rotteveel
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.firebirdsql.gds.ng.wire.AbstractFbWireBlob
AbstractFbWireBlob.BlobOpenOperation
-
Nested classes/interfaces inherited from class org.firebirdsql.gds.ng.AbstractFbBlob
AbstractFbBlob.BlobState
-
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 Modifier Constructor Description protectedAbstractFbWireOutputBlob(FbWireDatabase database, FbWireTransaction transaction, BlobParameterBuffer blobParameterBuffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intget(byte[] b, int off, int len, int minLen)Default implementation forAbstractFbBlob.get(byte[], int, int)andAbstractFbBlob.get(byte[], int, int, float).longgetBlobId()Returns the blob id.byte[]getSegment(int sizeRequested)Gets a segment of blob data.booleanisOutput()protected voidprocessOpenResponse(GenericResponse genericResponse)voidseek(int offset, FbBlob.SeekMode seekMode)Performs a seek on a blob with the specifiedseekModeandoffset.protected voidsetBlobId(long blobId)Sets the blob id.-
Methods inherited from class org.firebirdsql.gds.ng.wire.AbstractFbWireBlob
cancelImpl, closeImpl, getBlobInfo, getDatabase, getHandle, getXdrIn, getXdrOut, receiveOpenResponse, releaseBlob, releaseResources, sendOpen, setHandle, wrapDeferredResponse
-
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, 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.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.firebirdsql.gds.ng.listeners.ExceptionListenable
addExceptionListener, removeExceptionListener
-
Methods inherited from interface org.firebirdsql.gds.ng.FbBlob
cancel, close, get, get, getBlobInfo, getMaximumSegmentSize, isEof, isOpen, length, open, put, putSegment
-
-
-
-
Constructor Detail
-
AbstractFbWireOutputBlob
protected AbstractFbWireOutputBlob(FbWireDatabase database, FbWireTransaction transaction, BlobParameterBuffer blobParameterBuffer) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
-
Method Detail
-
getBlobId
public final long getBlobId()
Description copied from interface:FbBlobReturns the blob id.For output blobs, this will return
FbBlob.NO_BLOB_ID(0L) if the blob wasn't opened yet, or if the blob is deferred opened (client-side only). The valueFbBlob.NO_BLOB_IDis technically invalid, but Firebird will handle it as an empty blob (both for input and output).- Returns:
- The Firebird blob id
-
setBlobId
protected final void setBlobId(long blobId) throws java.sql.SQLExceptionSets the blob id.- Parameters:
blobId- Blob id.- Throws:
java.sql.SQLException- If this is an input blob, or if this is an output blob whose blobId was already set.
-
processOpenResponse
protected void processOpenResponse(GenericResponse genericResponse) throws java.sql.SQLException
- Overrides:
processOpenResponsein classAbstractFbWireBlob- Throws:
java.sql.SQLException
-
isOutput
public final boolean isOutput()
- Returns:
trueif this is an output blob (write only),falseif this is an input blob (read only)
-
getSegment
public final byte[] getSegment(int sizeRequested) throws java.sql.SQLExceptionDescription copied from interface:FbBlobGets a segment of blob data.When
sizeRequestedexceedsFbBlob.getMaximumSegmentSize()it is silently reduced to the maximum segment size.- 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.- See Also:
FbBlob.get(byte[], int, int)
-
get
protected final int get(byte[] b, int off, int len, int minLen) throws java.sql.SQLExceptionDescription copied from class:AbstractFbBlobDefault implementation forAbstractFbBlob.get(byte[], int, int)andAbstractFbBlob.get(byte[], int, int, float).- Specified by:
getin classAbstractFbBlob- Parameters:
b- target byte arrayoff- offset to startlen- number of bytesminLen- minimum number of bytes to fill (must be0 < minLen <= leniflen != 0- Returns:
- actual number of bytes read; is
0iflen == 0, will only be less thanminLenif end-of-blob is reached - Throws:
java.sql.SQLException- for database access errors, ifoff < 0,len < 0, or ifoff + len > b.length, orlen != 0 && (minLen <= 0 || minLen > len)
-
seek
public final void seek(int offset, FbBlob.SeekMode seekMode) throws java.sql.SQLExceptionDescription copied from interface:FbBlobPerforms a seek on a blob with the specifiedseekModeandoffset.Firebird only supports seek on stream blobs.
- Parameters:
offset- Offset of the seek, effect depends on value ofseekModeseekMode- Value ofFbBlob.SeekMode- Throws:
java.sql.SQLException- If the blob is closed, the transaction is not active, or a database error occurred.
-
-