IO
Class FixedFieldWidthFileWriter

java.lang.Object
  extended byjava.io.Writer
      extended byjava.io.OutputStreamWriter
          extended byjava.io.FileWriter
              extended byIO.FixedFieldWidthFileWriter

public class FixedFieldWidthFileWriter
extends java.io.FileWriter

Convenience class to write strings to a file. Each string is written into a field of fixed width w. The field width must extend the string length. Used to write data in columns of fixed width.


Field Summary
 java.lang.String fileName
           
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
FixedFieldWidthFileWriter(java.lang.String fileName, int w)
          Allocates the file fileNmae in current directory.
 
Method Summary
 void writeField(java.lang.String str)
          Writes string str into a field of width this.w, ie.
 void writeField(java.lang.String str, int fw)
          Writes string str into a field of width fw, ie.
 
Methods inherited from class java.io.OutputStreamWriter
close, flush, getEncoding, write, write, write
 
Methods inherited from class java.io.Writer
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileName

public java.lang.String fileName
Constructor Detail

FixedFieldWidthFileWriter

public FixedFieldWidthFileWriter(java.lang.String fileName,
                                 int w)
                          throws java.io.IOException
Allocates the file fileNmae in current directory.

Parameters:
fileName - name of new file allocated in current directory.
w - field (column) width.
Method Detail

writeField

public void writeField(java.lang.String str,
                       int fw)
Writes string str into a field of width fw, ie. writes the string followed by blanks until w characters have been written.

Parameters:
str - string to be written.
fw - width of field

writeField

public void writeField(java.lang.String str)
Writes string str into a field of width this.w, ie. writes the string followed by blanks until w characters have been written.

Parameters:
str - string to be written.