gzz.util
Class CopyUtil

java.lang.Object
  |
  +--gzz.util.CopyUtil

public class CopyUtil
extends java.lang.Object

Utility methods for copying data from input to output streams.


Constructor Summary
CopyUtil()
           
 
Method Summary
static int copy(java.io.InputStream from, java.io.OutputStream to)
           
static int copy(java.io.InputStream from, java.io.OutputStream to, int blockSize)
          Copy data from an input to an output stream in blocks of a given size.
static byte[] readBytes(java.io.InputStream in)
          Read data from an input stream into a byte array by copying it into a ByteArrayOutputStream.
static java.lang.String readString(java.io.InputStream in)
          Read data from an input stream into a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CopyUtil

public CopyUtil()
Method Detail

copy

public static int copy(java.io.InputStream from,
                       java.io.OutputStream to)
                throws java.io.IOException
java.io.IOException

copy

public static int copy(java.io.InputStream from,
                       java.io.OutputStream to,
                       int blockSize)
                throws java.io.IOException
Copy data from an input to an output stream in blocks of a given size. Closes both streams when the copy operation is complete.

java.io.IOException

readBytes

public static byte[] readBytes(java.io.InputStream in)
                        throws java.io.IOException
Read data from an input stream into a byte array by copying it into a ByteArrayOutputStream.

java.io.IOException

readString

public static java.lang.String readString(java.io.InputStream in)
                                   throws java.io.IOException
Read data from an input stream into a String. Most useful for debug output. Encoding is US-ASCII.

java.io.IOException