Package org.locationtech.jts.io
Class WKTFileReader
java.lang.Object
org.locationtech.jts.io.WKTFileReader
Reads a sequence of
Geometrys in WKT format
from a text file.
The geometries in the file may be separated by any amount
of whitespace and newlines.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWKTFileReader(File file, WKTReader wktReader) Creates a new WKTFileReader given the File to read from and a WKTReader to use to parse the geometries.WKTFileReader(Reader reader, WKTReader wktReader) Creates a new WKTFileReader, given aReaderto read from.WKTFileReader(String filename, WKTReader wktReader) Creates a new WKTFileReader, given the name of the file to read from. -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanisAtEndOfFile(BufferedReader bufferedReader) Tests if reader is at EOF.private booleanread()Reads a sequence of geometries.private Listread(BufferedReader bufferedReader) voidsetLimit(int limit) Sets the maximum number of geometries to read.voidsetOffset(int offset) Sets the number of geometries to skip before storing.
-
Field Details
-
file
-
reader
-
wktReader
-
count
private int count -
limit
private int limit -
offset
private int offset -
MAX_LOOKAHEAD
private static final int MAX_LOOKAHEAD- See Also:
-
-
Constructor Details
-
WKTFileReader
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
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
Creates a new WKTFileReader, given aReaderto read from.- Parameters:
reader- the reader to read fromwktReader- the geometry reader to use
-
-
Method Details
-
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
Reads 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:
IOException- if an I/O exception was encounteredParseException- if an error occurred reading a geometry
-
read
- Throws:
IOExceptionParseException
-
isAtLimit
-
isAtEndOfFile
Tests if reader is at EOF.- Throws:
IOException
-