public class ByteBufferByteStreamWriter extends Object implements ByteStreamWriter
ByteStreamWriter that writes a java.nio.ByteBuffer to a byte array
parameter.ByteStreamWriter.ByteStreamTarget| Constructor and Description |
|---|
ByteBufferByteStreamWriter(ByteBuffer buf)
Construct the writer with the given
ByteBuffer |
| Modifier and Type | Method and Description |
|---|---|
int |
getLength()
Returns the length of the stream.
|
void |
writeTo(ByteStreamWriter.ByteStreamTarget target)
Write the data to the provided
OutputStream. |
public ByteBufferByteStreamWriter(ByteBuffer buf)
ByteBufferbuf - the buffer to use.public int getLength()
ByteStreamWriter This must be known ahead of calling ByteStreamWriter.writeTo(ByteStreamTarget).
getLength in interface ByteStreamWriterpublic void writeTo(ByteStreamWriter.ByteStreamTarget target) throws IOException
ByteStreamWriterOutputStream.
Should not write more than ByteStreamWriter.getLength() bytes. If attempted, the provided stream
will throw an IOException.
writeTo in interface ByteStreamWritertarget - the stream to write the data toIOException - if the underlying stream throws or there is some other error.Copyright © 1997-2020 PostgreSQL Global Development Group. All Rights Reserved.