Class IndexFile
- java.lang.Object
-
- org.h2gis.functions.io.shp.internal.IndexFile
-
public class IndexFile extends Object
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'- Author:
- Ian Schneider
- See Also:
- "http://svn.geotools.org/geotools/tags/2.3.1/plugin/shapefile/src/org/geotools/data/shapefile/shp/IndexFile.java"
-
-
Constructor Summary
Constructors Constructor Description IndexFile(FileChannel channel)Load the index file from the given channel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()intgetContentLength(int index)Get the content length of the given record in bytes, not 16 bit words.ShapefileHeadergetHeader()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).intgetRecordCount()Get the number of records in this index.
-
-
-
Constructor Detail
-
IndexFile
public IndexFile(FileChannel channel) throws IOException
Load the index file from the given channel.- Parameters:
channel- 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.
-
close
public void close() throws IOException- Throws:
IOException
-
getRecordCount
public int getRecordCount()
Get the number of records in this index.- Returns:
- The number of records.
-
getOffset
public int getOffset(int index) throws IOExceptionGet 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 IOExceptionGet 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 IOExceptionGet 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
-
-