com.jmw.tzap
Class FilterFile

java.lang.Object
  extended by com.jmw.tzap.FilterFile

public class FilterFile
extends java.lang.Object

A file representation in the Text-Zap file filtering system.
A FilterFile contains:

Author:
Judah Wischnitzer

Constructor Summary
FilterFile()
          Constructor for the FilterFile object
FilterFile(java.lang.String inFile)
          Constructor that sets the name of the input file.
FilterFile(java.lang.String inFile, java.lang.String outFile)
          Constructor that sets the name of the input and output files.
FilterFile(java.lang.String inFile, java.lang.String outFile, java.lang.String encod)
          Constructor that sets the name of the input and output files, and the file encoding.
 
Method Summary
 java.lang.String getEncoding()
          Gets the encoding to be used when reading or writing to disk.
 java.lang.String getInFile()
          Gets the name of the file.
 java.lang.String getOutFile()
          Gets the name of the file that will be written to disk.
 int getSize()
          Gets the size of the buffer that is holding the file data
 java.lang.StringBuffer getText()
          Gets the text stored in this file.
 void save()
          Saves the buffer to disk using the preset outFile name.
static void setEncoding(java.lang.String encod)
          Sets the encoding to be used when reading or writing to disk.
 void setInFile(java.lang.String inFile)
          Sets the name of the file.
 void setOutFile(java.lang.String outFile)
          Sets the name of the file that will be written to disk.
 void setText(java.lang.String text)
          Sets the text to be stored in this file.
 void setText(java.lang.StringBuffer text)
          Sets the text to be stored in this file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterFile

public FilterFile()
Constructor for the FilterFile object


FilterFile

public FilterFile(java.lang.String inFile)
Constructor that sets the name of the input file.

Parameters:
inFile - the name of the file on disk

FilterFile

public FilterFile(java.lang.String inFile,
                  java.lang.String outFile)
Constructor that sets the name of the input and output files.

Parameters:
inFile - the name of the file on disk
outFile - the name of the file that the data will end up in when saved on disk

FilterFile

public FilterFile(java.lang.String inFile,
                  java.lang.String outFile,
                  java.lang.String encod)
Constructor that sets the name of the input and output files, and the file encoding.

Parameters:
inFile - the name of the file on disk
outFile - the name of the file that the data will end up in when saved on disk
encoding - the encoding to use when reading and writing to disk
Method Detail

getText

public java.lang.StringBuffer getText()
                               throws java.io.IOException
Gets the text stored in this file.

Returns:
the text stored in the file
Throws:
java.io.IOException - if there is an error loading the file from disk

setText

public void setText(java.lang.StringBuffer text)
Sets the text to be stored in this file.

Parameters:
text - the text to be stored in this file

setText

public void setText(java.lang.String text)
Sets the text to be stored in this file.

Parameters:
text - the text to be stored in this file

setEncoding

public static void setEncoding(java.lang.String encod)
Sets the encoding to be used when reading or writing to disk. Defaults to the system's default encoding.

Parameters:
encoding - the file encoding

getEncoding

public java.lang.String getEncoding()
Gets the encoding to be used when reading or writing to disk.
Defaults to the system's default encoding.

Returns:
encoding the file encoding

setInFile

public void setInFile(java.lang.String inFile)
Sets the name of the file.

Parameters:
inFile - the name of the file.

getInFile

public java.lang.String getInFile()
Gets the name of the file.

Returns:
the name of the file.

setOutFile

public void setOutFile(java.lang.String outFile)
Sets the name of the file that will be written to disk.

Parameters:
outFile - the name of the file.

getOutFile

public java.lang.String getOutFile()
Gets the name of the file that will be written to disk.

Returns:
the name of the output file.

getSize

public int getSize()
Gets the size of the buffer that is holding the file data

Returns:
the size of the buffer

save

public void save()
          throws java.io.IOException
Saves the buffer to disk using the preset outFile name.

Throws:
java.io.IOException - if there is an error writing the file to disk