Java Object Deserialize from File deserialization(String filePath)

Here you can find the source of deserialization(String filePath)

Description

deserialization

License

Open Source License

Declaration

public static Object deserialization(String filePath) 

Method Source Code


//package com.java2s;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

import java.io.IOException;
import java.io.ObjectInputStream;

public class Main {

    public static Object deserialization(String filePath) {
        ObjectInputStream in = null;
        try {/*  w w w.ja  va 2 s  .c  om*/
            in = new ObjectInputStream(new FileInputStream(filePath));
            Object o = in.readObject();
            in.close();
            return o;
        } catch (FileNotFoundException e) {
            throw new RuntimeException("FileNotFoundException occurred. ", e);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException("ClassNotFoundException occurred. ", e);
        } catch (IOException e) {
            throw new RuntimeException("IOException occurred. ", e);
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (IOException e) {
                    throw new RuntimeException("IOException occurred. ", e);
                }
            }
        }
    }
}

Related

  1. deserialisasi(String sFile)
  2. deserialiseObject(File f)
  3. deserialize(File file)
  4. deserialize(File file)
  5. deserialize(File file)
  6. deserialize(File file)