Package mil.nga.sf.util
Class TextReader
- java.lang.Object
-
- mil.nga.sf.util.TextReader
-
public class TextReader extends Object
Read through text string- Since:
- 2.0.3
- Author:
- osbornb
-
-
Constructor Summary
Constructors Constructor Description TextReader(Reader reader)ConstructorTextReader(String text)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the text readerReadergetReader()Get the readerStringpeekToken()Peek at the next token without reading past itdoublereadDouble()Read a doubleStringreadToken()Read the next token.
-
-
-
Method Detail
-
getReader
public Reader getReader()
Get the reader- Returns:
- reader
-
close
public void close()
Close the text reader
-
readToken
public String readToken() throws IOException
Read the next token. Ignores whitespace until a non whitespace character is encountered. Returns a contiguous block of token characters ( [a-z] | [A-Z] | [0-9] | - | . | + ) or a non whitespace single character.- Returns:
- token
- Throws:
IOException- upon read error
-
peekToken
public String peekToken() throws IOException
Peek at the next token without reading past it- Returns:
- next token
- Throws:
IOException- upon read error
-
readDouble
public double readDouble() throws IOExceptionRead a double- Returns:
- double
- Throws:
IOException- upon read error
-
-