com.jniwrapper.util
Class StreamUtils

java.lang.Object
  extended by com.jniwrapper.util.StreamUtils

public class StreamUtils
extends java.lang.Object

A utility class for working with streams.


Method Summary
static void copy(java.io.InputStream inputStream, java.io.OutputStream outputStream, int buffSize)
          Copies bytes from input stream (from current byte to EOF byte) to output stream.
static byte[] readBytes(java.io.InputStream in)
          Reads all bytes to EOF of stream and returns these bytes.
static int readInteger(java.io.InputStream is)
          Reads an integer value, stored as four bytes, low byte first.
static int readToBuffer(java.io.InputStream inputStream, byte[] buf)
           
static void writeInteger(java.io.OutputStream out, int data)
          Writes an data to the specified output stream as four bytes, low byte first.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

writeInteger

public static void writeInteger(java.io.OutputStream out,
                                int data)
                         throws java.io.IOException
Writes an data to the specified output stream as four bytes, low byte first.

Parameters:
out - an output stream.
data - a value to save.
Throws:
java.io.IOException

readInteger

public static int readInteger(java.io.InputStream is)
                       throws java.io.IOException
Reads an integer value, stored as four bytes, low byte first.

Parameters:
is - an input stream.
Returns:
value
Throws:
java.io.IOException

readBytes

public static byte[] readBytes(java.io.InputStream in)
                        throws java.io.IOException
Reads all bytes to EOF of stream and returns these bytes.

Throws:
java.io.IOException

copy

public static void copy(java.io.InputStream inputStream,
                        java.io.OutputStream outputStream,
                        int buffSize)
                 throws java.io.IOException
Copies bytes from input stream (from current byte to EOF byte) to output stream.

Parameters:
inputStream - input stream
outputStream - output stream
Throws:
java.io.IOException

readToBuffer

public static int readToBuffer(java.io.InputStream inputStream,
                               byte[] buf)
                        throws java.io.IOException
Throws:
java.io.IOException