IndexedFidWriter implements FileWriter { public void write() throws IOException { if (current == -1) throw new IOException("Current fid index is null, next must be called before write()"); if (writeBuffer == null) { allocateBuffers(); } if (writeBuffer.remaining() < RECORD_SIZE) { drain(); } writeBuffer.putLong(current); writeBuffer.putInt(recordIndex); recordIndex++; 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 testWrite() throws IOException { initWriter(); for( int i = 0; i < 5; i++ ) { writer.next(); writer.write(); } initWriter(); for( int i = 1; i <= 5; i++ ) { assertTrue(writer.hasNext()); assertEquals((long) i, writer.next()); } }