Java Object Deserialize from File deserialisasi(String sFile)

Here you can find the source of deserialisasi(String sFile)

Description

Deserialisasi file (serialized) ke objek

License

Open Source License

Parameter

Parameter Description
String sFile File sumber

Return

Object o Objek hasil deserialisasi

Declaration

public static Object deserialisasi(String sFile) 

Method Source Code

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

import java.io.FileInputStream;

import java.io.IOException;

import java.io.ObjectInputStream;

public class Main {
    /**// ww w  .j  a  v a 2s .  c  om
     * Deserialisasi file (serialized) ke objek
     * @param String sFile File sumber
     * @return Object o Objek hasil deserialisasi
     */
    public static Object deserialisasi(String sFile) {
        Object o = null;
        try {
            ObjectInputStream in = new ObjectInputStream(
                    new FileInputStream(sFile));
            o = in.readObject();
            in.close();
        } catch (ClassNotFoundException ex) {
            System.err.println(ex.getMessage());
        } catch (IOException ex) {
            System.err.println(ex.getMessage());
        }
        return o;
    }
}

Related

  1. deserialiseObject(File f)
  2. deserialization(String filePath)
  3. deserialize(File file)
  4. deserialize(File file)