ap
Class EasyWriter

java.lang.Object
  extended byap.EasyWriter

public class EasyWriter
extends java.lang.Object


Field Summary
protected static int CLOSEERROR
           
protected  int myErrorFlags
           
protected  java.lang.String myFileName
           
protected  java.io.PrintWriter myOutFile
           
protected static int OPENERROR
           
protected static int WRITEERROR
           
 
Constructor Summary
EasyWriter(java.lang.String fileName)
          Constructor.
EasyWriter(java.lang.String fileName, java.lang.String mode)
          Constructor.
 
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 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myFileName

protected java.lang.String myFileName

myOutFile

protected java.io.PrintWriter myOutFile

myErrorFlags

protected int myErrorFlags

OPENERROR

protected static final int OPENERROR
See Also:
Constant Field Values

CLOSEERROR

protected static final int CLOSEERROR
See Also:
Constant Field Values

WRITEERROR

protected static final int WRITEERROR
See Also:
Constant Field Values
Constructor Detail

EasyWriter

public EasyWriter(java.lang.String fileName)
Constructor. Creates 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)
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 "app" opens in append mode
Method Detail

close

public void close()
Closes the file


bad

public boolean bad()
Checks the status of the file

Returns:
true if en error occurred 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