net.sf.fmj.utility
Class IOUtils

java.lang.Object
  extended by net.sf.fmj.utility.IOUtils

public class IOUtils
extends java.lang.Object

I/O utilities.

Author:
Ken Larson

Method Summary
static void copyFile(java.io.File fileIn, java.io.File fileOut)
           
static void copyFile(java.lang.String fileIn, java.lang.String fileOut)
           
static void copyStream(java.io.InputStream is, java.io.OutputStream os)
           
static byte[] readAll(java.io.InputStream is)
          Closes is when finished.
static java.lang.String readAll(java.io.Reader reader)
          TODO: only handles standard ASCII.
static java.lang.String readAllToString(java.io.InputStream is)
          Assumes default file encoding.
static java.lang.String readAllToString(java.io.InputStream is, java.lang.String encoding)
           
static void readAllToStringBuffer(java.io.InputStream is, java.lang.StringBuffer b)
          Assumes default file encoding.
static void readAllToStringBuffer(java.io.InputStream is, java.lang.String encoding, java.lang.StringBuffer b)
           
static void readAllToStringBuilder(java.io.InputStream is, java.lang.StringBuilder b)
          Assumes default file encoding.
static void readAllToStringBuilder(java.io.InputStream is, java.lang.String encoding, java.lang.StringBuilder b)
           
static void writeStringToFile(java.lang.String value, java.lang.String path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

copyFile

public static void copyFile(java.lang.String fileIn,
                            java.lang.String fileOut)
                     throws java.io.IOException
Throws:
java.io.IOException

copyFile

public static void copyFile(java.io.File fileIn,
                            java.io.File fileOut)
                     throws java.io.IOException
Throws:
java.io.IOException

copyStream

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

readAll

public static byte[] readAll(java.io.InputStream is)
                      throws java.io.IOException
Closes is when finished.

Throws:
java.io.IOException

readAll

public static java.lang.String readAll(java.io.Reader reader)
                                throws java.io.IOException
TODO: only handles standard ASCII.

Throws:
java.io.IOException

readAllToString

public static java.lang.String readAllToString(java.io.InputStream is)
                                        throws java.io.IOException
Assumes default file encoding.

Throws:
java.io.IOException

readAllToString

public static java.lang.String readAllToString(java.io.InputStream is,
                                               java.lang.String encoding)
                                        throws java.io.IOException
Throws:
java.io.IOException

readAllToStringBuffer

public static void readAllToStringBuffer(java.io.InputStream is,
                                         java.lang.StringBuffer b)
                                  throws java.io.IOException
Assumes default file encoding.

Throws:
java.io.IOException

readAllToStringBuffer

public static void readAllToStringBuffer(java.io.InputStream is,
                                         java.lang.String encoding,
                                         java.lang.StringBuffer b)
                                  throws java.io.IOException
Throws:
java.io.IOException

readAllToStringBuilder

public static void readAllToStringBuilder(java.io.InputStream is,
                                          java.lang.StringBuilder b)
                                   throws java.io.IOException
Assumes default file encoding.

Throws:
java.io.IOException

readAllToStringBuilder

public static void readAllToStringBuilder(java.io.InputStream is,
                                          java.lang.String encoding,
                                          java.lang.StringBuilder b)
                                   throws java.io.IOException
Throws:
java.io.IOException

writeStringToFile

public static void writeStringToFile(java.lang.String value,
                                     java.lang.String path)
                              throws java.io.IOException
Throws:
java.io.IOException