Package org.apache.derby.client.am
Class UpdateSensitiveClobLocatorReader
java.lang.Object
java.io.Reader
org.apache.derby.client.am.UpdateSensitiveClobLocatorReader
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable
Wraps a Buffered Clob locator reader and watches out
for updates on the Clob associated with it.
Before a read operation is performed on the Reader
this stream verifies that the underlying Clob has not
changed and if it has it recreates the specific streams.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ClientClobprivate ClientConnectionprivate longprivate longprivate BufferedReaderprivate long -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInitializes the Reader, updateCount, currentPos and the connection to the appropriate values.protectedUpdateSensitiveClobLocatorReader(ClientConnection con, ClientClob clob, long pos, long len) Initializes the Reader, 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 Clob object and if it does not it recreates the stream.intread()intread(char[] c, int off, int len) private ReaderRe-creates the underlying Locator stream with the current position and the length values if specified.Methods inherited from class java.io.Reader
mark, markSupported, nullReader, read, read, ready, reset, skip, transferTo
-
Field Details
-
r
-
con
-
clob
-
updateCount
private long updateCount -
currentPos
private long currentPos -
length
private long length
-
-
Constructor Details
-
UpdateSensitiveClobLocatorReader
protected UpdateSensitiveClobLocatorReader(ClientConnection con, ClientClob clob) throws SqlException Initializes the Reader, updateCount, currentPos and the connection to the appropriate values.- Parameters:
con- connection to be used to read theClobvalue from the serverclob- theClobobject associated with this stream.- Throws:
SqlException
-
UpdateSensitiveClobLocatorReader
protected UpdateSensitiveClobLocatorReader(ClientConnection con, ClientClob clob, long pos, long len) throws SqlException Initializes the Reader, updateCount, currentPos, length and the connection to the appropriate values.- Parameters:
con- connection to be used to read theClobvalue from the serverclob- theClobobject associated with this reader.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
- Overrides:
readin classReader- Throws:
IOException- See Also:
-
read
- Specified by:
readin classReader- Throws:
IOException- See Also:
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classReader- Throws:
IOException- See Also:
-
identifyAndReplaceObseleteStream
Verifies whether the current updateCount matches the updateCount of the Clob object and if it does not it recreates the stream.- Throws:
IOException- If any exception occurs upon Locator stream creation.
-
reCreateStream
Re-creates the underlying Locator stream with the current position and the length values if specified.- Throws:
SqlException
-