com.darwinsys.util
Class FileIO

java.lang.Object
  |
  +--com.darwinsys.util.FileIO

public class FileIO
extends java.lang.Object

Some simple file I-O primitives reimplemented in Java. All methods are static, since there is no state.


Field Summary
protected static int BLKSIZ
          The size of blocking to use
 
Constructor Summary
FileIO()
           
 
Method Summary
static void copyFile(java.io.InputStream is, java.io.OutputStream os, boolean close)
          Copy a file from an opened InputStream to opened OutputStream
static void copyFile(java.io.Reader is, java.io.Writer os, boolean close)
          Copy a file from an opened Reader to opened Writer
static void copyFile(java.lang.String inName, java.io.PrintWriter pw, boolean close)
          Copy a file from a filename to a PrintWriter.
static void copyFile(java.lang.String inName, java.lang.String outName)
          Copy a file from one filename to another
 void copyFileBuffered(java.lang.String inName, java.lang.String outName)
          Copy a data file from one filename to another, alternate method.
static java.lang.String inputStreamToString(java.io.InputStream is)
          Read the content of a Stream into a String
static java.lang.String readerToString(java.io.Reader is)
          Read the entire content of an Reader into a String
static java.lang.String readLine(java.lang.String inName)
          Open a file and read the first line from it.
 
hods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLKSIZ

protected static final int BLKSIZ
The size of blocking to use
Constructor Detail

FileIO

public FileIO()
Method Detail

copyFile

public static void copyFile(java.lang.String inName,
                            java.lang.String outName)
                     throws java.io.FileNotFoundException,
                            java.io.IOException
Copy a file from one filename to another

copyFile

public static void copyFile(java.io.InputStream is,
                            java.io.OutputStream os,
                            boolean close)
                     throws java.io.IOException
Copy a file from an opened InputStream to opened OutputStream

copyFile

public static void copyFile(java.io.Reader is,
                            java.io.Writer os,
                            boolean close)
                     throws java.io.IOException
Copy a file from an opened Reader to opened Writer

copyFile

public static void copyFile(java.lang.String inName,
                            java.io.PrintWriter pw,
                            boolean close)
                     throws java.io.FileNotFoundException,
                            java.io.IOException
Copy a file from a filename to a PrintWriter.

readLine

public static java.lang.String readLine(java.lang.String inName)
                                 throws java.io.FileNotFoundException,
                                        java.io.IOException
Open a file and read the first line from it.

copyFileBuffered

public void copyFileBuffered(java.lang.String inName,
                             java.lang.String outName)
                      throws java.io.FileNotFoundException,
                             java.io.IOException
Copy a data file from one filename to another, alternate method. As the name suggests, use my own buffer instead of letting the BufferedReader allocate and use the buffer.

readerToString

public static java.lang.String readerToString(java.io.Reader is)
                                       throws java.io.IOException
Read the entire content of an Reader into a String

inputStreamToString

public static java.lang.String inputStreamToString(java.io.InputStream is)
                                            throws java.io.IOException
Read the content of a Stream into a String