Package org.meteoinfo.jts.io
Class WKTFileReader
- java.lang.Object
-
- org.meteoinfo.jts.io.WKTFileReader
-
public class WKTFileReader extends java.lang.ObjectReads a sequence ofGeometrys in WKT format from a text file. The geometries in the file may be separated by any amount of whitespace and newlines.
-
-
Constructor Summary
Constructors Constructor Description WKTFileReader(java.io.File file, WKTReader wktReader)Creates a new WKTFileReader given the File to read from and a WKTReader to use to parse the geometries.WKTFileReader(java.io.Reader reader, WKTReader wktReader)Creates a new WKTFileReader, given aReaderto read from.WKTFileReader(java.lang.String filename, WKTReader wktReader)Creates a new WKTFileReader, given the name of the file to read from.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Listread()Reads a sequence of geometries.voidsetLimit(int limit)Sets the maximum number of geometries to read.voidsetOffset(int offset)Sets the number of geometries to skip before storing.
-
-
-
Constructor Detail
-
WKTFileReader
public WKTFileReader(java.io.File file, WKTReader wktReader)Creates a new WKTFileReader given the File to read from and a WKTReader to use to parse the geometries.- Parameters:
file- the File to read fromwktReader- the geometry reader to use
-
WKTFileReader
public WKTFileReader(java.lang.String filename, WKTReader wktReader)Creates a new WKTFileReader, given the name of the file to read from.- Parameters:
filename- the name of the file to read fromwktReader- the geometry reader to use
-
WKTFileReader
public WKTFileReader(java.io.Reader reader, WKTReader wktReader)Creates a new WKTFileReader, given aReaderto read from.- Parameters:
reader- the reader to read fromwktReader- the geometry reader to use
-
-
Method Detail
-
setLimit
public void setLimit(int limit)
Sets the maximum number of geometries to read.- Parameters:
limit- the maximum number of geometries to read
-
setOffset
public void setOffset(int offset)
Sets the number of geometries to skip before storing.- Parameters:
offset- the number of geometries to skip
-
read
public java.util.List read() throws java.io.IOException, ParseExceptionReads a sequence of geometries. If an offset is specified, geometries read up to the offset count are skipped. If a limit is specified, no more than limit geometries are read.- Returns:
- the list of geometries read
- Throws:
java.io.IOException- if an I/O exception was encounteredParseException- if an error occured reading a geometry
-
-