try {
SerializableRandomAccessFile sraf = new
SerializableRandomAccessFile(args[0], args[1]);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(sraf);
oos.close();
System.out.println("Wrote object!");
ByteArrayInputStream bis = new
ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
Object o = ois.readObject();
System.out.println("Read object!");
}
catch (Exception e) {
System.err.println(e);
}