Class IndexFile

    • Constructor Detail

      • IndexFile

        public IndexFile​(ShpFiles shpFiles,
                         boolean useMemoryMappedBuffer)
                  throws IOException
        Load the index file from the given channel.
        Parameters:
        shpFiles - The channel to read from.
        Throws:
        IOException - If an error occurs.
    • Method Detail

      • getHeader

        public ShapefileHeader getHeader()
        Get the header of this index file.
        Returns:
        The header of the index file.
      • getRecordCount

        public int getRecordCount()
        Get the number of records in this index.
        Returns:
        The number of records.
      • getOffset

        public int getOffset​(int index)
                      throws IOException
        Get the offset of the record (in 16-bit words).
        Parameters:
        index - The index, from 0 to getRecordCount - 1
        Returns:
        The offset in 16-bit words.
        Throws:
        IOException
      • getOffsetInBytes

        public int getOffsetInBytes​(int index)
                             throws IOException
        Get the offset of the record (in real bytes, not 16-bit words).
        Parameters:
        index - The index, from 0 to getRecordCount - 1
        Returns:
        The offset in bytes.
        Throws:
        IOException
      • getContentLength

        public int getContentLength​(int index)
                             throws IOException
        Get the content length of the given record in bytes, not 16 bit words.
        Parameters:
        index - The index, from 0 to getRecordCount - 1
        Returns:
        The lengh in bytes of the record.
        Throws:
        IOException
      • id

        public String id()
        Description copied from interface: FileReader
        An id for the reader. This is only used for debugging.
        Specified by:
        id in interface FileReader
        Returns:
        id for the reader.