Code example for ObjectInputStream

Methods: closereadObject

0
	 
	public static Object readFile(String filename) throws IOException {
		Object o = null;
		ObjectInputStream pl = null;
		try { 
			pl = new ObjectInputStream(new FileInputStream(filename));
			o = (Object)pl.readObject();
		} catch (Exception e) {
			// TODO: handle exception 
			e.printStackTrace();
		} 
		finally{ 
			if (pl!=null) {
				pl.close();
			} 
		} 
		return o;
		 
	} 
} 
Contextual code suggestions in your IDE  Get Codota for Java