java.io.Closeable, java.lang.AutoCloseable, java.lang.Readableclass ClobLocatorReader
extends java.io.Reader
Reader that will use an locator to fetch the
Clob value from the server.
This Reader implementation is pretty basic. No
buffering of data is done. Hence, for efficiency #read(char[])
should be used instead of #read(). Marks are not supported, but it
should be pretty simple to extend the implementation to support
this. A more efficient skip implementation should also be
straight-forward.
| Modifier and Type | Field | Description |
|---|---|---|
private ClientClob |
clob |
The Clob to be accessed.
|
private ClientConnection |
connection |
Connection used to read Clob from server.
|
private long |
currentPos |
Current position in the underlying Clob.
|
private boolean |
isClosed |
Stores the information to whether this Reader has been
closed or not.
|
private long |
maxPos |
Position in Clob where to stop reading.
|
| Constructor | Description |
|---|---|
ClobLocatorReader(ClientConnection connection,
ClientClob clob) |
Create an
Reader for reading the
Clob value represented by the given locator based
Clob object. |
ClobLocatorReader(ClientConnection connection,
ClientClob clob,
long pos,
long len) |
Create an
Reader for reading the
Clob value represented by the given locator based
Clob object. |
| Modifier and Type | Method | Description |
|---|---|---|
private void |
checkClosed() |
Check to see if this
Reader is closed. |
void |
close() |
|
int |
read() |
|
int |
read(char[] c,
int off,
int len) |
|
private char[] |
readCharacters(int len) |
Read the next
len characters of the Clob
value from the server. |
private final ClientConnection connection
private final ClientClob clob
private long currentPos
private final long maxPos
private boolean isClosed
ClobLocatorReader(ClientConnection connection, ClientClob clob) throws SqlException
Reader for reading the
Clob value represented by the given locator based
Clob object.connection - connection to be used to read the
Clob value from the serverclob - Clob object that contains locator for
the Clob value on the server.SqlExceptionClobLocatorReader(ClientConnection connection, ClientClob clob, long pos, long len) throws SqlException
Reader for reading the
Clob value represented by the given locator based
Clob object.connection - connection to be used to read the
Clob value from the serverclob - Clob object that contains locator for
the Clob value on the server.pos - The offset to the first character of the partial value to be
retrieved.len - The length in characters of the partial value to be retrieved.SqlExceptionpublic int read()
throws java.io.IOException
read in class java.io.Readerjava.io.IOExceptionThis method fetches one character at a time from the server. For more
efficient retrieval, use #read(char[]).public int read(char[] c,
int off,
int len)
throws java.io.IOException
read in class java.io.Readerjava.io.IOExceptionReader.read(char[], int, int)public void close()
throws java.io.IOException
close in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in class java.io.Readerjava.io.IOExceptionReader.close()private void checkClosed()
throws java.io.IOException
Reader is closed. If it
is closed throw an IOException that states that
the stream is closed.java.io.IOException - if isClosed = true.private char[] readCharacters(int len)
throws java.io.IOException
len characters of the Clob
value from the server.len - number of characters to read.char[] containing the read characters.java.io.IOException - Wrapped SqlException if reading
from server fails.Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.