Package org.geotools.data.shapefile.shp
Class IndexFile
Object
IndexFile
- All Implemented Interfaces:
AutoCloseable,FileReader
IndexFile parser for .shx files.
For now, the creation of index files is done in the ShapefileWriter. But this can be used to access the index.
For details on the index file, see
"ESRI(r) Shapefile - A Technical Description"
* 'An ESRI White Paper . May 1997'
For now, the creation of index files is done in the ShapefileWriter. But this can be used to access the index.
For details on the index file, see
"ESRI(r) Shapefile - A Technical Description"
* 'An ESRI White Paper . May 1997'
- Author:
- Ian Schneider
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected voidfinalize()intgetContentLength(int index) Get the content length of the given record in bytes, not 16 bit words.Get the header of this index file.intgetOffset(int index) Get the offset of the record (in 16-bit words).intgetOffsetInBytes(int index) Get the offset of the record (in real bytes, not 16-bit words).intGet the number of records in this index.id()An id for the reader.
-
Constructor Details
-
IndexFile
Load the index file from the given channel.- Parameters:
shpFiles- The channel to read from.- Throws:
IOException- If an error occurs.
-
-
Method Details
-
getHeader
Get the header of this index file.- Returns:
- The header of the index file.
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-
finalize
-
getRecordCount
public int getRecordCount()Get the number of records in this index.- Returns:
- The number of records.
-
getOffset
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
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
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
Description copied from interface:FileReaderAn id for the reader. This is only used for debugging.- Specified by:
idin interfaceFileReader- Returns:
- id for the reader.
-