I'm getting eofexception I tried to solve it but didn't find an answer it is giving exception in ObjectInputStream line please help me out.
public class SearchIndex extends ObjectOutputStream {
static Map<String, List<String>> map = new HashMap<String, List<String>>();
public SearchIndex(OutputStream out) throws IOException {
super(out);
}
public static void readIndex() throws FileNotFoundException, IOException, ClassNotFoundException {
// create an ObjectInputStream for the file we created before
File file = new File("res/searchIndex.txt");
FileInputStream fis = new FileInputStream(file);
ObjectInputStream ois = new ObjectInputStream(fis);
System.out.println(ois.readObject());
// read and print an int
map = (Map<String, List<String>>) ois.readObject();
System.out.println(map);
ois.close();
}
help me solve this problem