positionBufferForOffset(buffer, getNextOffset());
/** * Moves the reader to the specified byte offset in the file. Mind that: * * <ul> * <li>it's your responsibility to ensure the offset corresponds to the actual beginning of a * shape struct * <li>once you call this, reading with hasNext/next on sparse shapefiles will be broken (we * don't know anymore at which shape we are) * </ul> * * @param offset * @throws IOException * @throws UnsupportedOperationException */ public void goTo(int offset) throws IOException, UnsupportedOperationException { disableShxUsage(); if (randomAccessEnabled) { positionBufferForOffset(buffer, offset); int oldRecordOffset = record.end; record.end = offset; try { hasNext(false); // don't check for next logical record equality } catch (IOException ioe) { record.end = oldRecordOffset; throw ioe; } } else { throw new UnsupportedOperationException("Random Access not enabled"); } }
positionBufferForOffset(buffer, getNextOffset()); if (currentShape != UNKNOWN) currentShape++;
positionBufferForOffset(buffer, getNextOffset());
/** * Moves the reader to the specified byte offset in the file. Mind that: * <ul> * <li>it's your responsibility to ensure the offset corresponds to the * actual beginning of a shape struct</li> * <li>once you call this, reading with hasNext/next on sparse shapefiles * will be broken (we don't know anymore at which shape we are)</li> * </ul> * * @param offset * @throws IOException * @throws UnsupportedOperationException */ public void goTo(int offset) throws IOException, UnsupportedOperationException { disableShxUsage(); if (randomAccessEnabled) { positionBufferForOffset(buffer, offset); int oldRecordOffset = record.end; record.end = offset; try { hasNext(false); // don't check for next logical record equality } catch (IOException ioe) { record.end = oldRecordOffset; throw ioe; } } else { throw new UnsupportedOperationException("Random Access not enabled"); } }
positionBufferForOffset(buffer, getNextOffset()); if(currentShape != UNKNOWN) currentShape++;