Here you can find the source of readFile(String filename)
public static Object readFile(String filename)
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { private static final String DATA_DIR = "data/"; public static Object readFile(String filename) { FileInputStream fis = null; ObjectInputStream ois = null; Object o = null;// www. java 2s . co m try { fis = new FileInputStream(DATA_DIR + filename); ois = new ObjectInputStream(fis); try { o = ois.readObject(); } catch (IOException e) { e.printStackTrace(); } finally { ois.close(); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return o; } }