cds.util
Class WriteFile

java.lang.Object
  extended bycds.util.WriteFile

public class WriteFile
extends java.lang.Object

Class for writing a simple ASCII file, line by line

Version:
1.0 Feb 2002
Author:
Marc Wenger/CDS

Field Summary
(package private)  java.io.BufferedWriter wrt
           
 
Constructor Summary
WriteFile()
          Empty constructor.
WriteFile(java.lang.String filename)
          Constructor.
 
Method Summary
 void close()
          Closes the file.
 void open(java.lang.String filename)
          Opens a WriteFile object
 void wrtline(java.lang.String line)
          Writes a line.
 void wrtline(java.lang.String line, boolean flush)
          Writes a line.
 void wrttext(java.lang.String text)
          Writes any kind of text (possibly made of several lines).
 void wrttext(java.lang.String text, boolean flush)
          Writes any kind of text (possibly made of several lines).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wrt

java.io.BufferedWriter wrt
Constructor Detail

WriteFile

public WriteFile()
Empty constructor. The file is further opened with the open() method.


WriteFile

public WriteFile(java.lang.String filename)
          throws java.io.IOException
Constructor. Includes the opening of the file

Parameters:
filename - name of the file. If the filename is null, an empty string or "out" then the standard output is used. If the file name == "err", the standard error is used.
Method Detail

open

public void open(java.lang.String filename)
          throws java.io.IOException
Opens a WriteFile object

Parameters:
filename - name of the file. If the filename is null, an empty string or "out" then the standard output is used. If the file name == "err", the standard error is used.
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Closes the file.

Throws:
java.io.IOException

wrtline

public void wrtline(java.lang.String line)
             throws java.io.IOException
Writes a line. A newline sequence is added, and the buffer is flushed.

Parameters:
line - string to write. A newline sequence is appended automatically
Throws:
java.io.IOException

wrtline

public void wrtline(java.lang.String line,
                    boolean flush)
             throws java.io.IOException
Writes a line. A newline sequence is added. Buffer flushing is controlled.

Parameters:
line - string to write. A newline sequence is appended automatically
flush - if true, the file is flushed. Must be used if buffer flushing should not happen with every write.
Throws:
java.io.IOException

wrttext

public void wrttext(java.lang.String text)
             throws java.io.IOException
Writes any kind of text (possibly made of several lines). No newline sequence is added. The buffer is flushed.

Parameters:
text - string to write, as it is. No newline sequence is appended.
Throws:
java.io.IOException

wrttext

public void wrttext(java.lang.String text,
                    boolean flush)
             throws java.io.IOException
Writes any kind of text (possibly made of several lines). No newline sequence is added. Buffer flushing is controlled.

Parameters:
text - string to write, as it is. No newline sequence is appended.
flush - if true, the file is flushed. Must be used if buffer flushing should not happen with every write.
Throws:
java.io.IOException