public interface ByteStreamWriter
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.
Intended usage is to simply pass in an instance using
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
PreparedStatement.setBinaryStream(int, InputStream) as with the latter the
caller has no control over the buffering strategy.
|Modifier and Type||Interface and Description|
Provides a target to write bytes to.
This must be known ahead of calling
void writeTo(ByteStreamWriter.ByteStreamTarget target) throws IOException
target- the stream to write the data to
IOException- if the underlying stream throws or there is some other error.
Copyright © 1997-2020 PostgreSQL Global Development Group. All Rights Reserved.