Top Description Fields Constructors Methods
io.netty.handler.codec.marshalling

pack-priv Class ChannelBufferByteInput

extends Object
implements ByteInput
Class Inheritance
All Implemented Interfaces
org.jboss.marshalling.ByteInput, java.io.Closeable, java.lang.AutoCloseable
Imports
io.netty.buffer.ByteBuf, org.jboss.marshalling.ByteInput, java.io.IOException

ByteInput implementation which reads its data from a ByteBuf

Field Summary

Modifier and TypeField and Description
private final ByteBuf

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public int
available()

Implements org.jboss.marshalling.ByteInput.available.

Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream.
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.
public int
read()

Implements org.jboss.marshalling.ByteInput.read.

Reads the next byte of data from the input stream.
public int
read(byte[]
the destination array
array
)

Implements org.jboss.marshalling.ByteInput.read.

Read some bytes from the input stream into the given array.
public int
read(byte[]
the destination array
dst
,
int
the offset into the array into which data should be read
dstIndex
,
int
the number of bytes to attempt to fill in the destination array
length
)

Implements org.jboss.marshalling.ByteInput.read.

Read some bytes from the input stream into the given array.
public long
skip(long
the number of bytes to attempt to skip
bytes
)

Implements org.jboss.marshalling.ByteInput.skip.

Skips over and discards up to n bytes of data from this input stream.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferback to summary
private final ByteBuf buffer

Constructor Detail

ChannelBufferByteInputback to summary
pack-priv ChannelBufferByteInput(ByteBuf buffer)

Method Detail

availableback to summary
public int available() throws IOException

Implements org.jboss.marshalling.ByteInput.available.

Doc from org.jboss.marshalling.ByteInput.available.

Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream.

Returns:int

the number of bytes

Annotations
@Override
Exceptions
IOException:
if an error occurs
closeback to summary
public void close() throws IOException

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.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
readback to summary
public int read() throws IOException

Implements org.jboss.marshalling.ByteInput.read.

Doc from org.jboss.marshalling.ByteInput.read.

Reads the next byte of data from the input stream. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

Returns:int

the next byte, or -1 if the end of stream has been reached

Annotations
@Override
Exceptions
IOException:
if an error occurs
readback to summary
public int read(byte[] array) throws IOException

Implements org.jboss.marshalling.ByteInput.read.

Doc from org.jboss.marshalling.ByteInput.read.

Read some bytes from the input stream into the given array. Returns the number of bytes actually read (possibly zero), or -1 if the end of stream has been reached.

Parameters
array:byte[]

the destination array

Returns:int

the number of bytes read (possibly zero), or -1 if the end of stream has been reached

Annotations
@Override
Exceptions
IOException:
if an error occurs
readback to summary
public int read(byte[] dst, int dstIndex, int length) throws IOException

Implements org.jboss.marshalling.ByteInput.read.

Doc from org.jboss.marshalling.ByteInput.read.

Read some bytes from the input stream into the given array. Returns the number of bytes actually read (possibly zero), or -1 if the end of stream has been reached.

Parameters
dst:byte[]

the destination array

dstIndex:int

the offset into the array into which data should be read

length:int

the number of bytes to attempt to fill in the destination array

Returns:int

the number of bytes read (possibly zero), or -1 if the end of stream has been reached

Annotations
@Override
Exceptions
IOException:
if an error occurs
skipback to summary
public long skip(long bytes) throws IOException

Implements org.jboss.marshalling.ByteInput.skip.

Doc from org.jboss.marshalling.ByteInput.skip.

Skips over and discards up to n bytes of data from this input stream. If the end of stream is reached, this method returns 0 in order to be consistent with java.io.InputStream#skip(long).

Parameters
bytes:long

the number of bytes to attempt to skip

Returns:long

the number of bytes skipped

Annotations
@Override
Exceptions
IOException:
if an error occurs