|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectFormat
AbstractParser
public abstract class AbstractParser
Base class for Well Know Text (WKT) parser.
modules/library/referencing (gt-referencing.jar)
Nested Class Summary |
---|
Nested classes/interfaces inherited from class Format |
---|
Format.Field |
Constructor Summary | |
---|---|
AbstractParser(Symbols symbols)
Constructs a parser using the specified set of symbols. |
Method Summary | |
---|---|
StringBuffer |
format(Object object,
StringBuffer toAppendTo,
FieldPosition pos)
Format the specified object as a Well Know Text. |
Citation |
getAuthority()
Returns the preferred authority for formatting WKT entities. |
protected Element |
getTree(String text,
ParsePosition position)
Returns a tree of Element for the specified text. |
String |
getWarning()
If a warning occured during the last WKT formatting, returns the warning. |
boolean |
isColorEnabled()
Returns true if syntax coloring is enabled. |
protected abstract Object |
parse(Element element)
Parses the next element in the specified Well Know Text (WKT) tree. |
Object |
parseObject(String text)
Parses a Well Know Text (WKT). |
Object |
parseObject(String text,
ParsePosition position)
Parses a Well Know Text (WKT). |
void |
reformat(BufferedReader in,
Writer out,
PrintWriter err)
Read WKT strings from an input stream and reformat them to the specified output stream. |
void |
setAuthority(Citation authority)
Set the preferred authority for formatting WKT entities. |
void |
setColorEnabled(boolean enabled)
Enables or disables syntax coloring on ANSI X3.64 (aka ECMA-48 and ISO/IEC 6429) compatible terminal. |
Methods inherited from class Format |
---|
clone, format, formatToCharacterIterator |
Methods inherited from class Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractParser(Symbols symbols)
symbols
- The set of symbols to use.Method Detail |
---|
public Citation getAuthority()
format
methods will uses the name specified
by this authority, if available.
public void setAuthority(Citation authority)
format
methods will uses the name specified
by this authority, if available.
authority
- The new authority.public boolean isColorEnabled()
true
if syntax coloring is enabled.
By default, syntax coloring is disabled.
true
if syntax coloring are enabled.public void setColorEnabled(boolean enabled)
Format.format(Object)
tries to highlight most of the elements compared by
CRS.equalsIgnoreMetadata(java.lang.Object, java.lang.Object)
.
enabled
- true
for enabling syntax coloring.public final Object parseObject(String text) throws ParseException
parseObject
in class Format
text
- The text to be parsed.
ParseException
- if the string can't be parsed.public final Object parseObject(String text, ParsePosition position)
parseObject
in class Format
text
- The text to be parsed.position
- The position to start parsing from.
protected abstract Object parse(Element element) throws ParseException
element
- The element to be parsed.
ParseException
- if the element can't be parsed.protected final Element getTree(String text, ParsePosition position) throws ParseException
Element
for the specified text.
text
- The text to parse.position
- In input, the position where to start parsing from.
In output, the first character after the separator.
ParseException
- If an parsing error occured while creating the tree.public StringBuffer format(Object object, StringBuffer toAppendTo, FieldPosition pos)
format
in class Format
object
- The object to format.toAppendTo
- Where the text is to be appended.pos
- An identification of a field in the formatted text.getWarning()
public void reformat(BufferedReader in, Writer out, PrintWriter err) throws IOException
in
- The input stream.out
- The output stream.err
- The error stream.
IOException
- if an error occured while reading from the input stream
or writting to the output stream.public String getWarning()
null
. The warning is cleared
every time a new object is formatted.
null
if none.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |