Here you can find the source of deserialize(File file)
Parameter | Description |
---|---|
file | the file to deserialize |
public static Object deserialize(File file)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; public class Main { /**/*from w w w . ja v a 2 s .c o m*/ * Deserialize an object from a given file * * @param file * the file to deserialize * @return the deserialized object */ public static Object deserialize(File file) { Object result = null; try { FileInputStream fileIn = new FileInputStream(file); ObjectInputStream in = new ObjectInputStream(fileIn); result = in.readObject(); in.close(); fileIn.close(); } catch (ClassNotFoundException | IOException e) { e.printStackTrace(); return null; } return result; } }