public class 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 efficieny #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 and Description |
|---|---|
private Clob |
clob
The Clob to be accessed.
|
private Connection |
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 and Description |
|---|
ClobLocatorReader(Connection connection,
Clob clob)
Create an
Reader for reading the
Clob value represented by the given locator based
Clob object. |
ClobLocatorReader(Connection connection,
Clob 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 and 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 Connection connection
private final Clob clob
private long currentPos
private final long maxPos
private boolean isClosed
public ClobLocatorReader(Connection connection, Clob 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.SqlExceptionpublic ClobLocatorReader(Connection connection, Clob 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.io.Closeableclose in interface java.lang.AutoCloseableclose 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.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.