protected void indexPoints(InputStream is,long ptr,List<Entry> entries){
  boolean moreRecords=true;
  byte rHdr[]=new byte[SHAPE_RECORD_HEADER_LENGTH];
  int result;
  int nRecords=0;
  int recLengthWords, recLengthBytes;
  long recOffset;
  int shapeType;
  int recBufSize=20;
  byte recBuf[]=new byte[recBufSize];
  double x=0;
  double y=0;
  try {
    while (moreRecords) {
      result=is.read(rHdr,0,SHAPE_RECORD_HEADER_LENGTH);
      if (result < 0) {
        moreRecords=false;
        if (logger.isLoggable(Level.FINE)) {
          logger.fine("Found " + nRecords + " records");
          logger.fine("recBufSize = " + recBufSize);
        }
      }
 else {
        nRecords++;
        recOffset=ptr;
        readBEInt(rHdr,0);
        recLengthWords=readBEInt(rHdr,4);
        recLengthBytes=recLengthWords * 2;
        if (recLengthBytes > recBufSize) {
          if (logger.isLoggable(Level.FINE)) {
            logger.fine("Shapefile SpatialIndex increasing recBufSize to " + recLengthBytes);
          }
          recBufSize=recLengthBytes;
          recBuf=new byte[recBufSize];
        }
        result=is.read(recBuf,0,recLengthBytes);
        shapeType=readLEInt(recBuf,0);
        if (shapeType != SHAPE_TYPE_NULL) {
          x=readLEDouble(recBuf,4);
          y=readLEDouble(recBuf,12);
        }
        ptr+=recLengthBytes + 8;
        Entry entry=new Entry(x,y,x,y,(int)recOffset);
        entries.add(entry);
      }
    }
  }
 catch (  java.io.IOException e) {
    e.printStackTrace();
  }
 finally {
    try {
      is.close();
    }
 catch (    java.io.IOException e) {
    }
  }
}

protected void indexPoints ( InputStream is , long ptr , List < Entry > entries ) { boolean moreRecords = true ; byte rHdr [ ] = new byte [ SHAPE_RECORD_HEADER_LENGTH ] ; int result ; int nRecords = 0 ; int recLengthWords , recLengthBytes ; long recOffset ; int shapeType ; int recBufSize = 20 ; byte recBuf [ ] = new byte [ recBufSize ] ; double x = 0 ; double y = 0 ; try { while ( moreRecords ) { result = is . read ( rHdr , 0 , SHAPE_RECORD_HEADER_LENGTH ) ; if ( result < 0 ) { moreRecords = false ; if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "Found " + nRecords + " records" ) ; logger . fine ( "recBufSize = " + recBufSize ) ; } } else { nRecords ++ ; recOffset = ptr ; readBEInt ( rHdr , 0 ) ; recLengthWords = readBEInt ( rHdr , 4 ) ; recLengthBytes = recLengthWords * 2 ; if ( recLengthBytes > recBufSize ) { if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "Shapefile SpatialIndex increasing recBufSize to " + recLengthBytes ) ; } recBufSize = recLengthBytes ; recBuf = new byte [ recBufSize ] ; } result = is . read ( recBuf , 0 , recLengthBytes ) ; shapeType = readLEInt ( recBuf , 0 ) ; if ( shapeType != SHAPE_TYPE_NULL ) { x = readLEDouble ( recBuf , 4 ) ; y = readLEDouble ( recBuf , 12 ) ; } ptr += recLengthBytes + 8 ; Entry entry = new Entry ( x , y , x , y , ( int ) recOffset ) ; entries . add ( entry ) ; } } } catch ( java . io . IOException e ) { e . printStackTrace ( ) ; } finally { try { is . close ( ) ; } catch ( java . io . IOException e ) { } } }
writes the spatial index for a point shape file .
