私は、serialastionを使ってバイナリファイルにarrayListを保存しました。このデータをバイナリファイルからどのように取得するのですか?で宣言された配列リストJavaのバイナリファイルからデータのArrayListをどのように逆シリアル化するのですか?
public void readInSerialisable() throws IOException
{
FileInputStream fileIn = new FileInputStream("theBKup.ser");
ObjectInputStream in = new ObjectInputStream(fileIn);
try
{
ArrayList readob = (ArrayList)oi.readObject();
allDeps = (ArrayList) in.readObject();
}
catch (IOException exc)
{
System.out.println("didnt work");
}
}
allDepsさ:
この
は私がシリアライズpublic void createSerialisable() throws IOException
{
FileOutputStream fileOut = new FileOutputStream("theBkup.ser");
ObjectOutputStream out = new ObjectOutputStream(fileOut);
out.writeObject(allDeps);
options();
}
のために使用しているコードと私はArrayListのの直列化復元のために使用しようとしています。このコードでありますクラスコンストラクタ。私はこのクラスで宣言されたarrayListにファイルからarrayListを保存しようとしています。
それは何のarraylistですか? –
名前と所在地を持つ部署 – Binyomin
そして 'oi'とは何ですか? –