Utils
Class FilesWriter

java.lang.Object
  |
  +--Utils.FilesWriter
All Implemented Interfaces:
java.lang.Cloneable

public class FilesWriter
extends java.lang.Object
implements java.lang.Cloneable

Class that defines a reader object for parameters files.

Author:
Olivier Sigaud

Field Summary
protected  java.lang.String myFileName
          Name of the file used by the FilesWriter
protected  java.io.FileOutputStream myReportFileStream
          FileOutputStream used by the FilesWriter
protected  java.io.PrintWriter myReportWriter
          PrintWriter used by the FilesWriter
protected  int myTabIndex
          Current tabulation index of the FilesWriter
 
Constructor Summary
FilesWriter()
          Construct an empty FilesWriter
FilesWriter(java.lang.String myFN)
          Construct the FilesWriter
FilesWriter(java.lang.String myDir, java.lang.String myFN)
          Construct the FilesWriter
 
Method Summary
 void addIndent()
          Add an indentation to the current tabulation index of the FilesWriter
 void close()
          Close the files that the reports have been written.
 void flush()
          Flushes the PrintWriter
 java.lang.String getFileName()
          Get the Name of the file used by the FilesWriter
 java.io.FileOutputStream getReportFileStream()
          Get the FileOutputStream used by the FilesWriter
 java.io.PrintWriter getReportWriter()
          Get the PrintWriter used by the FilesWriter
private  int getTabIndex()
          Get the Current tabulation index of the FilesWriter
static void main(java.lang.String[] args)
          A test routine
 void open()
          Open the files that the reports will be written.
 java.io.PrintWriter out()
          Return the PrintWriter if the FilesWriter
 void outPrint(java.lang.String S)
          Print the String S in the opened file.
 void outPrintln(java.lang.String S)
          Println the String S in the opened file.
 void outTabPrint(java.lang.String S)
          Println the String S in the opened file.
 void outTabPrintln(java.lang.String S)
          Println the String S in the opened file.
private  void setFileName(java.lang.String myFN)
          Set the Name of the file used by the FilesWriter
private  void setReportFileStream(java.io.FileOutputStream myRFS)
          Set the FileOutputStream used by the FilesWriter
private  void setReportWriter(java.io.PrintWriter myRW)
          Set the PrintWriter used by the FilesWriter
private  void setTabIndex(int tabIndex)
          Set the Current tabulation index of the FilesWriter
 void subIndent()
          Sub an indentation to the current tabulation index of the FilesWriter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myTabIndex

protected int myTabIndex
Current tabulation index of the FilesWriter


myReportFileStream

protected java.io.FileOutputStream myReportFileStream
FileOutputStream used by the FilesWriter


myReportWriter

protected java.io.PrintWriter myReportWriter
PrintWriter used by the FilesWriter


myFileName

protected java.lang.String myFileName
Name of the file used by the FilesWriter

Constructor Detail

FilesWriter

public FilesWriter()
Construct an empty FilesWriter


FilesWriter

public FilesWriter(java.lang.String myFN)
Construct the FilesWriter

Parameters:
myFN - Name of the file used by the FilesWriter

FilesWriter

public FilesWriter(java.lang.String myDir,
                   java.lang.String myFN)
Construct the FilesWriter

Parameters:
myDir - Name of the directory used by the FilesWriter
myFN - Name of the file used by the FilesWriter
Method Detail

setTabIndex

private final void setTabIndex(int tabIndex)
Set the Current tabulation index of the FilesWriter


getTabIndex

private final int getTabIndex()
Get the Current tabulation index of the FilesWriter


addIndent

public final void addIndent()
Add an indentation to the current tabulation index of the FilesWriter


subIndent

public final void subIndent()
Sub an indentation to the current tabulation index of the FilesWriter


setReportFileStream

private final void setReportFileStream(java.io.FileOutputStream myRFS)
Set the FileOutputStream used by the FilesWriter


getReportFileStream

public final java.io.FileOutputStream getReportFileStream()
Get the FileOutputStream used by the FilesWriter


setReportWriter

private final void setReportWriter(java.io.PrintWriter myRW)
Set the PrintWriter used by the FilesWriter


getReportWriter

public final java.io.PrintWriter getReportWriter()
Get the PrintWriter used by the FilesWriter


setFileName

private final void setFileName(java.lang.String myFN)
Set the Name of the file used by the FilesWriter


getFileName

public final java.lang.String getFileName()
Get the Name of the file used by the FilesWriter


open

public void open()
Open the files that the reports will be written. Called automatically by the constructor. Any re-call will re-open the files for writing, causing the previous file to be overwritten.


close

public void close()
Close the files that the reports have been written. Automatically called when the application closes.


outPrint

public void outPrint(java.lang.String S)
Print the String S in the opened file. A flush is then called


outPrintln

public void outPrintln(java.lang.String S)
Println the String S in the opened file. A flush is then called


outTabPrintln

public void outTabPrintln(java.lang.String S)
Println the String S in the opened file. A flush is then called


outTabPrint

public void outTabPrint(java.lang.String S)
Println the String S in the opened file. A flush is then called


flush

public void flush()
Flushes the PrintWriter


out

public java.io.PrintWriter out()
Return the PrintWriter if the FilesWriter


main

public static void main(java.lang.String[] args)
A test routine