Class FileIO

java.lang.Object
  |
  +--FileIO

public class FileIO
extends java.lang.Object

Contains convenience methods for file operations


Field Summary
private static FileIO _instance
           
 
Constructor Summary
private FileIO()
           
 
Method Summary
static FileIO instance()
          Creates the only instance of this class
 java.lang.Object readObject(java.io.File file)
          Reads an Object from a file
 java.io.InputStream readText(java.io.File file)
          Reads text file to InputStream
 void writeObject(java.lang.Object saveMe, java.io.File file)
          Writes an Object to a file.
 void writeText(java.io.File file, java.lang.Object[] text)
          Writes Object Array to text file.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

_instance

private static FileIO _instance
Constructor Detail

FileIO

private FileIO()
Method Detail

instance

public static FileIO instance()
Creates the only instance of this class

readText

public java.io.InputStream readText(java.io.File file)
Reads text file to InputStream
Parameters:
file - the source file
Returns:
file contents

writeText

public void writeText(java.io.File file,
                      java.lang.Object[] text)
Writes Object Array to text file. If the file exists, it will be replaced
Writes 1 line for each Object
Parameters:
file - the destination file
text - the Array containing the lines to be written must contain String objects

writeObject

public void writeObject(java.lang.Object saveMe,
                        java.io.File file)
Writes an Object to a file.
If the file exists, it will be replaced
Parameters:
saveMe - the Object to be written
file - the file to be written into

readObject

public java.lang.Object readObject(java.io.File file)
Reads an Object from a file
Parameters:
file - the source file
Returns:
Object serialized in the file