org.objectweb.jac.util
Class Streams

java.lang.Object
  |
  +--org.objectweb.jac.util.Streams

public class Streams
extends Object

This class contains some utility functions for streams.


Constructor Summary
Streams()
           
 
Method Summary
static void copy(InputStream in, OutputStream out)
          Read data from an InputStream and writes it to an OutputStream
static byte[] readStream(InputStream fin)
          Reads an input stream until it reaches the end and store the data in an array of bytes.
static int readUByte(InputStream in)
          Reads unsigned byte
static long readUInt(InputStream in)
          Reads an unsigned integer in little endian encoding
static int readUShort(InputStream in)
          Reads unsigned short in little endian encoding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Streams

public Streams()
Method Detail

readStream

public static byte[] readStream(InputStream fin)
                         throws IOException
Reads an input stream until it reaches the end and store the data in an array of bytes.

this method was extracted "as is" from javassist 1.0 from Shigeru Chiba.

Javassist Homepage

Parameters:
fin - the input stream to read the class from
Returns:
the contents of that input stream
Throws:
IOException - if the size of the file is equal or more than 1Mbyte.

readUInt

public static long readUInt(InputStream in)
                     throws IOException
Reads an unsigned integer in little endian encoding

Parameters:
in - the stream to read the integer from
IOException

readUShort

public static int readUShort(InputStream in)
                      throws IOException
Reads unsigned short in little endian encoding

Parameters:
in - the stream to read the short integer from
IOException

readUByte

public static int readUByte(InputStream in)
                     throws IOException
Reads unsigned byte

Parameters:
in - the stream to read the byte from
IOException

copy

public static void copy(InputStream in,
                        OutputStream out)
                 throws IOException
Read data from an InputStream and writes it to an OutputStream

IOException