gpdraw
Class FileOutput

java.lang.Object
  extended by java.io.Writer
      extended by java.io.PrintWriter
          extended by gpdraw.FileOutput
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class FileOutput
extends java.io.PrintWriter

FileOutput provides simple methods for opening and writing to text files. This class implements most of the print methods found in PrintWriter.

Methods in this class never throw I/O exceptions. The client may inquire as to whether any errors have occurred by invoking checkError().


  Example:
  =======

  FileOutput outFile = new FileOutput("anyname.txt");
  outFile.print("2 + 2 = ");
  outFile.println(4);
  outFile.printf("e = %+10.4f", Math.E);    // -> "e =    +2.7183"
  outFile.println();                        // an extra blank line
  outFile.close();                          // optional
 

Since:
JDK1.4
Version:
1.11, 08/12/06
Author:
George Peck
See Also:
PrintWriter

Constructor Summary
FileOutput(java.lang.String fileName)
          Constructor.
FileOutput(java.lang.String fileName, java.lang.String mode)
          Constructor.
 
Method Summary
 
Methods inherited from class java.io.PrintWriter
append, append, append, checkError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, write, write, write, write, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileOutput

public FileOutput(java.lang.String fileName)
Constructor. Creates a new file (or truncates an existing file)

Parameters:
fileName - the name of the file to be created

FileOutput

public FileOutput(java.lang.String fileName,
                  java.lang.String mode)
Constructor. Creates a new file. If the file exists can append to it.

Parameters:
fileName - the name of the file to be created
mode - if equals to "a" || "app" || "append" opens in append mode