Here you can find the source of read(String filePath)
public static Object read(String filePath) throws IOException, ClassNotFoundException
//package com.java2s; import java.io.IOException; import java.io.ObjectInputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static Object read(String filePath) throws IOException, ClassNotFoundException { Path path = Paths.get(filePath); try (ObjectInputStream input = new ObjectInputStream(Files.newInputStream(path))) { return input.readObject(); }/* ww w .jav a 2 s .c om*/ } }