Class UpdateSensitiveLOBLocatorInputStream
java.lang.Object
java.io.InputStream
org.apache.derby.client.am.UpdateSensitiveLOBLocatorInputStream
- All Implemented Interfaces:
Closeable, AutoCloseable
- Direct Known Subclasses:
UpdateSensitiveBlobLocatorInputStream, UpdateSensitiveClobLocatorInputStream
Super-class of the Update sensitive locator streams.
Before a read operation if performed on the stream
this stream verifies that the underlying LOB has not
changed and if it has it recreates the specific streams.
Since Locator streams are specific to Blob and Clob the
sub-classes would take care of creating the appropriate
streams.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ClientConnectionprotected longprivate BufferedInputStreamprotected longprivate Lobprivate long -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedUpdateSensitiveLOBLocatorInputStream(ClientConnection con, Lob lob, InputStream is) Initializes the InputStream, updateCount, currentPos and the connection to the appropriate values.protectedUpdateSensitiveLOBLocatorInputStream(ClientConnection con, Lob lob, InputStream is, long pos, long len) Initializes the InputStream, updateCount, currentPos, length and the connection to the appropriate values. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()private voidVerifies whether the current updateCount matches the updateCount of the LOB object and if it does not it recreates the stream.intread()intread(byte[] b, int off, int len) protected abstract InputStreamAbstract method that will be implemented by the underlying streams specific to Clob and Blob.Methods inherited from class InputStream
available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Field Details
-
is
-
con
-
lob
-
updateCount
private long updateCount -
currentPos
protected long currentPos -
length
protected long length
-
-
Constructor Details
-
UpdateSensitiveLOBLocatorInputStream
protected UpdateSensitiveLOBLocatorInputStream(ClientConnection con, Lob lob, InputStream is) throws SqlException Initializes the InputStream, updateCount, currentPos and the connection to the appropriate values.- Parameters:
con- connection to be used to read theLobvalue from the serverlob-Lobobject which could be aBlobor aClob.is- anInputStreamthat contains the appropriate locator stream instance.- Throws:
SqlException
-
UpdateSensitiveLOBLocatorInputStream
protected UpdateSensitiveLOBLocatorInputStream(ClientConnection con, Lob lob, InputStream is, long pos, long len) throws SqlException Initializes the InputStream, updateCount, currentPos, length and the connection to the appropriate values.- Parameters:
con- connection to be used to read theLobvalue from the serverlob-Lobobject which could be aBlobor aClob.is- anInputStreamthat contains the appropriate locator stream instance.pos- the position from which the first read begins.len- the length in bytes of the partial value to be retrieved.- Throws:
SqlException
-
-
Method Details
-
read
- Specified by:
readin classInputStream- Throws:
IOException- See Also:
-
read
- Overrides:
readin classInputStream- Throws:
IOException- See Also:
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
identifyAndReplaceObseleteStream
Verifies whether the current updateCount matches the updateCount of the LOB object and if it does not it recreates the stream.- Throws:
IOException- If any exception occurs upon Locator stream creation.
-
reCreateStream
Abstract method that will be implemented by the underlying streams specific to Clob and Blob.- Throws:
SqlException
-