Top Description Fields Constructors Methods
org.apache.avro.util

public Class NonCopyingByteArrayOutputStream

extends ByteArrayOutputStream
Class Inheritance
Imports
java.io.ByteArrayOutputStream, java.nio.ByteBuffer

Utility to make data written to an ByteArrayOutputStream directly available as a ByteBuffer.

Field Summary

Inherited from java.io.ByteArrayOutputStream:
bufcount

Constructor Summary

AccessConstructor and Description
public
NonCopyingByteArrayOutputStream(int
the initial size
size
)

Creates a new byte array output stream, with a buffer capacity of the specified size, in bytes.

Method Summary

Modifier and TypeMethod and Description
public ByteBuffer

Returns:

The contents of this ByteArrayOutputstream wrapped as a ByteBuffer
asByteBuffer
()

Get the contents of this ByteArrayOutputStream wrapped as a ByteBuffer.

Inherited from java.io.ByteArrayOutputStream:
closeresetsizetoByteArraytoStringtoStringtoStringtoStringwritewritewriteByteswriteTo

Constructor Detail

NonCopyingByteArrayOutputStreamback to summary
public NonCopyingByteArrayOutputStream(int size)

Creates a new byte array output stream, with a buffer capacity of the specified size, in bytes.

Parameters
size:int

the initial size

Exceptions
IllegalArgumentException:
if size is negative

Method Detail

asByteBufferback to summary
public ByteBuffer asByteBuffer()

Get the contents of this ByteArrayOutputStream wrapped as a ByteBuffer. This is a shallow copy. Changes to this ByteArrayOutputstream "write through" to the ByteBuffer.

Returns:ByteBuffer

The contents of this ByteArrayOutputstream wrapped as a ByteBuffer