Class EasyWriter

java.lang.Object
  extended by EasyWriter

public class EasyWriter
extends java.lang.Object


Constructor Summary
EasyWriter(java.lang.String fileName)
          Constructs an EasyWriter associated with a new file (or truncates an existing file).
EasyWriter(java.lang.String fileName, java.lang.String mode)
          Constructs an EasyWriter that can append data to an existing file.
 
Method Summary
 boolean bad()
          Checks the status of the file.
 void close()
          Closes the file.
 void print(char ch)
          Writes one character to the file.
 void print(double x)
          Writes a double to the file.
 void print(int k)
          Writes an integer to the file.
 void print(java.lang.Object obj)
          Writes an object to the file.
 void print(java.lang.String s)
          Writes a string to the file.
 void printf(java.lang.String format, java.lang.Object... args)
          A convenience method to write a formatted string to this EasyWriter using the specified format string and parameters.
 void println()
          Writes a newline character to the file.
 void println(char ch)
          Writes one character and newline to the file.
 void println(double x)
          Writes a double and newline to the file.
 void println(int k)
          Writes an integer and newline to the file.
 void println(java.lang.Object obj)
          Writes an object and newline to the file.
 void println(java.lang.String s)
          Writes a string and newline to the file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EasyWriter

public EasyWriter(java.lang.String fileName)
Constructs an EasyWriter associated with a new file (or truncates an existing file).

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

EasyWriter

public EasyWriter(java.lang.String fileName,
                  java.lang.String mode)
Constructs an EasyWriter that can append data to an existing file.

Parameters:
fileName - the name of the file to be created.
mode - if mode is "app" and the file exists, then opens the file in append mode.
Method Detail

close

public void close()
Closes the file. If the file is not closed, some data may remain in the write buffer but not written to the file.


bad

public boolean bad()
Checks the status of the file.

Returns:
true if an error occurred when opening or writing to the file; false otherwise.

print

public void print(char ch)
Writes one character to the file.

Parameters:
ch - character to be written.

print

public void print(int k)
Writes an integer to the file.

Parameters:
k - number to be written.

print

public void print(double x)
Writes a double to the file.

Parameters:
x - number to be written.

print

public void print(java.lang.String s)
Writes a string to the file.

Parameters:
s - string to be written.

print

public void print(java.lang.Object obj)
Writes an object to the file.

Parameters:
obj - object to be written.

println

public void println()
Writes a newline character to the file.


println

public void println(char ch)
Writes one character and newline to the file.

Parameters:
ch - character to be written.

println

public void println(int k)
Writes an integer and newline to the file.

Parameters:
k - number to be written.

println

public void println(double x)
Writes a double and newline to the file.

Parameters:
x - number to be written.

println

public void println(java.lang.String s)
Writes a string and newline to the file.

Parameters:
s - string to be written.

println

public void println(java.lang.Object obj)
Writes an object and newline to the file.

Parameters:
obj - object to be written.

printf

public void printf(java.lang.String format,
                   java.lang.Object... args)
A convenience method to write a formatted string to this EasyWriter using the specified format string and parameters.