テキストファイルから以下のデータを復元したい。問題は、復元できる文字列/行が 1 つだけで、残りのデータを復元できないことです。
コードは次のとおりです。
public static String restore(String filename) throws IOException, ClassNotFoundException
{
FileInputStream fn = new FileInputStream(filename);
ObjectInputStream ob = new ObjectInputStream(fn);
String sample = (String) ob.readObject();
return sample;
}