ccc.commons
Class IO

java.lang.Object
  extended by ccc.commons.IO

public final class IO
extends java.lang.Object

Utility methods for IO processing.

Author:
Civic Computing Ltd.

Method Summary
static void copy(java.io.InputStream is, java.io.OutputStream os)
          Copy from an input stream to an output stream.
static java.lang.String toString(java.io.InputStream is, java.nio.charset.Charset encoding)
          Copy an input stream to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

copy

public static void copy(java.io.InputStream is,
                        java.io.OutputStream os)
                 throws java.io.IOException
Copy from an input stream to an output stream. Optimisation based on: http://java.sun.com/ docs/books/performance/1st_edition/html/JPIOPerformance.fm.html

Parameters:
is - The InputStream to copy from.
os - The OutputStream to copy to.
Throws:
java.io.IOException - If a failure occurs with either stream.

toString

public static java.lang.String toString(java.io.InputStream is,
                                        java.nio.charset.Charset encoding)
                                 throws java.io.IOException
Copy an input stream to a string.

Parameters:
is - The InputStream to copy from.
encoding - The character encoding for the stream.
Returns:
The result string.
Throws:
java.io.IOException - If a failure occurs with either stream.


Copyright © 2010. All Rights Reserved.