net.sf.rej.util
Class IOToolkit

java.lang.Object
  extended by net.sf.rej.util.IOToolkit

public class IOToolkit
extends java.lang.Object


Constructor Summary
IOToolkit()
           
 
Method Summary
static boolean areEqual(java.io.InputStream isA, java.io.InputStream isB)
          Compares two InputStreams for equality.
static byte[] readStream(int length, java.io.InputStream is)
           
static void updateCRCWithStream(java.io.InputStream is, java.util.zip.CRC32 crc)
          Calculate a checksum for the stream.
static void writeStream(java.io.InputStream is, java.io.OutputStream os)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IOToolkit

public IOToolkit()
Method Detail

readStream

public static byte[] readStream(int length,
                                java.io.InputStream is)
                         throws java.io.IOException
Throws:
java.io.IOException

writeStream

public static void writeStream(java.io.InputStream is,
                               java.io.OutputStream os)
                        throws java.io.IOException
Throws:
java.io.IOException

updateCRCWithStream

public static void updateCRCWithStream(java.io.InputStream is,
                                       java.util.zip.CRC32 crc)
                                throws java.io.IOException
Calculate a checksum for the stream.

Parameters:
is - InputStream the stream for which to calculate the checksum.
crc - the checksum object to update.
Throws:
java.io.IOException - problem in the I/O processing.

areEqual

public static boolean areEqual(java.io.InputStream isA,
                               java.io.InputStream isB)
                        throws java.io.IOException
Compares two InputStreams for equality. Both streams are read and the content is compared.

Parameters:
isA - first stream to compare
isB - second stream to compare
Returns:
true if the streams have equal data, false otherwise.
Throws:
java.io.IOException - a problem in the I/O processing.