IndexedFidWriter implements FileWriter { public void remove() throws IOException { if (current == -1) throw new IOException("Current fid index is null, next must be called before remove"); if (hasNext()) { removes++; current = -1; } } IndexedFidWriter( ShpFiles shpFiles );  IndexedFidWriter( ShpFiles shpFiles, StorageFile storageFile ); private  IndexedFidWriter(); boolean hasNext(); long next(); void close(); void remove(); void write(); boolean isClosed(); String id(); static final int HEADER_SIZE; static final int RECORD_SIZE; static final IndexedFidWriter EMPTY_WRITER; }
@Test public void testRemove() throws MalformedURLException, IOException { FidIndexer.generate(backshp.toURI().toURL()); initWriter(); writer.next(); writer.remove(); for( int i = 2, j = indexFile.getRecordCount(); i < j; i++ ) { assertTrue(writer.hasNext()); assertEquals((long) i, writer.next()); } writer.write(); close(); initWriter(); for( int i = 1, j = indexFile.getRecordCount() - 1; i < j; i++ ) { assertTrue(writer.hasNext()); assertEquals((long) i + 1, writer.next()); } }