Class ShapeFileIndexRecord

  • All Implemented Interfaces:
    Comparable<ShapeFileIndexRecord>

    public class ShapeFileIndexRecord
    extends Object
    implements Comparable<ShapeFileIndexRecord>
    This class describes a record inside a shape file index.

    The offset if the position of the first byte of the record inside the file. Basically, the first record is supporsed to have offset to 100 (ie, ESRIFileUtil.HEADER_BYTES). Because the ESRI standard stores this value as 16-bit words, it means that the offset is always a multiple of 2. If this record is created with an offset which is not a multiple of 2, this object will assumed the upper multiple as length.

    The length is the size of the content's part of the associated shape file entry. Because the ESRI standard stores this value as 16-bit words, it means that the length is always a multiple of 2. If this record is created with a length which is not a multiple of 2, an assertion may be invalidated in the constructor of this object (don't forget to activate assertions in your JVM to have them).

    The specification of the ESRI Shape file format is described in the July 98 specification document.

    Since:
    14.0
    Version:
    17.0 2020-01-04 14:41:52
    Author:
    Stéphane GALLAND, Olivier LAMOTTE
    Maven Group Id:
    org.arakhne.afc.advanced
    Maven Artifact Id:
    shapefile
    • Constructor Detail

      • ShapeFileIndexRecord

        ShapeFileIndexRecord​(int recordOffset,
                             int length,
                             boolean recordContentSize,
                             int index)
        Constructor.
        Parameters:
        recordOffset - is the offset of the record, including the file header.
        length - the length of the record.
        recordContentSize - if true indicates that the given length is the length of the record's content (without record header), if false indicates that the given length is the length of the whole record (record header included).
        index - is the index of the record.
    • Method Detail

      • hashCode

        @Pure
        public int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        @Pure
        public boolean equals​(Object obj)
        Overrides:
        equals in class Object
      • getOffsetInFile

        @Pure
        public int getOffsetInFile()
        Replies the offset of the record (in bytes) from the start of the whole shape file (file header included).
        Returns:
        the offset from the start of the file.
        See Also:
        getOffsetInContent()
      • getOffsetInContent

        @Pure
        public int getOffsetInContent()
        Replies the offset of the record (in bytes) from the start of the content part of the shape file (file header excluded).
        Returns:
        the offset from the start of the file.
        See Also:
        getOffsetInFile()
      • getEntireRecordLength

        @Pure
        public int getEntireRecordLength()
        Replies the length of the record (in bytes) including the record's header.
        Returns:
        the length of the record, including the record header part
        See Also:
        getRecordContentLength()
      • getRecordContentLength

        @Pure
        public int getRecordContentLength()
        Replies the length of the record (in bytes) excluding the record's header.
        Returns:
        the length of the record, excluding the record header part
        See Also:
        getEntireRecordLength()
      • getRecordIndex

        @Pure
        public int getRecordIndex()
        Replies index of the record if it is known, or -1 if unknown.
        Returns:
        the record index or -1 if unknown.