Class FileSystem

java.lang.Object
  extended byFileSystem

public class FileSystem
extends java.lang.Object

An object of this class manages interaction between the address book program and the file system of the computer it is running on.


Constructor Summary
FileSystem()
           
 
Method Summary
 AddressBook readFile(java.io.File file)
          Read a stored file
 void saveFile(AddressBook addressBook, java.io.File file)
          Save an address book to a file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystem

public FileSystem()
Method Detail

readFile

public AddressBook readFile(java.io.File file)
                     throws java.io.IOException,
                            java.lang.ClassCastException,
                            java.lang.ClassNotFoundException
Read a stored file

Parameters:
file - the file specification for the file to read
Returns:
the AddressBook object stored in the file
Throws:
java.io.IOException - if there is a problem reading the file
java.lang.ClassCastException - if the file does not contain an AddressBook
java.lang.ClassNotFoundException - if the file does not contain an AddressBook, and the class it does contain is not found - this should never happen

saveFile

public void saveFile(AddressBook addressBook,
                     java.io.File file)
              throws java.io.IOException
Save an address book to a file

Parameters:
addressBook - the AddressBook to save
file - the file specification for the file to create
Throws:
java.io.IOException - if there is a problem writing the file