|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.h2gis.drivers.shp.internal.ShapefileReader
public class ShapefileReader
The general use of this class is: 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.
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();
| Constructor Summary | |
|---|---|
ShapefileReader(FileChannel channel)
Creates a new instance of ShapeFile. |
|
| Method Summary | |
|---|---|
void |
close()
Clean up any resources. |
com.vividsolutions.jts.geom.Geometry |
geomAt(int offset)
Fetch the next record information. |
ShapefileHeader |
getHeader()
Get the header. |
static ShapefileHeader |
readHeader(ReadableByteChannel channel)
A short cut for reading the header from the given channel. |
void |
setHandler(ShapeHandler handler)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ShapefileReader(FileChannel channel)
throws IOException,
ShapefileException
channel - The ReadableByteChannel this reader will use.
IOException - If problems arise.
ShapefileException - If for some reason the file contains invalid records.| Method Detail |
|---|
public static ShapefileHeader readHeader(ReadableByteChannel channel)
throws IOException
channel - The channel to read from.
IOException - If problems arise.public ShapefileHeader getHeader()
public void close()
throws IOException
IOException - If errors occur while closing the channel.
public com.vividsolutions.jts.geom.Geometry geomAt(int offset)
throws IOException
offset -
IOExceptionpublic void setHandler(ShapeHandler handler)
handler - The handler to set.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||