0
我想在现有文件中附加Serializable对象,但显然它会删除以前存储的对象。追加对象现有文件
对于参数文件F,我发送新文件(文件路径)。也许我的错误是从那里?
谢谢你的帮助。
public static void wrinting(File[] tab, File f) throws Exception{
ArrayList<ImageClass> obj = imagesArray(tab);
ObjectOutputStream oos;
try {
oos = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(f)));
for (ImageClass i : obj) {
oos.writeObject(i);
}
oos.close();
} catch (IOException e) {
e.printStackTrace();
}
}