class BlobLocatorOutputStream
extends java.io.OutputStream
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).
Modifier and Type | Field and Description |
---|---|
private ClientBlob |
blob
The Blob to be accessed.
|
private ClientConnection |
connection
Connection used to read Blob from server.
|
private long |
currentPos
Current position in the underlying Blob.
|
Constructor and Description |
---|
BlobLocatorOutputStream(ClientConnection connection,
ClientBlob blob,
long pos)
Create an
OutputStream for writing to the
Blob value represented by the given locator based
Blob object. |
Modifier and Type | Method and Description |
---|---|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
private void |
writeBytes(byte[] b)
Write the
byte[] to the Blob value on
the server; starting from the current position of this stream. |
private final ClientConnection connection
private final ClientBlob blob
private long currentPos
BlobLocatorOutputStream(ClientConnection connection, ClientBlob blob, long pos) throws SqlException
OutputStream
for writing to the
Blob
value represented by the given locator based
Blob
object.connection
- connection to be used to write to the
Blob
value on the serverblob
- Blob
object that contains locator for
the Blob
value on the server.pos
- the position in the BLOB
value at which
to start writing; the first position is 1SqlException
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
This method writes one byte at a time to the server. For more
efficient writing, use #write(byte[]).
public void write(byte[] b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
OutputStream.write(byte[])
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
OutputStream.write(byte[], int, int)
private void writeBytes(byte[] b) throws java.io.IOException
byte[]
to the Blob
value on
the server; starting from the current position of this stream.b
- The byte array containing the bytes to be writtenjava.io.IOException
- Wrapped SqlException if writing
to server fails.Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.