I was working with ObjectInputStream and was trying to load a HashMap that I had stored in the file. But I am getting EOF Exception
java.io.EOFException
This is my code ....
ObjectInputStream inputStream = null;
inputStream = new ObjectInputStream(new FileInputStream("C:\\Users\\User1\\workspace\\Resource\\text.txt"));
HashMap MapObj = (HashMap) inputStream.readObject();
Can someone please tell me what I am doing wrong?
Also when I try to print - System.out.println("Contents: "+ObjectSteam.toString()); I get null.
I am not sure why the program is not reading the file.
Thank You,
Sounds like the file is just invalid...