Top Description Fields Constructors Methods
org.jboss.marshalling

public Class ByteBufferOutput

extends OutputStream
implements ByteOutput
Class Inheritance
All Implemented Interfaces
org.jboss.marshalling.ByteOutput, java.io.Flushable, java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.EOFException, .IOException, .OutputStream, java.nio.BufferOverflowException, .ByteBuffer, .ReadOnlyBufferException

An OutputStream implementing ByteOutput which writes to a ByteBuffer.

Field Summary

Modifier and TypeField and Description
private final ByteBuffer

Constructor Summary

AccessConstructor and Description
public
ByteBufferOutput(final ByteBuffer
the buffer to write to
buffer
)

Create a new instance.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides java.io.OutputStream.close.

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.
public void
flush()

Overrides java.io.OutputStream.flush.

Implements java.io.Flushable.flush.

Flushes this stream by writing any buffered output to the underlying stream.
private static IOException
public void
write(final int
the byte to write
b
)

Implements abstract java.io.OutputStream.write.

Implements org.jboss.marshalling.ByteOutput.write.

Writes to the output stream the eight low-order bits of the argument b.
public void
write(final byte[]
the byte array
b
)

Overrides java.io.OutputStream.write.

Implements org.jboss.marshalling.ByteOutput.write.

Write all the bytes from the given array to the stream.
public void
write(final byte[]
the byte array
b
,
final int
the index to start writing from
off
,
final int
the number of bytes to write
len
)

Overrides java.io.OutputStream.write.

Implements org.jboss.marshalling.ByteOutput.write.

Write some of the bytes from the given array to the stream.
private static EOFException
Inherited from java.io.OutputStream:
nullOutputStream

Field Detail

bufferback to summary
private final ByteBuffer buffer

Constructor Detail

ByteBufferOutputback to summary
public ByteBufferOutput(final ByteBuffer buffer)

Create a new instance.

Parameters
buffer:ByteBuffer

the buffer to write to

Method Detail

closeback to summary
public void close() throws IOException

Overrides java.io.OutputStream.close.

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Exceptions
IOException:
if an I/O error occurs
flushback to summary
public void flush() throws IOException

Overrides java.io.OutputStream.flush.

Implements java.io.Flushable.flush.

Doc from java.io.Flushable.flush.

Flushes this stream by writing any buffered output to the underlying stream.

Exceptions
IOException:
If an I/O error occurs
readOnlyBufferback to summary
private static IOException readOnlyBuffer()
writeback to summary
public void write(final int b) throws IOException

Implements abstract java.io.OutputStream.write.

Implements org.jboss.marshalling.ByteOutput.write.

Doc from org.jboss.marshalling.ByteOutput.write.

Writes to the output stream the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.

Parameters
b:int

the byte to write

Exceptions
IOException:
if an error occurs
writeback to summary
public void write(final byte[] b) throws IOException

Overrides java.io.OutputStream.write.

Implements org.jboss.marshalling.ByteOutput.write.

Doc from org.jboss.marshalling.ByteOutput.write.

Write all the bytes from the given array to the stream.

Parameters
b:byte[]

the byte array

Exceptions
IOException:
if an error occurs
writeback to summary
public void write(final byte[] b, final int off, final int len) throws IOException

Overrides java.io.OutputStream.write.

Implements org.jboss.marshalling.ByteOutput.write.

Doc from org.jboss.marshalling.ByteOutput.write.

Write some of the bytes from the given array to the stream.

Parameters
b:byte[]

the byte array

off:int

the index to start writing from

len:int

the number of bytes to write

Exceptions
IOException:
if an error occurs
writePastEndback to summary
private static EOFException writePastEnd()