import java.io.*; 

public class TestWrite {
  public static void main(String[] args) {
    if (args.length > 0) {
      try {
        ObjectRandomAccessFile out = new ObjectRandomAccessFile(args[0], "rw"); 
        Object[] obj = { "Tic", "Tac", "Toe" }; 
        long offset =0;
        int count;
        for (int i = 0; i < obj.length; i++) {
           count = out.writeObject(obj[i]);
           System.out.println(obj[i] + " written at offset " + offset + " size = " + count);
           offset += count;
        }
      } catch (Exception e) {}
    }
  }
}