Class TextOutputFile

java.lang.Object
  extended by TextOutputFile

public class TextOutputFile
extends Object


Field Summary
protected  boolean closed
          Set if the file has been closed.
protected  PrintWriter f
          Streams used for the file
protected  String fileName
          The file name.
protected  String lineSeparator
          The line separator in files
protected  boolean useStandardIO
          Indicator whether to write to standard output or a file.
 
Constructor Summary
TextOutputFile()
          Contructor - TextOutputFile to write to standard output.
TextOutputFile(File file)
          Contructor - TextOutputFile to write to a File.
TextOutputFile(File file, boolean append)
          Contructor - TextOutputFile to write or append to a File.
TextOutputFile(String fileName)
          Contructor - TextFile to write to file with specified name.
TextOutputFile(String fileName, boolean append)
          Contructor - TextFile to write or append to file with specified name.
 
Method Summary
 void close()
          Close the file to further writing.
 boolean isStandardOut()
           
 void print(boolean value)
          Write the text representation of a boolean to the file.
 void print(boolean value, int fieldSize)
          Write the text representation of a boolean to the file with a specified field size.
 void print(byte number)
          Write the text representation of an 8-bit integer (a "byte") to the file.
 void print(byte number, int fieldSize)
          Write the text representation of an 8-bit integer (a "byte") to the file with a specified field size.
 void print(char ch)
          Write a character to the file.
 void print(char ch, int fieldSize)
          Write a character to the file with a specified field size..
 void print(double number)
          Write a double precision floating point number (a "double") to the file.
 void print(double number, int fieldSize)
          Write a double precision floating point number (a "double") to the file with a specified field size.
 void print(double number, int fieldSize, int decimalPlaces)
          Write a double precision floating point number (a "double") to the file with a specified field size and a specified number of decimal places.
 void print(float number)
          Write a floating point number (a "float") to the file.
 void print(float number, int fieldSize)
          Write a floating point number (a "float") to the file with a specified field size.
 void print(float number, int fieldSize, int decimalPlaces)
          Write a floating point number (a "double") to the file with a specified field size and a specified number of decimal places.
 void print(int number)
          Write the text representation of an 32-bit integer (an "int") to the file.
 void print(int number, int fieldSize)
          Write the text representation of an 32-bit integer (an "int") to the file with a specified field size.
 void print(long number)
          Write the text representation of an 64-bit integer (a "long") to the file.
 void print(long number, int fieldSize)
          Write the text representation of an 64-bit integer (a "long") to the file with a specified field size.
 void print(short number)
          Write the text representation of an 16-bit integer (a "short") to the file.
 void print(short number, int fieldSize)
          Write the text representation of an 16-bit integer (a "short") to the file with a specified field size.
 void print(String text)
          Write a string to the file.
 void print(String text, int fieldSize)
          Write a string to the file with a specified field size..
 void println()
          Write a newline to the file.
 void println(boolean value)
          Write the text representation of a boolean to the file followed by a newline.
 void println(boolean value, int fieldSize)
          Write the text representation of a boolean to the file with a specified field size followed by a newline.
 void println(byte number)
          Write the text representation of an 8-bit integer (a "byte") to the file followed by a newline.
 void println(byte number, int fieldSize)
          Write the text representation of an 8-bit integer (a "byte") to the file with a specified field size followed by a newline.
 void println(char ch)
          Write a character to the file followed by a newline.
 void println(char ch, int fieldSize)
          Write a character to the file with a specified field size..
 void println(double number)
          Write a double precision floating point number (a "double") to the file followed by a newline.
 void println(double number, int fieldSize)
          Write a double precision floating point number (a "double") to the file with a specified field size followed by a newline.
 void println(double number, int fieldSize, int decimalPlaces)
          Write a double precision floating point number (a "double") to the file with a specified field size and a specified number of decimal places followed by a newline.
 void println(float number)
          Write a floating point number (a "float") to the file followed by a newline.
 void println(float number, int fieldSize)
          Write a floating point number (a "float") to the file with a specified field size followed by a newline.
 void println(float number, int fieldSize, int decimalPlaces)
          Write a floating point number (a "double") to the file with a specified field size and a specified number of decimal places followed by a newline.
 void println(int number)
          Write the text representation of an 32-bit integer (an "int") to the file followed by a newline.
 void println(int number, int fieldSize)
          Write the text representation of an 32-bit integer (an "int") to the file with a specified field size followed by a newline.
 void println(long number)
          Write the text representation of an 64-bit integer (a "long") to the file followed by a newline.
 void println(long number, int fieldSize)
          Write the text representation of an 64-bit integer (a "long") to the file with a specified field size followed by a newline.
 void println(short number)
          Write the text representation of an 16-bit integer (a "short") to the file followed by a newline.
 void println(short number, int fieldSize)
          Write the text representation of an 16-bit integer (a "short") to the file with a specified field size followed by a newline.
 void println(String text)
          Write a string to the file followed by a newline.
 void println(String text, int fieldSize)
          Write a string to the file with a specified field size followed by a newline.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

closed

protected boolean closed
Set if the file has been closed.


f

protected PrintWriter f
Streams used for the file


fileName

protected String fileName
The file name.


lineSeparator

protected String lineSeparator
The line separator in files


useStandardIO

protected boolean useStandardIO
Indicator whether to write to standard output or a file.

Constructor Detail

TextOutputFile

public TextOutputFile()
Contructor - TextOutputFile to write to standard output.


TextOutputFile

public TextOutputFile(File file)
Contructor - TextOutputFile to write to a File.

Parameters:
file - - File to be opened.

TextOutputFile

public TextOutputFile(File file,
                      boolean append)
Contructor - TextOutputFile to write or append to a File.

Parameters:
file - - File to be opened.
append - - True if file is to be appended to.

TextOutputFile

public TextOutputFile(String fileName)
Contructor - TextFile to write to file with specified name.

Parameters:
fileName - - Name of the file to be opened.

TextOutputFile

public TextOutputFile(String fileName,
                      boolean append)
Contructor - TextFile to write or append to file with specified name.

Parameters:
fileName - - Name of the file to be opened.
append - - True if file is to be appended to.
Method Detail

close

public void close()
Close the file to further writing.


isStandardOut

public boolean isStandardOut()

print

public void print(boolean value)
Write the text representation of a boolean to the file.

Parameters:
value - The boolean to be written to the file.

print

public void print(boolean value,
                  int fieldSize)
Write the text representation of a boolean to the file with a specified field size.

Parameters:
value - The boolean to be written to the file.
fieldSize - The field width that the boolean is to be written in.

print

public void print(byte number)
Write the text representation of an 8-bit integer (a "byte") to the file.

Parameters:
number - The number to be written to the file.

print

public void print(byte number,
                  int fieldSize)
Write the text representation of an 8-bit integer (a "byte") to the file with a specified field size.

Parameters:
number - The number to be written to the file.
fieldSize - The field width that the number is to be written in.

print

public void print(char ch)
Write a character to the file.

Parameters:
ch - The character to be written to the file.

print

public void print(char ch,
                  int fieldSize)
Write a character to the file with a specified field size..

Parameters:
ch - The character to be written to the file.
fieldSize - The field width that the character is to be written in.

print

public void print(double number)
Write a double precision floating point number (a "double") to the file.

Parameters:
number - The number to be written to the file.

print

public void print(double number,
                  int fieldSize)
Write a double precision floating point number (a "double") to the file with a specified field size.

Parameters:
number - The number to be written to the file.
fieldSize - The field width that the number is to be written in.

print

public void print(double number,
                  int fieldSize,
                  int decimalPlaces)
Write a double precision floating point number (a "double") to the file with a specified field size and a specified number of decimal places.

Parameters:
number - The number to be written to the file.
fieldSize - The field width that the number is to be written in.
decimalPlaces - The number of decimal places of the number to be displayed.

print

public void print(float number)
Write a floating point number (a "float") to the file.

Parameters:
number - The number to be written to the file.

print

public void print(float number,
                  int fieldSize)
Write a floating point number (a "float") to the file with a specified field size.

Parameters:
number - The number to be written to the file.
fieldSize - The field width that the number is to be written in.

print

public void print(float number,
                  int fieldSize,
                  int decimalPlaces)
Write a floating point number (a "double") to the file with a specified field size and a specified number of decimal places.

Parameters:
number - The number to be written to the file.
fieldSize - The field width that the number is to be written in.
decimalPlaces - The number of decimal places of the number to be displayed.

print

public void print(int number)
Write the text representation of an 32-bit integer (an "int") to the file.

Parameters:
number - The number to be written to the file.

print

public void print(int number,
                  int fieldSize)
Write the text representation of an 32-bit integer (an "int") to the file with a specified field size.

Parameters:
number - The number to be written to the file.
fieldSize - The field width that the number is to be written in.

print

public void print(long number)
Write the text representation of an 64-bit integer (a "long") to the file.

Parameters:
number - The number to be written to the file.

print

public void print(long number,
                  int fieldSize)
Write the text representation of an 64-bit integer (a "long") to the file with a specified field size.

Parameters:
number - The number to be written to the file.
fieldSize - The field width that the number is to be written in.

print

public void print(short number)
Write the text representation of an 16-bit integer (a "short") to the file.

Parameters:
number - The number to be written to the file.

print

public void print(short number,
                  int fieldSize)
Write the text representation of an 16-bit integer (a "short") to the file with a specified field size.

Parameters:
number - The number to be written to the file.
fieldSize - The field width that the number is to be written in.

print

public void print(String text)
Write a string to the file.

Parameters:
text - The string to be written to the file.

print

public void print(String text,
                  int fieldSize)
Write a string to the file with a specified field size..

Parameters:
text - The string to be written to the file.
fieldSize - The field width that the string is to be written in.

println

public void println()
Write a newline to the file.


println

public void println(boolean value)
Write the text representation of a boolean to the file followed by a newline.

Parameters:
value - The boolean to be written to the file.

println

public void println(boolean value,
                    int fieldSize)
Write the text representation of a boolean to the file with a specified field size followed by a newline.

Parameters:
value - The boolean to be written to the file.
fieldSize - The field width that the boolean is to be written in.

println

public void println(byte number)
Write the text representation of an 8-bit integer (a "byte") to the file followed by a newline.

Parameters:
number - The number to be written to the file.

println

public void println(byte number,
                    int fieldSize)
Write the text representation of an 8-bit integer (a "byte") to the file with a specified field size followed by a newline.

Parameters:
number - The number to be written to the file.
fieldSize - The field width that the number is to be written in.

println

public void println(char ch)
Write a character to the file followed by a newline.

Parameters:
ch - The character to be written to the file.

println

public void println(char ch,
                    int fieldSize)
Write a character to the file with a specified field size..

Parameters:
ch - The character to be written to the file.
fieldSize - The field width that the character is to be written in.

println

public void println(double number)
Write a double precision floating point number (a "double") to the file followed by a newline.

Parameters:
number - The number to be written to the file.

println

public void println(double number,
                    int fieldSize)
Write a double precision floating point number (a "double") to the file with a specified field size followed by a newline.

Parameters:
number - The number to be written to the file.
fieldSize - The field width that the number is to be written in.

println

public void println(double number,
                    int fieldSize,
                    int decimalPlaces)
Write a double precision floating point number (a "double") to the file with a specified field size and a specified number of decimal places followed by a newline.

Parameters:
number - The number to be written to the file.
fieldSize - The field width that the number is to be written in.
decimalPlaces - The number of decimal places of the number to be displayed.

println

public void println(float number)
Write a floating point number (a "float") to the file followed by a newline.

Parameters:
number - The number to be written to the file.

println

public void println(float number,
                    int fieldSize)
Write a floating point number (a "float") to the file with a specified field size followed by a newline.

Parameters:
number - The number to be written to the file.
fieldSize - The field width that the number is to be written in.

println

public void println(float number,
                    int fieldSize,
                    int decimalPlaces)
Write a floating point number (a "double") to the file with a specified field size and a specified number of decimal places followed by a newline.

Parameters:
number - The number to be written to the file.
fieldSize - The field width that the number is to be written in.
decimalPlaces - The number of decimal places of the number to be displayed.

println

public void println(int number)
Write the text representation of an 32-bit integer (an "int") to the file followed by a newline.

Parameters:
number - The number to be written to the file.

println

public void println(int number,
                    int fieldSize)
Write the text representation of an 32-bit integer (an "int") to the file with a specified field size followed by a newline.

Parameters:
number - The number to be written to the file.
fieldSize - The field width that the number is to be written in.

println

public void println(long number)
Write the text representation of an 64-bit integer (a "long") to the file followed by a newline.

Parameters:
number - The number to be written to the file.

println

public void println(long number,
                    int fieldSize)
Write the text representation of an 64-bit integer (a "long") to the file with a specified field size followed by a newline.

Parameters:
number - The number to be written to the file.
fieldSize - The field width that the number is to be written in.

println

public void println(short number)
Write the text representation of an 16-bit integer (a "short") to the file followed by a newline.

Parameters:
number - The number to be written to the file.

println

public void println(short number,
                    int fieldSize)
Write the text representation of an 16-bit integer (a "short") to the file with a specified field size followed by a newline.

Parameters:
number - The number to be written to the file.
fieldSize - The field width that the number is to be written in.

println

public void println(String text)
Write a string to the file followed by a newline.

Parameters:
text - The string to be written to the file.

println

public void println(String text,
                    int fieldSize)
Write a string to the file with a specified field size followed by a newline.

Parameters:
text - The string to be written to the file.
fieldSize - The field width that the string is to be written in.