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 ClientClob
private ClientConnection
private long
private long
private BufferedReader
private long
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Initializes the Reader, updateCount, currentPos and the connection to the appropriate values.protected
UpdateSensitiveClobLocatorReader
(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 TypeMethodDescriptionvoid
close()
private void
Verifies whether the current updateCount matches the updateCount of the Clob object and if it does not it recreates the stream.int
read()
int
read
(char[] c, int off, int len) private Reader
Re-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 theClob
value from the serverclob
- theClob
object 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 theClob
value from the serverclob
- theClob
object 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:
read
in classReader
- Throws:
IOException
- See Also:
-
read
- Specified by:
read
in classReader
- Throws:
IOException
- See Also:
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in 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
-