Secure iNet Factory

com.jscape.util
Class ByteArrayStream

java.lang.Object
  extended by com.jscape.util.ByteArrayStream

public class ByteArrayStream
extends java.lang.Object

The byte array stream.

Author:
Alex Usun

Constructor Summary
ByteArrayStream()
          Creates a new stream intance with default initial capacity.
ByteArrayStream(byte[] data)
          Creates a new stream intance.
ByteArrayStream(int initialCapacity)
          Creates a new stream intance.
 
Method Summary
 int available()
          Returns the stream available bytes.
 int read()
          Reads a byte from the stream.
 int read(byte[] b)
          Reads the stream data into specified buffer.
 int read(byte[] b, int off, int len)
          Reads the stream data into specified buffer.
 void write(byte[] b)
          Writes an array of bytes to the stream.
 void write(byte[] b, int off, int len)
          Writes an array of bytes to the stream.
 void write(int b)
          Writes one byte to the stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayStream

public ByteArrayStream(byte[] data)
Creates a new stream intance.

Parameters:
data - the initial stream data

ByteArrayStream

public ByteArrayStream(int initialCapacity)
Creates a new stream intance.

Parameters:
initialCapacity - the initial buffer capacity

ByteArrayStream

public ByteArrayStream()
Creates a new stream intance with default initial capacity.

Method Detail

available

public int available()
Returns the stream available bytes.

Returns:
the stream available bytes

write

public void write(int b)
Writes one byte to the stream.

Parameters:
b - the byte to write

write

public void write(byte[] b,
                  int off,
                  int len)
Writes an array of bytes to the stream.

Parameters:
b - the array to write
off - the array offset
len - the data length

write

public void write(byte[] b)
Writes an array of bytes to the stream.

Parameters:
b - the array to write

read

public int read()
Reads a byte from the stream.

Returns:
a readed byte or EOF if there's no data in the stream

read

public int read(byte[] b,
                int off,
                int len)
Reads the stream data into specified buffer.

Parameters:
b - the data buffer
off - the buffer offset
len - the requested data length
Returns:
the real number of readed bytes or EOF if there's no data in the stream

read

public int read(byte[] b)
Reads the stream data into specified buffer.

Parameters:
b - the data buffer
Returns:
the real number of readed bytes or EOF if there's no data in the stream

Secure iNet Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved