FileOutputStream f= new FileOutputStream("f"); f.write('a'); f.write('b'); f.close(); f= FileOutputStream("f"); f.write('c'); f.close();
Vector v= new Vector(); v.add(new Integer(1); ObjectOutputStream s= new ObjectOutputStream(new FileOutputStream("f")); s.writeObject(v); s.close();
ObjectInputStream s2= new ObjectInputStream(new FileInputStream("f")); Vector v2= (Vector)s2.readObject(); s2.close(); v2.add(new Integer(2); v2.add(new Integer(3); s= new ObjectOutputStream(new FileOutputStream("f")); s.writeObject(v); s.close();
s2= new ObjectInputStream(new FileInputStream("f")); v2= (Vector)s2.readObject(); s2.close();
ObjectInputStream in = new ObjectInputStream(new FileInputStream("test.pop")); v=(Vector)in.readObject(); in.close(); int i=0; for (Enumeration enum = v.elements(); enum.hasMoreElements();) { h = (Hashtable)enum.nextElement(); c = (Compte2) h.get(new Integer(i+1)); c.affiche(); }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question