Package org.apache.derby.client.am
Class BlobLocatorOutputStream
java.lang.Object
java.io.OutputStream
org.apache.derby.client.am.BlobLocatorOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
An
OutputStream
that will use an locator to write
bytes to the Blob value on the server.
Closing a BlobLocatorOutputStream
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 ClientBlob
The Blob to be accessed.private final ClientConnection
Connection used to read Blob from server.private long
Current position in the underlying Blob. -
Constructor Summary
ConstructorsConstructorDescriptionBlobLocatorOutputStream
(ClientConnection connection, ClientBlob blob, long pos) Create anOutputStream
for writing to theBlob
value represented by the given locator basedBlob
object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
write
(byte[] b) void
write
(byte[] b, int off, int len) void
write
(int b) private void
writeBytes
(byte[] b) Write thebyte[]
to theBlob
value on the server; starting from the current position of this stream.Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream
-
Field Details
-
connection
Connection used to read Blob from server. -
blob
The Blob to be accessed. -
currentPos
private long currentPosCurrent position in the underlying Blob. Blobs are indexed from 1
-
-
Constructor Details
-
BlobLocatorOutputStream
BlobLocatorOutputStream(ClientConnection connection, ClientBlob blob, long pos) throws SqlException Create anOutputStream
for writing to theBlob
value represented by the given locator basedBlob
object.- Parameters:
connection
- connection to be used to write to theBlob
value on the serverblob
-Blob
object that contains locator for theBlob
value on the server.pos
- the position in theBLOB
value at which to start writing; the first position is 1- Throws:
SqlException
-
-
Method Details
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
- See Also:
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
- See Also:
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
- See Also:
-
writeBytes
Write thebyte[]
to theBlob
value 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.
-