1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
public void save ()
{
try
{
RandomAccessFile raf = new RandomAccessFile(NOM_FICH, "rw");
FileChannel fc = raf.getChannel();
fc.map(MapMode.READ_WRITE, 0L, fc.size()); // je ne sais pas a quoi sert cette ligne!!!!
ObjectOutputStream in = new ObjectOutputStream(b)
for (int i=0;i<tab.size();i++)
{
ByteArrayOutputStream b = new ByteArrayOutputStream();
ObjectOutputStream in = new ObjectOutputStream (b);
in.writeObject(tab.get(i));
raf.writeBytes(b.toString());
in.close();
b.close();
}
fc.close();
raf.close();
}
catch (Exception e) {}[/INDENT]
} |
Partager