问题
I'm trying to read some information from a file with ObjectInputStream
method.
For some reason, the file does not contain the information after the command executed.
No error appears.
This is my code :
public boolean findUser(String user_id) throws Exception {
try (ObjectInputStream objectInputStream = new ObjectInputStream(new FileInputStream(fILENAME))){
//System.out.println("Adsfasdf");
System.out.println(objectInputStream);
Set<MarkoliaUser> users = (Set<MarkoliaUser>) objectInputStream.readObject();
for(MarkoliaUser user : users)
System.out.println(user.toString());
}
return true;
}
Please advise,
来源:https://stackoverflow.com/questions/62333962/how-to-read-from-file-to-set-with-objectinputstream