Package ch.so.agi.filegdb.write
Class TableFileWriter
java.lang.Object
ch.so.agi.filegdb.write.TableFileWriter
- All Implemented Interfaces:
AutoCloseable
Creates and fills a
.gdbtable file with its .gdbtablx row index.
Ported from GDAL OpenFileGDB (filegdbtable_write.cpp,
filegdbtable_write_fields.cpp). The writer supports sequential object ids, no free list, no
attribute indexes and no updates. Optional native spatial indexes are built at close. Fields must
be added before the first row is written.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddField(FileGdbField field) voidaddGeometryField(FileGdbGeomField field) static TableFileWriterappend(Path path, boolean createIndex, Map<String, FieldMetadata> metadata) Opens a physical table in a private edit workspace.static TableFileWritervoidclose()static TableFileWritercreate(Path tablePath, ch.so.agi.filegdb.geometry.GeometryKind geometryKind, boolean hasZ, boolean hasM) fields()path()longrowCount()voidsetCancellation(Runnable check) voidsetSpatialIndex(boolean enabled) voidsync()Patches the header and the row index trailer.longvoidWrites the field descriptor section and prepares the table for rows.longWrites one feature.
-
Method Details
-
setCancellation
-
append
public static TableFileWriter append(Path path, boolean createIndex, Map<String, FieldMetadata> metadata) throws IOExceptionOpens a physical table in a private edit workspace. Does not truncate existing rows.- Throws:
IOException
-
append
public static TableFileWriter append(Path path, boolean createIndex, Map<String, FieldMetadata> metadata, Runnable cancellation) throws IOException- Throws:
IOException
-
create
public static TableFileWriter create(Path tablePath, ch.so.agi.filegdb.geometry.GeometryKind geometryKind, boolean hasZ, boolean hasM) throws IOException - Throws:
IOException
-
setSpatialIndex
public void setSpatialIndex(boolean enabled) -
path
-
rowCount
public long rowCount() -
totalRecordCount
public long totalRecordCount() -
fields
-
addField
-
addGeometryField
-
writeFieldDescriptors
Writes the field descriptor section and prepares the table for rows.- Throws:
IOException
-
writeRow
public long writeRow(Object[] attributeValues, ch.so.agi.filegdb.geometry.FileGdbGeometry geometry) throws IOException Writes one feature.- Parameters:
attributeValues- values aligned with the attribute fields added to this writergeometry- geometry for the geometry field, may be null when the field is nullable- Throws:
IOException
-
sync
Patches the header and the row index trailer.- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-