Package org.postgresql.util
Class ByteBuffersByteStreamWriter
- java.lang.Object
-
- org.postgresql.util.ByteBuffersByteStreamWriter
-
- All Implemented Interfaces:
ByteStreamWriter
class ByteBuffersByteStreamWriter extends java.lang.Object implements ByteStreamWriter
AByteStreamWriterthat writes ajava.nio.ByteBufferto a byte array parameter.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.postgresql.util.ByteStreamWriter
ByteStreamWriter.ByteStreamTarget
-
-
Constructor Summary
Constructors Constructor Description ByteBuffersByteStreamWriter(java.nio.ByteBuffer... buffers)Construct the writer with the givenByteBuffer
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetLength()Returns the length of the stream.voidwriteTo(ByteStreamWriter.ByteStreamTarget target)Write the data to the providedOutputStream.
-
-
-
Method Detail
-
getLength
public int getLength()
Description copied from interface:ByteStreamWriterReturns the length of the stream.This must be known ahead of calling
ByteStreamWriter.writeTo(ByteStreamTarget).- Specified by:
getLengthin interfaceByteStreamWriter- Returns:
- the number of bytes in the stream.
-
writeTo
public void writeTo(ByteStreamWriter.ByteStreamTarget target) throws java.io.IOException
Description copied from interface:ByteStreamWriterWrite the data to the providedOutputStream.Should not write more than
ByteStreamWriter.getLength()bytes. If attempted, the provided stream will throw anIOException.- Specified by:
writeToin interfaceByteStreamWriter- Parameters:
target- the stream to write the data to- Throws:
java.io.IOException- if the underlying stream throws or there is some other error.
-
-