ShapefileReader class
The general use of this class is:
FileChannel in = new FileInputStream("thefile.dbf").getChannel();
ShapefileReader r = new ShapefileReader( in ) while (r.hasNext()) { Geometry
shape = (Geometry) r.nextRecord().shape() // do stuff } r.close();
You don't have to immediately ask for the shape from the record. The record will
contain the bounds of the shape and will only read the shape when the shape() method is called.
This ShapefileReader.Record is the same object every time, so if you need data from the Record,
be sure to copy it.
@author jamesm @author aaime @author Ian Schneider
Constructors
- ShapefileReader(AFileReader channel, AFileReader? shxChannel, {bool strict = false, GeometryFactory? geometryFactory, bool onlyRandomAccess = false})
- Creates a new instance of ShapeFile.
Properties
- buffer ↔ LByteBuffer
-
getter/setter pair
- channel ↔ AFileReader
-
getter/setter pair
- currentOffset ↔ int
-
getter/setter pair
- currentShape ↔ int
-
getter/setter pair
- fileShapeType ↔ ShapeType
-
getter/setter pair
- flatGeometry ↔ bool
-
getter/setter pair
- geometryFactory ↔ GeometryFactory?
-
getter/setter pair
- handler ↔ ShapeHandler?
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- header ↔ ShapefileHeader
-
getter/setter pair
- headerTransfer ↔ LByteBuffer
-
getter/setter pair
- onlyRandomAccess ↔ bool
-
getter/setter pair
- randomAccessEnabled ↔ bool
-
getter/setter pair
- record ↔ Record?
-
getter/setter pair
- recordEnd ↔ int
-
getter/setter pair
- recordNumber ↔ int
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shxChannel ↔ AFileReader?
-
getter/setter pair
- shxReader ↔ IndexFile?
-
getter/setter pair
- strict ↔ bool
-
getter/setter pair
Methods
-
close(
) → void - Clean up any resources. Closes the channel.
-
disableShxUsage(
) → void - Disables .shx file usage. By doing so you drop support for sparse shapefiles, the .shp will have to be without holes, all the valid shapefile records will have to be contiguous.
-
ensureCapacity(
LByteBuffer buffer, int size) → LByteBuffer -
getCount(
int count) → Future< int> - Parses the shpfile counting the records.
-
getHeader(
) → ShapefileHeader - Get the header. Its parsed in the constructor.
-
getNextOffset(
) → Future< int> -
goTo(
int offset) → Future< void> - Moves the reader to the specified byte offset in the file. Mind that:
-
hasNext(
) → Future< bool> - If there exists another record. Currently checks the stream for the presence of 8 more bytes, the length of a record. If this is true and the record indicates the next logical record number, there exists more records.
-
hasNextCheck(
bool checkRecno) → Future< bool> - If there exists another record. Currently checks the stream for the presence of 8 more bytes, the length of a record. If this is true and the record indicates the next logical record number (if checkRecord == true), there exists more records.
-
id(
) → String -
init(
bool strict, GeometryFactory gf) → Future< void> -
nextRecord(
) → Future< Record?> - Fetch the next record information.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
open(
) → Future< void> -
positionBufferForOffset(
LByteBuffer buf, int offset) → Future< void> - Transfer (by bytes) the data at the current record to the ShapefileWriter.
-
recordAt(
int offset) → Future< Record?> - Sets the current location of the byteStream to offset and returns the next record. Usually used in conjuctions with the shx file or some other index file. Mind that:
-
setFlatGeometry(
bool flatGeometry) → void -
setHandler(
ShapeHandler handler) → void - @param handler The handler to set. */
-
shapeAt(
int offset) → dynamic - Returns the shape at the specified byte distance from the beginning of the file. Mind that:
-
supportsRandomAccess(
) → bool -
toBufferOffset(
int offset) → int - Converts file offset to buffer offset
-
toFileOffset(
int offset) → int - Converts buffer offset to file offset
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited