Package org.apache.derby.client.am
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 ClientConnection
protected long
private BufferedInputStream
protected long
private Lob
private long
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
UpdateSensitiveLOBLocatorInputStream
(ClientConnection con, Lob lob, InputStream is) Initializes the InputStream, updateCount, currentPos and the connection to the appropriate values.protected
UpdateSensitiveLOBLocatorInputStream
(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 TypeMethodDescriptionvoid
close()
private void
Verifies whether the current updateCount matches the updateCount of the LOB object and if it does not it recreates the stream.int
read()
int
read
(byte[] b, int off, int len) protected abstract InputStream
Abstract method that will be implemented by the underlying streams specific to Clob and Blob.Methods inherited from class java.io.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 theLob
value from the serverlob
-Lob
object which could be aBlob
or aClob
.is
- anInputStream
that 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 theLob
value from the serverlob
-Lob
object which could be aBlob
or aClob
.is
- anInputStream
that 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:
read
in classInputStream
- Throws:
IOException
- See Also:
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
- See Also:
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in 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
-