Class TableFileWriter

java.lang.Object
ch.so.agi.filegdb.write.TableFileWriter
All Implemented Interfaces:
AutoCloseable

public final class TableFileWriter extends Object implements 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 Details

    • setCancellation

      public void setCancellation(Runnable check)
    • append

      public static TableFileWriter append(Path path, boolean createIndex, Map<String,FieldMetadata> metadata) throws IOException
      Opens 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

      public Path path()
    • rowCount

      public long rowCount()
    • totalRecordCount

      public long totalRecordCount()
    • fields

      public List<FileGdbField> fields()
    • addField

      public void addField(FileGdbField field)
    • addGeometryField

      public void addGeometryField(FileGdbGeomField field)
    • writeFieldDescriptors

      public void writeFieldDescriptors() throws IOException
      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 writer
      geometry - geometry for the geometry field, may be null when the field is nullable
      Throws:
      IOException
    • sync

      public void sync() throws IOException
      Patches the header and the row index trailer.
      Throws:
      IOException
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException