public void load(DataInput rafIn) throws IOException, MaryConfigurationException {
  int numIdx=rafIn.readInt();
  idxInterval=rafIn.readInt();
  if (idxInterval <= 0) {
    throw new MaryConfigurationException("read negative index interval -- file seems corrupt");
  }
  bytePtrs=new long[numIdx];
  timePtrs=new long[numIdx];
  int numBytesToRead=16 * numIdx + 16;
  byte[] data=new byte[numBytesToRead];
  rafIn.readFully(data);
  DataInput bufIn=new DataInputStream(new ByteArrayInputStream(data));
  for (int i=0; i < numIdx; i++) {
    bytePtrs[i]=bufIn.readLong();
    timePtrs[i]=bufIn.readLong();
    if (i > 0) {
      if (bytePtrs[i] < bytePtrs[i - 1] || timePtrs[i] < timePtrs[i - 1]) {
        throw new MaryConfigurationException("File seems corrupt: Pointer positions in index fields are not strictly monotonously rising");
      }
    }
  }
  bufIn.readLong();
  bufIn.readLong();
}

public void load ( DataInput rafIn ) throws IOException , MaryConfigurationException { int numIdx = rafIn . readInt ( ) ; idxInterval = rafIn . readInt ( ) ; if ( idxInterval <= 0 ) { throw new MaryConfigurationException ( "read negative index interval -- file seems corrupt" ) ; } bytePtrs = new long [ numIdx ] ; timePtrs = new long [ numIdx ] ; int numBytesToRead = 16 * numIdx + 16 ; byte [ ] data = new byte [ numBytesToRead ] ; rafIn . readFully ( data ) ; DataInput bufIn = new DataInputStream ( new ByteArrayInputStream ( data ) ) ; for ( int i = 0 ; i < numIdx ; i ++ ) { bytePtrs [ i ] = bufIn . readLong ( ) ; timePtrs [ i ] = bufIn . readLong ( ) ; if ( i > 0 ) { if ( bytePtrs [ i ] < bytePtrs [ i - 1 ] || timePtrs [ i ] < timePtrs [ i - 1 ] ) { throw new MaryConfigurationException ( "File seems corrupt: Pointer positions in index fields are not strictly monotonously rising" ) ; } } } bufIn . readLong ( ) ; bufIn . readLong ( ) ; }
method which loads an index from a data input ( random access file or data input stream ) .
