Java Object Deserialize from File deserializeMyContext(String path)

Here you can find the source of deserializeMyContext(String path)

Description

deserialize My Context

License

Open Source License

Declaration

private static Object deserializeMyContext(String path) throws Exception 

Method Source Code


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

import java.io.*;

public class Main {
    private static Object deserializeMyContext(String path) throws Exception {
        File file = new File(path);
        InputStream fis = new FileInputStream(file);
        ObjectInputStream ois = null;
        Object object = null;/*from  ww  w.  j av  a 2  s. co  m*/
        try {
            ois = new ObjectInputStream(fis);
            object = ois.readObject();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (fis != null) {
                fis.close();
            }
            if (ois != null) {
                ois.close();
            }
            fis.close();

        }
        return object;
    }
}

Related

  1. deserializeFromFile(File file)
  2. deserializeFromFile(File file)
  3. deserializeFromFile(String path)
  4. deserializeFromFile(String path)
  5. deserializeMap(File file)
  6. deserializeObject(String classpathFileName)
  7. deserializeObject(String inputFileName)
  8. deserializeObjectFromFile(File f)
  9. deserializeString(File file)