bin
Class DataRecordOperations

java.lang.Object
  extended by bin.DataRecordOperations

public class DataRecordOperations
extends java.lang.Object

DataRecordOperations Class

This class is responsible for recording the various data operations, such as writing to files.




version 0.3 - Initial Release


v0.4 - UPDATE
Added the "readFile() method" for loading AI files into AI Builder.

v0.5 - UPDATE
Provided improved javadoc commentary and a tweak for the "writeFile()" method.

Version:
0.5 - Improved javadoc, class layout and a couple of small tweaks. Nothing major.
Author:
Richard John Sproston [ richard.sproston@gmail.com || lucky_jackpot@hotmail.com ]

Constructor Summary
DataRecordOperations()
          Default Constructor for class, with no parameters
 
Method Summary
 java.lang.String getTextDocument()
          This method is used to retrieve the placeholder String that contains an AI file that was read into memory.
 void readFile(java.io.File fileObj)
          This method is used to read the contents of an AI file and store the information as a String.
 void setTextDocument(java.lang.String textDocument)
          After having read the contents of a file into memory, this method is responsible for creating a String variable to set (and hold) the contents.
 void writeFile(java.io.File fileObj, java.lang.String document)
          This method is used to store (write) AI preview code to a file on disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataRecordOperations

public DataRecordOperations()
Default Constructor for class, with no parameters

Method Detail

setTextDocument

public void setTextDocument(java.lang.String textDocument)
After having read the contents of a file into memory, this method is responsible for creating a String variable to set (and hold) the contents.

Parameters:
textDocument - The String that is to set and hold the read input AI file.

getTextDocument

public java.lang.String getTextDocument()
This method is used to retrieve the placeholder String that contains an AI file that was read into memory.

Returns:
The contents of an AI file (stored as a String).

writeFile

public void writeFile(java.io.File fileObj,
                      java.lang.String document)
               throws java.io.IOException
This method is used to store (write) AI preview code to a file on disk. This is used either the first time a document is created (and no other files of the same name exist) or a "New Document" is created (with a document of the same name existing). [Determinations based on user-interactions from GUIFramework class.]

Parameters:
document - The text that is displayed in the generated AI file preview text-area.
Throws:
java.io.IOException - To be handled by GUIFramework class.

readFile

public void readFile(java.io.File fileObj)
              throws java.io.IOException
This method is used to read the contents of an AI file and store the information as a String. It uses a BufferedReader to read through the plain-text file, compiling all the String information it requires to "rebuild" the AI file, verbatim, and uses the "setTextDocument (arg_value)" method to store the String.

Parameters:
fileObj - The File object that refers to a file for reading.
Throws:
java.io.IOException