Top Description Fields Constructors Methods
org.postgresql.util

public Class ByteBufferByteStreamWriter

extends Object
implements ByteStreamWriter
Class Inheritance
All Implemented Interfaces
org.postgresql.util.ByteStreamWriter
Imports
java.io.IOException, java.nio.ByteBuffer, java.nio.channels.Channels, .WritableByteChannel

A ByteStreamWriter that writes a java.nio.ByteBuffer to a byte array parameter.

Field Summary

Modifier and TypeField and Description
private final ByteBuffer
private final int

Constructor Summary

AccessConstructor and Description
public
ByteBufferByteStreamWriter(ByteBuffer
the buffer to use.
buf
)

Construct the writer with the given ByteBuffer

Method Summary

Modifier and TypeMethod and Description
public int
getLength()

Implements org.postgresql.util.ByteStreamWriter.getLength.

Returns the length of the stream.

public void
writeTo(ByteStreamWriter.ByteStreamTarget
the stream to write the data to
target
)

Implements org.postgresql.util.ByteStreamWriter.writeTo.

Write the data to the provided OutputStream.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufback to summary
private final ByteBuffer buf
lengthback to summary
private final int length

Constructor Detail

ByteBufferByteStreamWriterback to summary
public ByteBufferByteStreamWriter(ByteBuffer buf)

Construct the writer with the given ByteBuffer

Parameters
buf:ByteBuffer

the buffer to use.

Method Detail

getLengthback to summary
public int getLength()

Implements org.postgresql.util.ByteStreamWriter.getLength.

Doc from org.postgresql.util.ByteStreamWriter.getLength.

Returns the length of the stream.

This must be known ahead of calling writeTo(ByteStreamTarget).

Returns:int

the number of bytes in the stream.

Annotations
@Override
writeToback to summary
public void writeTo(ByteStreamWriter.ByteStreamTarget target) throws IOException

Implements org.postgresql.util.ByteStreamWriter.writeTo.

Doc from org.postgresql.util.ByteStreamWriter.writeTo.

Write the data to the provided OutputStream.

Should not write more than getLength() bytes. If attempted, the provided stream will throw an java.io.IOException.

Parameters
target:ByteStreamWriter.ByteStreamTarget

the stream to write the data to

Annotations
@Override
Exceptions
IOException:
if the underlying stream throws or there is some other error.