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

pack-priv Class LimitingByteInput

extends Object
implements ByteInput
Class Inheritance
All Implemented Interfaces
org.jboss.marshalling.ByteInput, java.io.Closeable, java.lang.AutoCloseable
Static Imports
io.netty.util.internal.ObjectUtil.checkPositive

ByteInput implementation which wraps another ByteInput and throws a TooBigObjectException if the read limit was reached.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
LimitingByteInput.TooBigObjectException

Exception that will get thrown if the Object is too big to unmarshall

Field Summary

Modifier and TypeField and Description
private static final LimitingByteInput.TooBigObjectException
private final ByteInput
private final long
private long

Constructor Summary

AccessConstructor and Description
pack-priv
LimitingByteInput(ByteInput input, long limit)

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
array
,
int
the offset into the array into which data should be read
offset
,
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.
private int
readable(int length)

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

EXCEPTIONback to summary
private static final LimitingByteInput.TooBigObjectException EXCEPTION
inputback to summary
private final ByteInput input
limitback to summary
private final long limit
readback to summary
private long read

Constructor Detail

LimitingByteInputback to summary
pack-priv LimitingByteInput(ByteInput input, long limit)

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[] array, int offset, 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
array:byte[]

the destination array

offset: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
readableback to summary
private int readable(int length)
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
io.netty.handler.codec.marshalling back to summary

pack-priv final Class LimitingByteInput.TooBigObjectException

extends IOException
Class Inheritance

Exception that will get thrown if the Object is too big to unmarshall

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.io.IOException.serialVersionUID.

Constructor Detail

TooBigObjectExceptionback to summary
pack-priv TooBigObjectException()