public class IndexedFidWriter extends Object implements FileWriter, AutoCloseable
Modifier and Type | Field and Description |
---|---|
static IndexedFidWriter |
EMPTY_WRITER |
static int |
HEADER_SIZE |
static int |
RECORD_SIZE |
Constructor and Description |
---|
IndexedFidWriter(ShpFiles shpFiles)
Creates a new instance and writes the fids to a storage file which is replaces the original
on close().
|
IndexedFidWriter(ShpFiles shpFiles,
StorageFile storageFile)
Create a new instance
Note: StorageFile.replaceOriginal() is NOT called. |
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
hasNext() |
String |
id()
An id for the writer.
|
boolean |
isClosed() |
long |
next() |
void |
remove()
Increments the fidIndex by 1.
|
void |
write()
Writes the current fidIndex.
|
public static final int HEADER_SIZE
public static final int RECORD_SIZE
public static final IndexedFidWriter EMPTY_WRITER
public IndexedFidWriter(ShpFiles shpFiles) throws IOException
shpFiles
- The shapefiles to usedIOException
public IndexedFidWriter(ShpFiles shpFiles, StorageFile storageFile) throws IOException
StorageFile.replaceOriginal()
is NOT called. Call IndexedFidWriter(ShpFiles)
for that behaviour.shpFiles
- The shapefiles to usedstorageFile
- the storage file that will be written to. It will NOT be closed.IOException
public boolean hasNext() throws IOException
IOException
public long next() throws IOException
IOException
public void close() throws IOException
close
in interface AutoCloseable
IOException
public void remove() throws IOException
Indicates that a feature was removed from the location. This is intended to ensure that FIDs stay constant over time. Consider the following case of 5 features.
when feature 3 is removed/deleted the following usage of the write should take place:
IOException
- if current fid index is nullpublic void write() throws IOException
next()
moves forward in the file.IOException
next()
,
remove()
public boolean isClosed()
public String id()
FileWriter
id
in interface FileReader
id
in interface FileWriter
Copyright © 1996–2023 Geotools. All rights reserved.