jcontrol.io
Class ByteArrayInputStream

java.lang.Object
  extended by jcontrol.io.InputStream
      extended by jcontrol.io.ByteArrayInputStream

public class ByteArrayInputStream
extends InputStream

The ByteArrayOutputStream allows to access a byte array as an InputStream. An internal read pointer is increased on read accesses.


Field Summary
protected  byte[] m_array
          Underlying byte array.
protected  int m_readPos
          Internal read pointer.
 
Constructor Summary
ByteArrayInputStream(byte[] array)
          Creates a new ByteArrayInputStream for the specified byte array.
 
Method Summary
 int available()
          Returns the number of bytes immediately available for reading from this stream.
 void close()
          Has no effect on the ByteArrayInputStream.
 void mark(int readlimit)
          Currently not supported.
 boolean markSupported()
          Currently not supported.
 int read()
          Reads a single byte from the stream.
 void read(byte[] b, int start, int length)
          Reads an array of bytes from the stream.
 void reset()
          Currently not supported.
 void skip(int length)
          Skips data from the stream.
 
Methods inherited from class jcontrol.io.InputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notifyAll, toString, wait
 

Field Detail

m_array

protected byte[] m_array
Underlying byte array.


m_readPos

protected int m_readPos
Internal read pointer.

Constructor Detail

ByteArrayInputStream

public ByteArrayInputStream(byte[] array)
Creates a new ByteArrayInputStream for the specified byte array.

Parameters:
array - byte array to read from
Method Detail

available

public int available()
Description copied from class: InputStream
Returns the number of bytes immediately available for reading from this stream.

Specified by:
available in class InputStream
Returns:
number of bytes immediately readable

close

public void close()
           throws IOException
Has no effect on the ByteArrayInputStream.

Specified by:
close in class InputStream
Throws:
IOException - if stream is already closed

mark

public void mark(int readlimit)
Currently not supported.

Specified by:
mark in class InputStream

markSupported

public boolean markSupported()
Currently not supported.

Specified by:
markSupported in class InputStream
Returns:
true if supported, false if not

read

public int read()
Description copied from class: InputStream
Reads a single byte from the stream.

Specified by:
read in class InputStream
Returns:
byte value

read

public void read(byte[] b,
                 int start,
                 int length)
Description copied from class: InputStream
Reads an array of bytes from the stream. Data is placed at the specified location in the given array.

Specified by:
read in class InputStream
Parameters:
b - array where data is stored
start - offset within the data array
length - number of bytes to read

reset

public void reset()
Currently not supported.

Specified by:
reset in class InputStream

skip

public void skip(int length)
Description copied from class: InputStream
Skips data from the stream.

Specified by:
skip in class InputStream
Parameters:
length - number of bytes to skip