Record Class ColumnChunk

java.lang.Object
java.lang.Record
dev.hardwood.metadata.ColumnChunk
Record Components:
metaData - column metadata
offsetIndexOffset - file offset of the offset index for this column chunk, or null if absent
offsetIndexLength - length of the offset index in bytes, or null if absent
columnIndexOffset - file offset of the column index for this column chunk, or null if absent
columnIndexLength - length of the column index in bytes, or null if absent
filePath - file holding this chunk's data under the legacy split-file layout, or the empty string — never null — when the data sits in the file being read, as it does in every layout Hardwood can decode. Reading a chunk with a non-empty filePath fails; its metadata is still readable

public record ColumnChunk(ColumnMetaData metaData, Long offsetIndexOffset, Integer offsetIndexLength, Long columnIndexOffset, Integer columnIndexLength, String filePath) extends Record
Column chunk metadata.
See Also:
  • Constructor Details

    • ColumnChunk

      public ColumnChunk(ColumnMetaData metaData, Long offsetIndexOffset, Integer offsetIndexLength, Long columnIndexOffset, Integer columnIndexLength, String filePath)
      A null filePath is normalised to the empty string, so the two ways of saying "this file" — the field absent and the field set to the empty string the spec allows — have one representation, and requireSameFile() has nothing to guard against.
  • Method Details

    • requireSameFile

      public void requireSameFile() throws IOException

      Fails unless this chunk's data sits in the file being read.

      A non-empty filePath puts the data in a different file — the legacy split-file layout, which Hardwood does not read. Every offset in the chunk's metadata then addresses that other file, so following data_page_offset here would decode whatever happens to sit at that offset in this one and hand it back as data.

      This is checked where the data is about to be read rather than while parsing the footer, so that the metadata of such a file stays inspectable.

      Throws:
      IOException - if this chunk's data lives in another file
    • chunkStartOffset

      public long chunkStartOffset()
      Computes the absolute file offset where a column chunk's data starts.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • metaData

      public ColumnMetaData metaData()
      Returns the value of the metaData record component.
      Returns:
      the value of the metaData record component
    • offsetIndexOffset

      public Long offsetIndexOffset()
      Returns the value of the offsetIndexOffset record component.
      Returns:
      the value of the offsetIndexOffset record component
    • offsetIndexLength

      public Integer offsetIndexLength()
      Returns the value of the offsetIndexLength record component.
      Returns:
      the value of the offsetIndexLength record component
    • columnIndexOffset

      public Long columnIndexOffset()
      Returns the value of the columnIndexOffset record component.
      Returns:
      the value of the columnIndexOffset record component
    • columnIndexLength

      public Integer columnIndexLength()
      Returns the value of the columnIndexLength record component.
      Returns:
      the value of the columnIndexLength record component
    • filePath

      public String filePath()
      Returns the value of the filePath record component.
      Returns:
      the value of the filePath record component