Class DBFRow

java.lang.Object
io.github.zazalng.entity.DBFRow

public final class DBFRow extends Object
Represents a single record (row) of data from a DBF file.

This class reads and decodes the raw bytes of a record based on the provided DBFField descriptors and stores the results as a map of field names to decoded Java objects.

Since:
1.0.0
Author:
Zazalng
See Also:
  • Constructor Details

    • DBFRow

      public DBFRow(List<DBFField> fields, ByteBuffer buffer, Charset charset)
      Constructs a new DBFRow by reading and decoding the raw bytes from the buffer.
      Parameters:
      fields - The list of field descriptors defining the record structure.
      buffer - The ByteBuffer containing the raw record data, starting with the deletion flag.
      charset - The character set to use for decoding text-based fields.
  • Method Details

    • get

      public Object get(String name)
      Retrieves the decoded value for a field by its name.
      Parameters:
      name - The name of the field (case-sensitive, matching the DBFField name).
      Returns:
      The decoded value as a Java object, or null if the field is not present or the data was null/empty.
    • getValues

      public Map<String,Object> getValues()
      Retrieves the Map Object of this row
      Returns:
      Row information as Map Object
    • asMap

      public Map<String,Object> asMap()
      Returns the contents of the row as an unmodifiable Map. The keys are the field names (String) and the values are the decoded objects (Object).
      Returns:
      An unmodifiable map containing all field names and their decoded values.
    • toString

      public String toString()
      Provides a string representation of the row's values.
      Overrides:
      toString in class Object
      Returns:
      A string representing the map of field names and values.