Package org.apache.derby.client.am
Class ClobLocatorWriter
java.lang.Object
java.io.Writer
org.apache.derby.client.am.ClobLocatorWriter
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
An
Writer
that will use an locator to write the
Clob value into the server.
This Writer
implementation is pretty basic. No
buffering of data is done. Hence, for efficiency #write(char[])
should be used instead of #write(int)
.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ClientClob
The Clob to be accessed.private final ClientConnection
Connection used to read Clob from server.private long
Current position in the underlying Clob.private boolean
Stores the information to whether this Writer has been closed or not. -
Constructor Summary
ConstructorsConstructorDescriptionClobLocatorWriter
(ClientConnection connection, ClientClob clob, long pos) Create aWriter
for writing to theClob
value represented by the given locator basedClob
object. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Check to see if thisWriter
is closed.void
close()
void
flush()
void
write
(char[] c) void
write
(char[] c, int off, int len) void
write
(int c) private void
writeCharacters
(char[] c, int off, int len) Write thechar[]
to theClob
value on the server; starting from the current position of this stream.
-
Field Details
-
connection
Connection used to read Clob from server. -
clob
The Clob to be accessed. -
currentPos
private long currentPosCurrent position in the underlying Clob. Clobs are indexed from 1 -
isClosed
private boolean isClosedStores the information to whether this Writer has been closed or not. Is set to true if close() has been called. Is false otherwise.
-
-
Constructor Details
-
ClobLocatorWriter
ClobLocatorWriter(ClientConnection connection, ClientClob clob, long pos) throws SqlException Create aWriter
for writing to theClob
value represented by the given locator basedClob
object.- Parameters:
connection
- connection to be used to write to theClob
value on the serverclob
-Clob
object that contains locator for theClob
value on the server.pos
- the position in theCLOB
value at which to start writing; the first position is 1- Throws:
SqlException
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classWriter
- Throws:
IOException
- See Also:
-
checkClosed
Check to see if thisWriter
is closed. If it is closed throw anIOException
that states that the stream is closed.- Throws:
IOException
- if isClosed = true.
-
write
- Overrides:
write
in classWriter
- Throws:
IOException
- See Also:
-
write
- Overrides:
write
in classWriter
- Throws:
IOException
- See Also:
-
flush
public void flush() -
write
- Specified by:
write
in classWriter
- Throws:
IOException
- See Also:
-
writeCharacters
Write thechar[]
to theClob
value on the server; starting from the current position of this stream.- Parameters:
c
- The character array containing the chars to be written- Throws:
IOException
- Wrapped SqlException if writing to server fails.
-