Class ClobLocatorOutputStream
java.lang.Object
java.io.OutputStream
org.apache.derby.client.am.ClobLocatorOutputStream
- All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
An
OutputStream that will use an locator to write
bytes to the Clob value on the server.
Closing a ByteArrayInputStream has no effect. The methods in
this class can be called after the stream has been closed without
generating an IOException.
This OutputStream implementation is pretty basic. No
buffering of data is done. Hence, for efficiency #write(byte[])
should be used instead of #write(int).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ClientClobThe Clob to be accessed.private longCurrent position in the underlying Clob. -
Constructor Summary
ConstructorsConstructorDescriptionClobLocatorOutputStream(ClientClob clob, long pos) Create anOutputStreamfor writing to theClobvalue represented by the given locator basedClobobject. -
Method Summary
Modifier and TypeMethodDescriptionvoidflush()voidwrite(byte[] b) voidwrite(byte[] b, int off, int len) voidwrite(int b) private voidwriteBytes(byte[] b) Write thebyte[]to theClobvalue on the server; starting from the current position of this stream.Methods inherited from class OutputStream
close, nullOutputStream
-
Field Details
-
clob
The Clob to be accessed. -
currentPos
private long currentPosCurrent position in the underlying Clob. Clobs are indexed from 1
-
-
Constructor Details
-
ClobLocatorOutputStream
ClobLocatorOutputStream(ClientClob clob, long pos) throws SqlException Create anOutputStreamfor writing to theClobvalue represented by the given locator basedClobobject.- Parameters:
clob-Clobobject that contains locator for theClobvalue on the server.pos- the position in theCLOBvalue at which to start writing; the first position is 1- Throws:
SqlException
-
-
Method Details
-
write
- Specified by:
writein classOutputStream- Throws:
IOException- See Also:
-
write
- Overrides:
writein classOutputStream- Throws:
IOException- See Also:
-
write
- Overrides:
writein classOutputStream- Throws:
IOException- See Also:
-
flush
public void flush()- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- See Also:
-
writeBytes
Write thebyte[]to theClobvalue on the server; starting from the current position of this stream.- Parameters:
b- The byte array containing the bytes to be written- Throws:
IOException- Wrapped SqlException if writing to server fails.
-