I have my program setup to serialize a certain Facebook Object on exit, and deserialize it on open. But I want to have an if statement in the deserialization portion to only go on with it if a serilization file is present to avoid errors. How can I do that? Is there anyway that I could refer to the file "serilaized" and check if it exists?
Deserialization portion:
Facebook facebook = null;
    try {
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream(
                "serialized"));
        facebook = (Facebook) ois.readObject();
        ois.close();
    } catch (FileNotFoundException e) {
        System.err.println("Could not open the file \"serialized\"");
    } catch (IOException e) {
        System.err.println("Could not de-serialize the object");
    } catch (ClassNotFoundException e) {
        System.err.println("Could not cast the de-serialized object");
    }
Serialization portion:
try {
                ObjectOutputStream oos = new ObjectOutputStream(
                        new FileOutputStream ("serialized"));
                oos.writeObject(facebook);
                oos.close();
            } catch (FileNotFoundException e) {
                System.err
                        .println("Could not create the file \"serialized\"");
            } catch (IOException e) {
                System.err.println("Could not serialize the object");
            }
 
    