public class MainClass { public static void main (String args[]) throws Exception {
Vector v = new Vector(Arrays.asList("a","b","c"));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(v);
oos.close();
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bais);
Vector v2 = (Vector)ois.readObject();
Enumeration e = v.elements(); while (e.hasMoreElements()) {
System.out.println(e.nextElement());
}
}
}