Here you can find the source of deserialize(final String path)
Convenience method for deserializing an object from a file.
public static Object deserialize(final String path) throws ClassNotFoundException, IOException
//package com.java2s; import java.io.*; public class Main { /**/*www .j a va 2s.c o m*/ * <p>Convenience method for deserializing an object from a file.</p> * * @return the object obtained from the file. */ public static Object deserialize(final String path) throws ClassNotFoundException, IOException { Object result; FileInputStream inputStream = new FileInputStream(path); ObjectInputStream objectInputStream = null; try { objectInputStream = new ObjectInputStream(inputStream); result = objectInputStream.readObject(); } catch (IOException e) { // be sure to release input stream lock (at some point couldn't delete file) inputStream.close(); if (objectInputStream != null) objectInputStream.close(); throw e; } catch (ClassNotFoundException e) { objectInputStream.close(); throw e; } objectInputStream.close(); return result; } }