iio_v2
Class IIO

java.lang.Object
  extended by iio_v2.IIO

public class IIO
extends java.lang.Object


Constructor Summary
IIO(java.lang.String path, java.lang.String fileType)
           
IIO(java.lang.String path, java.lang.String fileType, java.lang.String openMode)
           
 
Method Summary
 int append(Record rec)
          Appends the passed record object to the end of the attached open file
If the file type is indexed and if the key value exists, an error code is generated
If the file type is sequential, the record is simply added to the end of the file regardless of the record content
Passed argument value is a Record Class Object.
 void clearErrorLogFile()
          Clear the error logging file
 int close()
          Disconnects the file from the application and writes all open buffers to disk
Used to effectively disconnect the physical file from the run unit
Flushes all open buffers to disk
All files must be closed in order to finalize the write operations
Files opened for input are not flushed.
 int deleteRecord(int key)
          Delete the record object associated with the passed numeric key value for this sequential file object.
 int deleteRecord(java.lang.String key)
          Delete the record object associated with the passed string key value for this indexed file object.
 void dumpKeys(int count)
          Dumps a number of keys from the file to the system out device
Dumps keys up to the passed integer count value or the last record whichever comes first.
 void dumpRecords(int count)
          Dumps a number of records and keys from the file to the system out device
Dumps records up to the passed integer count value.
 int eraseFile()
          Clears all records form this file.
 boolean existsRecord(java.lang.String key)
          Tests to see if the passed key value exists in the set of keys for this file
 int getIOStatus()
          Gets the current I/O Status code
Returns the most recent I/O status.
 java.util.ArrayList getKeys()
          Get all the keys from the file and put to an arraylist
 java.lang.String getMessage(int status)
          Gets the associated error control message for the status code that was passed.
 int getRecordCount()
          Get the current record count for this file object
 int open(java.lang.String openMode)
          File Open operation is used to attach the associated filename to the current run unit
If the open mode is "output", the file is initialized
If the open mode is "input", the file pointer is set to the first(zeroth) record
If the open mode is set to "append" or "extend", the file pointer is set past the last record in the file.
 Record read(int key)
          Reads a record from a sequential file based upon the passed integer key value
If the key exists, a Record object is returned and the I/O Status variable is set to Zero
If key does not exist, a null object is returned and the IO Status is set to 26, NO_FIND.
 Record read(java.lang.String key)
          Reads a record from an indexed file based upon the passed key value
If the key exists, a Record object is returned and the I/O Status variable is set to Zero
If key does not exist, a null object is returned and the IO Status is set to 26, NO_FIND.
 Record readFirst()
          Read the first record in the file.
 Record readNext()
          Read the next record in the file relative to the current record position
For indexed files it is the next record in the key sequence
For sequential files it is the next physical record.
 int setFileName(java.lang.String filename)
          Sets the working filename for this object
Generally this is a fully qualified path name.
 int setLowerLimit(java.lang.String key)
          Sets a starting point (lower limit) in the indexed file upon which to begin all subsequent reading
The default starting point for a recently opened file is the first record.
 int write(Record rec)
          Write the passed record object to the attached open file object
If Record object is null return an error
If open mode is "Input" return an error
Passed value is a Record Class Object.
 void writeErrorsToJOptionPane(boolean value)
          Write I/O Errors to a JOptionPane Component (JOptionPane.showMessageDialog)
 void writeErrorsToLogFile(boolean value)
          Write I/O Errors to the Error Logging file (IO_Errors_Log.txt)
 void writeErrorsToSystemErr(boolean value)
          Write I/O Errors to the System Out Device (System.err.println)
 void writeErrorsToSystemOut(boolean value)
          Write I/O Errors to the System Out Device (System.out.println)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IIO

public IIO(java.lang.String path,
           java.lang.String fileType,
           java.lang.String openMode)

IIO

public IIO(java.lang.String path,
           java.lang.String fileType)
Method Detail

open

public int open(java.lang.String openMode)
File Open operation is used to attach the associated filename to the current run unit
If the open mode is "output", the file is initialized
If the open mode is "input", the file pointer is set to the first(zeroth) record
If the open mode is set to "append" or "extend", the file pointer is set past the last record in the file.

Since:
Version 2.0 07/01/2008

append

public int append(Record rec)
Appends the passed record object to the end of the attached open file
If the file type is indexed and if the key value exists, an error code is generated
If the file type is sequential, the record is simply added to the end of the file regardless of the record content
Passed argument value is a Record Class Object.

Parameters:
rec - as Record Object
Returns:
integer IO status
Since:
Version 2.0 07/01/2008

close

public int close()
Disconnects the file from the application and writes all open buffers to disk
Used to effectively disconnect the physical file from the run unit
Flushes all open buffers to disk
All files must be closed in order to finalize the write operations
Files opened for input are not flushed.

Since:
Version 2.0 07/01/2008

dumpRecords

public void dumpRecords(int count)
Dumps a number of records and keys from the file to the system out device
Dumps records up to the passed integer count value.

Since:
Version 2.0 07/01/2008

dumpKeys

public void dumpKeys(int count)
Dumps a number of keys from the file to the system out device
Dumps keys up to the passed integer count value or the last record whichever comes first.

Since:
Version 2.0 07/01/2008

getKeys

public java.util.ArrayList getKeys()
Get all the keys from the file and put to an arraylist

Returns:
ArrayList with keys
Since:
Version 2.0 07/01/2008

getRecordCount

public int getRecordCount()
Get the current record count for this file object

Returns:
integer record count.
Since:
Version 2.0 07/01/2008

existsRecord

public boolean existsRecord(java.lang.String key)
Tests to see if the passed key value exists in the set of keys for this file

Returns:
true if record exists, false otherwise.
Since:
Version 2.0 07/01/2008

eraseFile

public int eraseFile()
Clears all records form this file. Returns an integer status.

Since:
Version 2.0 07/01/2008

deleteRecord

public int deleteRecord(java.lang.String key)
Delete the record object associated with the passed string key value for this indexed file object.

Since:
Version 2.0 07/01/2008

deleteRecord

public int deleteRecord(int key)
Delete the record object associated with the passed numeric key value for this sequential file object.

Since:
Version 2.0 07/01/2008

read

public Record read(java.lang.String key)
Reads a record from an indexed file based upon the passed key value
If the key exists, a Record object is returned and the I/O Status variable is set to Zero
If key does not exist, a null object is returned and the IO Status is set to 26, NO_FIND.

Since:
Version 2.0 07/01/2008

read

public Record read(int key)
Reads a record from a sequential file based upon the passed integer key value
If the key exists, a Record object is returned and the I/O Status variable is set to Zero
If key does not exist, a null object is returned and the IO Status is set to 26, NO_FIND.

Since:
Version 2.0 07/01/2008

readFirst

public Record readFirst()
Read the first record in the file.

Returns:
Record Object
Since:
Version 2.0 07/01/2008

readNext

public Record readNext()
Read the next record in the file relative to the current record position
For indexed files it is the next record in the key sequence
For sequential files it is the next physical record.

Returns:
Record Object
Since:
Version 2.0 07/01/2008

setLowerLimit

public int setLowerLimit(java.lang.String key)
Sets a starting point (lower limit) in the indexed file upon which to begin all subsequent reading
The default starting point for a recently opened file is the first record.

Parameters:
key - as String
Returns:
integer status
Since:
Version 2.0 07/01/2008

setFileName

public int setFileName(java.lang.String filename)
Sets the working filename for this object
Generally this is a fully qualified path name.

Parameters:
filename - as String
Since:
Version 2.0 07/01/2008

write

public int write(Record rec)
Write the passed record object to the attached open file object
If Record object is null return an error
If open mode is "Input" return an error
Passed value is a Record Class Object.

Since:
Version 2.0 07/01/2008

getMessage

public java.lang.String getMessage(int status)
Gets the associated error control message for the status code that was passed.

Parameters:
status - as int
Returns:
String as message
Since:
Version 2.0 07/01/2008

getIOStatus

public int getIOStatus()
Gets the current I/O Status code
Returns the most recent I/O status. This is from the previous I/O operation.

Returns:
int Error Code
Since:
Version 2.0 07/01/2008

writeErrorsToSystemOut

public void writeErrorsToSystemOut(boolean value)
Write I/O Errors to the System Out Device (System.out.println)

Parameters:
value - as true or false

writeErrorsToSystemErr

public void writeErrorsToSystemErr(boolean value)
Write I/O Errors to the System Out Device (System.err.println)

Parameters:
value - as true or false

writeErrorsToJOptionPane

public void writeErrorsToJOptionPane(boolean value)
Write I/O Errors to a JOptionPane Component (JOptionPane.showMessageDialog)

Parameters:
value - as true or false

writeErrorsToLogFile

public void writeErrorsToLogFile(boolean value)
Write I/O Errors to the Error Logging file (IO_Errors_Log.txt)

Parameters:
value - as true or false

clearErrorLogFile

public void clearErrorLogFile()
Clear the error logging file

Since:
Version 2.0 07/01/2008