Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rj.tools.util
Class FileIO

    java.lang.Object
      |
      +--rj.tools.util.FileIO

public class FileIO
extends java.lang.Object

Basic file io operations This code is copied from the O'Reilly 'Java Cookbook'

Version:
  $Revision
Author:
  Ian F Darwin, Ralph Jocham

Field Summary
`protected static int` | `BLKSIZ` The size of blocking to use

Method Summary
`static void` | `copyFile(java.io.InputStream is, java.io.OutputStream os, boolean close)` Copy file from InputStream to OutputStream
`static void` | `copyFile(java.io.Reader is, java.io.Writer os, boolean close)` Copy file from Reader to Writer
`static void` | `copyFile(java.lang.String inName, java.io.PrintWriter pw, boolean close)` Copy file from File specified by name to PrintWrite
`static void` | `copyFile(java.lang.String inName, java.lang.String outName)` Copy file using file names
`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.io.BufferedReader` | `openFile(java.lang.String fileName)` Open a BufferedReader from a named file.
`static java.lang.String` | `readerToString(java.io.Reader is)` Read the entire content of a Reader into a String
`static java.lang.String` | `readLine(java.lang.String inName)` Open a File and read first line of it
`static void` | `stringToFile(java.lang.String text, java.lang.String fileName)` Write a String as the entire content of a File

Methods 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

Method Detail

### copyFile

    public static void copyFile(java.lang.String inName,
                                java.lang.String outName)
                         throws java.io.FileNotFoundException,
                                java.io.IOException

  Copy file using file names
  Parameters:
    `inName` -
    `outName` -
  Throws:
    `java.io.FileNotFoundException` -
    `java.io.IOException` -

### copyFile

    public static void copyFile(java.io.InputStream is,
                                java.io.OutputStream os,
                                boolean close)
                         throws java.io.IOException

  Copy file from InputStream to OutputStream
  Parameters:
    `is` -
    `os` -
    `close` -
  Throws:
    `java.io.IOException` -

### copyFile

    public static void copyFile(java.io.Reader is,
                                java.io.Writer os,
                                boolean close)
                         throws java.io.IOException

  Copy file from Reader to Writer
  Parameters:
    `is` -
    `os` -
    `close` -
  Throws:
    `java.io.IOException` -

### copyFile

    public static void copyFile(java.lang.String inName,
                                java.io.PrintWriter pw,
                                boolean close)
                         throws java.io.FileNotFoundException,
                                java.io.IOException

  Copy file from File specified by name to PrintWrite
  Parameters:
    `inName` -
    `pw` -
    `close` -
  Throws:
    `java.io.FileNotFoundException` -
    `java.io.IOException` -

### readLine

    public static java.lang.String readLine(java.lang.String inName)
                                     throws java.io.FileNotFoundException,
                                            java.io.IOException

  Open a File and read first line of it
  Parameters:
    `inName` -
  Returns:
    the line
  Throws:
    `java.io.FileNotFoundException` -
    `java.io.IOException` -

### 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.
  Parameters:
    `inName` -
    `outName` -
  Throws:
    `java.io.FileNotFoundException` -
    `java.io.IOException` -

### readerToString

    public static java.lang.String readerToString(java.io.Reader is)
                                           throws java.io.IOException

  Read the entire content of a Reader into a String
  Parameters:
    `is` -
  Returns:
    the String containing the reader
  Throws:
    `java.io.IOException` -

### inputStreamToString

    public static java.lang.String inputStreamToString(java.io.InputStream is)
                                                throws java.io.IOException

  Read the content of a Stream into a String
  Parameters:
    `is` -
  Returns:
    the String containing the input stream
  Throws:
    `java.io.IOException` -

### stringToFile

    public static void stringToFile(java.lang.String text,
                                    java.lang.String fileName)
                             throws java.io.IOException

  Write a String as the entire content of a File
  Parameters:
    `text` -
    `fileName` -
  Throws:
    `java.io.IOException` -

### openFile

    public static java.io.BufferedReader openFile(java.lang.String fileName)
                                           throws java.io.IOException

  Open a BufferedReader from a named file.
  Parameters:
    `fileName` -
  Returns:
    the buffered reader
  Throws:
    `java.io.IOException` -

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

(c) 1999-2004 by Ralph Jocham (rjocham72@netscape.net)
JCSC is released under the terms of the GNU General Public License