The intended use case is wanting to write data to a byte array parameter that is stored off heap in a direct memory pool or in some other form that is inconvenient to assemble into a single heap-allocated buffer.
Users should write their own implementation depending on the
original data source. The driver provides a built-in implementation supporting the java. class, see ByteBufferByteStreamWriter.
Intended usage is to simply pass in an instance using
java.:
int bufLength = someBufferObject.length();
preparedStatement.setObject(1, new MyByteStreamWriter(bufLength, someBufferObject));
The length must be known ahead of the stream being written to.
This provides the application more control over memory management than calling
java. as with the latter the
caller has no control over the buffering strategy.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | ByteStreamWriter.
Provides a target to write bytes to. |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public static ByteStreamWriter | |
| public void | writeTo(ByteStreamWriter.
the stream to write the data to targetWrite the data to the provided |
| getLength | back to summary |
|---|---|
| public int getLength() Returns the length of the stream. This must be known ahead of calling
| |
| of | back to summary |
|---|---|
| public static ByteStreamWriter of(ByteBuffer... buf) | |
| writeTo | back to summary |
|---|---|
| public void writeTo(ByteStreamWriter. Write the data to the provided Should not write more than
| |
| Modifier and Type | Method and Description |
|---|---|
| public OutputStream |
| getOutputStream | back to summary |
|---|---|
| public OutputStream getOutputStream() Provides an output stream to write bytes to.
| |