|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinput.WKTReader
public class WKTReader
Class for reading "Well-known text syntax" files. See e.g.
Wikipedia for
WKT syntax details. For example, Open JUMP
GIS program can save compatible data from many other formats.
Field Summary | |
---|---|
static java.lang.String |
LINESTRING
known WKT type LINESTRING |
static java.lang.String |
MULTILINESTRING
known WKT type MULTILINESTRING |
static java.lang.String |
POINT
known WKT type POINT |
Constructor Summary | |
---|---|
WKTReader()
|
Method Summary | |
---|---|
protected void |
init(java.io.Reader input)
Initialize the reader to use a certain input reader |
protected boolean |
isDone()
Returns true if the whole file has been read |
protected boolean |
isKnownType(java.lang.String type)
Returns true if type is one of the known WKT types |
protected java.lang.String |
nextType()
Returns the next type read from the reader given at init or null if no more types can be read |
protected java.util.List<Coord> |
parseLineString(java.lang.String line)
Parses coordinate tuples from "LINESTRING" lines |
protected java.util.List<java.util.List<Coord>> |
parseMultilinestring()
Parses a MULTILINESTRING statement that has nested linestrings from the current reader |
protected Coord |
parsePoint()
Parses a WKT point data from the intialized reader |
java.util.List<java.util.List<Coord>> |
readLines(java.io.File file)
Read line (LINESTRING) data from a file |
java.lang.String |
readNestedContents()
Returns nested contents from the reader given at init |
java.lang.String |
readNestedContents(java.io.Reader r)
Reads everything from the first opening parenthesis until line that ends to a closing parenthesis and returns the contents in one string |
java.util.List<Coord> |
readPoints(java.io.File file)
Read point data from a file |
java.util.List<Coord> |
readPoints(java.io.Reader r)
Read point data from a Reader |
protected java.lang.String |
readWord(java.io.Reader r)
Reads a "word", ie whitespace delimited string of characters, from the reader |
protected void |
setDone(boolean done)
Sets the "is file read" state |
protected char |
skipAllWhitespace(java.io.Reader r)
Skips all consecutive whitespace characters from reader |
protected void |
skipUntil(java.io.Reader r,
char until)
Reads and skips all characters until character "until" is read or end of stream is reached. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String LINESTRING
public static final java.lang.String MULTILINESTRING
public static final java.lang.String POINT
Constructor Detail |
---|
public WKTReader()
Method Detail |
---|
public java.util.List<Coord> readPoints(java.io.File file) throws java.io.IOException
file
- The file to read points from
java.io.IOException
- if something went wrong while readingpublic java.util.List<Coord> readPoints(java.io.Reader r) throws java.io.IOException
r
- The Reader to read points from
java.io.IOException
- if something went wrong while readingpublic java.util.List<java.util.List<Coord>> readLines(java.io.File file) throws java.io.IOException
file
- The file to read data from
java.io.IOException
- if something went wrong while readingprotected void init(java.io.Reader input)
input
- The input to useprotected java.lang.String nextType() throws java.io.IOException
java.io.IOException
protected boolean isKnownType(java.lang.String type)
type
- The type to check
protected java.lang.String readWord(java.io.Reader r) throws java.io.IOException
r
- Reader to read the characters from
java.io.IOException
protected java.util.List<java.util.List<Coord>> parseMultilinestring() throws java.io.IOException
java.io.IOException
protected Coord parsePoint() throws java.io.IOException
java.io.IOException
- if couldn't parse coordinate valuesprotected void skipUntil(java.io.Reader r, char until) throws java.io.IOException
r
- Reader to read characters fromuntil
- What character to expect
java.io.IOException
protected char skipAllWhitespace(java.io.Reader r) throws java.io.IOException
r
- Reader where the whitespace is skipped
java.io.IOException
public java.lang.String readNestedContents(java.io.Reader r) throws java.io.IOException
r
- Reader to read the input from
java.io.IOException
public java.lang.String readNestedContents() throws java.io.IOException
java.io.IOException
readNestedContents(Reader)
protected java.util.List<Coord> parseLineString(java.lang.String line)
line
- String that contains the whole "LINESTRING"'s content
protected boolean isDone()
protected void setDone(boolean done)
done
- If true, reading is done
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |