public abstract class AbstractObjParser extends Object
Modifier | Constructor and Description |
---|---|
protected |
AbstractObjParser(SimpleTextParser parser)
Construct a new instance for parsing OBJ content from the given text parser.
|
Modifier and Type | Method and Description |
---|---|
void |
discardDataLine()
Discard remaining content on the current data line, taking line continuation characters into
account.
|
protected SimpleTextParser |
discardDataLineWhitespace()
Discard whitespace on the current data line, taking line continuation characters into account.
|
String |
getCurrentKeyword()
Get the current keyword, meaning the keyword most recently parsed via the
nextKeyword()
method. |
protected SimpleTextParser |
getTextParser()
Get the text parser for the instance.
|
protected abstract void |
handleKeyword(String keyword)
Method called when a keyword is encountered in the parsed OBJ content.
|
protected boolean |
nextDataLineContent()
Discard whitespace on the current data line and return true if any more characters
remain on the line.
|
protected double |
nextDouble()
Get the next whitespace-delimited double on the current data line.
|
boolean |
nextKeyword()
Advance the parser to the next keyword, returning true if a keyword has been found
and false if the end of the content has been reached.
|
String |
readDataLine()
Read the remaining content on the current data line, taking line continuation characters into
account.
|
double[] |
readDoubles()
Read whitespace-delimited double values from the current data line.
|
Vector3D |
readVector()
Read a whitespace-delimited 3D vector from the current data line.
|
protected AbstractObjParser(SimpleTextParser parser)
parser
- text parser to read content frompublic String getCurrentKeyword()
nextKeyword()
method. Null is returned if parsing has not started or the end of the content has been reached.public boolean nextKeyword()
IllegalStateException
- if invalid content is foundUncheckedIOException
- if an I/O error occurspublic String readDataLine()
UncheckedIOException
- if an I/O error occurspublic void discardDataLine()
UncheckedIOException
- if an I/O error occurspublic Vector3D readVector()
IllegalStateException
- if parsing failsUncheckedIOException
- if an I/O error occurspublic double[] readDoubles()
IllegalStateException
- if double values are not able to be parsedUncheckedIOException
- if an I/O error occursprotected SimpleTextParser getTextParser()
protected abstract void handleKeyword(String keyword)
keyword
- keyword encountered in the OBJ contentIllegalStateException
- if the given keyword is invalidUncheckedIOException
- if an I/O error occursprotected SimpleTextParser discardDataLineWhitespace()
UncheckedIOException
- if an I/O error occursprotected boolean nextDataLineContent()
UncheckedIOException
- if an I/O error occursprotected double nextDouble()
IllegalStateException
- if a double value is not able to be parsedUncheckedIOException
- if an I/O error occursCopyright © 2016–2021 The Apache Software Foundation. All rights reserved.