Java ObjectOutputStream Write loadSerializedObject(String fileName)

Here you can find the source of loadSerializedObject(String fileName)

Description

load Serialized Object

License

Open Source License

Declaration

public static Object loadSerializedObject(String fileName) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.*;

public class Main {
    public static Object loadSerializedObject(String fileName) {
        Object object = null;/*from  ww  w .j  a  va 2 s.co m*/
        try {
            InputStream file = new FileInputStream(fileName);
            InputStream buffer = new BufferedInputStream(file);
            ObjectInput input = new ObjectInputStream(buffer);
            try {
                object = input.readObject();
            } finally {
                input.close();
            }
        } catch (ClassNotFoundException cnfEx) {
            System.err.println(fileName);
            cnfEx.printStackTrace();
        } catch (IOException ioex) {
            System.err.println(fileName);
            ioex.printStackTrace();
        }

        return object;
    }
}

Related

  1. loadGZipObject(File file)
  2. LoadMatFromFile(double[] mat, String filename)
  3. loadObj(String file)
  4. loadSerializableFile(File file)
  5. loadSerialized(File file)
  6. loadSerializedObjectWithExceptions(String fileName)
  7. loadTrace(File file)
  8. save(File f, T o)
  9. save(Object o)