Here you can find the source of deserializeFromDisk(String filePath)
Parameter | Description |
---|---|
filePath | the file path |
Parameter | Description |
---|---|
Exception | an exception |
public static Object deserializeFromDisk(String filePath) throws Exception
//package com.java2s; /******************************************************************************* * Copyright 2013/*www .j a v a2 s .c om*/ * Ubiquitous Knowledge Processing (UKP) Lab * Technische Universit?t Darmstadt * * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl-3.0.txt ******************************************************************************/ import java.io.File; import java.io.FileInputStream; import java.io.ObjectInputStream; public class Main { /** * Deserializes an object from disk. * * @param filePath the file path * @return an object. Clients have to cast the object to the expected type. * @throws Exception an exception */ public static Object deserializeFromDisk(String filePath) throws Exception { ObjectInputStream in = new ObjectInputStream(new FileInputStream( new File(filePath))); return in.readObject(); } }