Source of TestRead.java


  1: 
  2: import java.io.*; 
  3: 
  4: public class TestRead {
  5:   public static void main(String[] args) {
  6:     if (args.length > 0) {
  7:       try {
  8:         ObjectRandomAccessFile in = new ObjectRandomAccessFile(args[0], "r"); 
  9:         Object obj; 
 10:         long offset; 
 11:         for (int i = 1; i < args.length; i++) {
 12:           offset = Long.parseLong(args[i]);
 13:           in.seek(offset);  
 14:           obj = in.readObject(); 
 15:           System.out.println(obj + " read at offset " + offset); 
 16:         }
 17:       } catch (Exception e) {}
 18:     }
 19:   }
 20: }