Package org.locationtech.jts.io
Class WKBHexFileReader
- java.lang.Object
-
- org.locationtech.jts.io.WKBHexFileReader
-
public class WKBHexFileReader extends java.lang.ObjectReads a sequence ofGeometrys in WKBHex format from a text file. Each WKBHex geometry must be on a single line The geometries in the file may be separated by any amount of whitespace and newlines.
-
-
Constructor Summary
Constructors Constructor Description WKBHexFileReader(java.io.File file, WKBReader wkbReader)Creates a new WKBHexFileReader given the File to read from and a WKTReader to use to parse the geometries.WKBHexFileReader(java.io.Reader reader, WKBReader wkbReader)Creates a new WKBHexFileReader, given aReaderto read from.WKBHexFileReader(java.lang.String filename, WKBReader wkbReader)Creates a new WKBHexFileReader, given the name of the file to read from.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanisAtEndOfFile(java.io.BufferedReader bufferedReader)Tests if reader is at EOF.private booleanisAtLimit(java.util.List geoms)java.util.Listread()Reads a sequence of geometries.private java.util.Listread(java.io.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 Detail
-
file
private java.io.File file
-
reader
private java.io.Reader reader
-
wkbReader
private WKBReader wkbReader
-
count
private int count
-
limit
private int limit
-
offset
private int offset
-
MAX_LOOKAHEAD
private static final int MAX_LOOKAHEAD
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WKBHexFileReader
public WKBHexFileReader(java.io.File file, WKBReader wkbReader)Creates a new WKBHexFileReader given the File to read from and a WKTReader to use to parse the geometries.- Parameters:
file- the File to read fromwkbReader- the geometry reader to use
-
WKBHexFileReader
public WKBHexFileReader(java.lang.String filename, WKBReader wkbReader)Creates a new WKBHexFileReader, given the name of the file to read from.- Parameters:
filename- the name of the file to read fromwkbReader- the geometry reader to use
-
WKBHexFileReader
public WKBHexFileReader(java.io.Reader reader, WKBReader wkbReader)Creates a new WKBHexFileReader, given aReaderto read from.- Parameters:
reader- the reader to read fromwkbReader- 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 occurred reading a geometry
-
read
private java.util.List read(java.io.BufferedReader bufferedReader) throws java.io.IOException, ParseException- Throws:
java.io.IOExceptionParseException
-
isAtLimit
private boolean isAtLimit(java.util.List geoms)
-
isAtEndOfFile
private boolean isAtEndOfFile(java.io.BufferedReader bufferedReader) throws java.io.IOExceptionTests if reader is at EOF.- Throws:
java.io.IOException
-
-