Top Description Fields Constructors Methods
org.jboss.marshalling

public Class ByteInputStream

extends SimpleByteInput
Class Inheritance
Known Direct Subclasses
org.jboss.marshalling.LimitedByteInput, org.jboss.marshalling.SimpleDataInput
Imports
java.io.IOException, .InputStream

An InputStream which implements ByteInput and reads bytes from another ByteInput. Usually the Marshalling#createByteInput(InputStream) method should be used to create instances because it can detect when the target already implements ByteInput.

Field Summary

Modifier and TypeField and Description
protected volatile ByteInput

Constructor Summary

AccessConstructor and Description
public
ByteInputStream(final ByteInput
the byte input to read from
byteInput
)

Create a new instance.

Method Summary

Modifier and TypeMethod and Description
public int
available()

Overrides java.io.InputStream.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()

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

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

Implements abstract java.io.InputStream.read.

Implements org.jboss.marshalling.ByteInput.read.

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

Overrides java.io.InputStream.read.

Implements org.jboss.marshalling.ByteInput.read.

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

Overrides java.io.InputStream.read.

Implements org.jboss.marshalling.ByteInput.read.

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

Overrides java.io.InputStream.skip.

Implements org.jboss.marshalling.ByteInput.skip.

Skips over and discards up to n bytes of data from this input stream.

Field Detail

byteInputback to summary
protected volatile ByteInput byteInput

Constructor Detail

ByteInputStreamback to summary
public ByteInputStream(final ByteInput byteInput)

Create a new instance.

Parameters
byteInput:ByteInput

the byte input to read from

Method Detail

availableback to summary
public int available() throws IOException

Overrides java.io.InputStream.available.

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

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

Overrides java.io.InputStream.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
readback to summary
public int read() throws IOException

Implements abstract java.io.InputStream.read.

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

Exceptions
IOException:
if an error occurs
readback to summary
public int read(final byte[] b) throws IOException

Overrides java.io.InputStream.read.

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
b:byte[]

the destination array

Returns:int

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

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

Overrides java.io.InputStream.read.

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
b:byte[]

the destination array

off:int

the offset into the array into which data should be read

len: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

Exceptions
IOException:
if an error occurs
skipback to summary
public long skip(final long n) throws IOException

Overrides java.io.InputStream.skip.

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
n:long

the number of bytes to attempt to skip

Returns:long

the number of bytes skipped

Exceptions
IOException:
if an error occurs