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:
AutoCloseable
,FbBlob
,DatabaseListener
,ExceptionListenable
,TransactionListener
,FbWireBlob
- 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 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
ConstructorsConstructorDescriptionV10InputBlob
(FbWireDatabase database, FbWireTransaction transaction, BlobParameterBuffer blobParameterBuffer, long blobId) -
Method Summary
Modifier and TypeMethodDescriptionprotected int
get
(byte[] b, int off, int len, int minLen) Default implementation forAbstractFbBlob.get(byte[], int, int)
andAbstractFbBlob.get(byte[], int, int, float)
.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 specifiedseekMode
andoffset
.protected void
sendGetSegment
(int len) Sends theop_get_segment
request forlen
, without flushing.Methods inherited from class org.firebirdsql.gds.ng.wire.AbstractFbWireInputBlob
getBlobId, isOutput, put, putSegment
Methods inherited from class org.firebirdsql.gds.ng.wire.AbstractFbWireBlob
cancelImpl, closeImpl, getBlobInfo, getDatabase, getHandle, getXdrIn, getXdrOut, releaseBlob, releaseResources, sendOpen, setHandle
Methods inherited from class org.firebirdsql.gds.ng.AbstractFbBlob
addExceptionListener, cancel, checkBlobClosed, checkBlobOpen, checkDatabaseAttached, checkTransactionActive, clearDatabase, clearTransaction, close, createBlobLengthProcessor, detached, detaching, get, get, getBlobInfo, getBlobParameterBuffer, getMaximumSegmentSize, getTransaction, isEndingTransaction, isEof, isOpen, length, removeExceptionListener, resetEof, setEof, setOpen, transactionStateChanged, validateBufferLength, 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.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, get, get, getBlobId, getBlobInfo, getBlobInfo, getDatabase, getHandle, getMaximumSegmentSize, isEof, isOpen, isOutput, length, put, putSegment
-
Constructor Details
-
V10InputBlob
public V10InputBlob(FbWireDatabase database, FbWireTransaction transaction, BlobParameterBuffer blobParameterBuffer, long blobId)
-
-
Method Details
-
open
Description copied from interface:FbBlob
Opens an existing input blob, or creates an output blob.- Specified by:
open
in interfaceFbBlob
- Throws:
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
Description copied from interface:FbBlob
Gets a segment of blob data.When
sizeRequested
exceedsFbBlob.getMaximumSegmentSize()
it is silently reduced to the maximum segment size.- Specified by:
getSegment
in interfaceFbBlob
- Parameters:
sizeRequested
- Requested segment size (> 0).- Returns:
- Retrieved segment (size may be less than requested)
- Throws:
SQLException
- If this is an output blob, the blob is closed, the transaction is not active, or a database connection error occurred.- See Also:
-
sendGetSegment
Sends theop_get_segment
request forlen
, without flushing.- Parameters:
len
- requested length (should not exceedAbstractFbBlob.getMaximumSegmentSize()
, but this is not enforced)- Throws:
SQLException
- for errors obtaining the XDR output streamIOException
- for errors writing data to the output stream
-
get
Description copied from class:AbstractFbBlob
Default implementation forAbstractFbBlob.get(byte[], int, int)
andAbstractFbBlob.get(byte[], int, int, float)
.- Specified by:
get
in classAbstractFbBlob
- Parameters:
b
- target byte arrayoff
- offset to startlen
- number of bytesminLen
- minimum number of bytes to fill (must be0 < minLen <= len
iflen != 0
- Returns:
- actual number of bytes read; is
0
iflen == 0
, will only be less thanminLen
if end-of-blob is reached - Throws:
SQLException
- for database access errors, ifoff < 0
,len < 0
, or ifoff + len > b.length
, orlen != 0 && (minLen <= 0 || minLen > len)
-
seek
Description copied from interface:FbBlob
Performs a seek on a blob with the specifiedseekMode
andoffset
.Firebird only supports seek on stream blobs.
- Specified by:
seek
in interfaceFbBlob
- Parameters:
offset
- Offset of the seek, effect depends on value ofseekMode
seekMode
- Value ofFbBlob.SeekMode
- Throws:
SQLException
- If the blob is closed, the transaction is not active, or a database error occurred.
-