| java.lang.Object org.geotools.referencing.wkt.AbstractConsole
All known Subclasses: org.geotools.referencing.Console,
AbstractConsole | abstract public class AbstractConsole implements Runnable(Code) | | Base class for application performing operations on WKT objects from the command line.
Instructions are usually read from the
and
results sent to the
, but those streams can
be redirected. The set of allowed instructions depends on the subclass used.
since: 2.1 version: $Id: AbstractConsole.java 27848 2007-11-12 13:10:32Z desruisseaux $ author: Martin Desruisseaux |
lineSeparator | final protected String lineSeparator(Code) | | The line separator, usually the system default.
|
out | final protected Writer out(Code) | | The output stream, usually the
.
|
AbstractConsole | public AbstractConsole(Format parser)(Code) | | Creates a new console instance using
,
,
and the system default line separator.
Parameters: parser - The WKT parser, usually a Preprocessor object. |
AbstractConsole | public AbstractConsole(Format parser, LineNumberReader in)(Code) | | Creates a new console instance using the specified input stream.
Parameters: parser - The WKT parser, usually a Preprocessor object. Parameters: in - The input stream. |
AbstractConsole | public AbstractConsole(Format parser, LineNumberReader in, Writer out, PrintWriter err, String lineSeparator)(Code) | | Creates a new console instance using the specified streams and line separator.
Parameters: parser - The WKT parser, usually a Preprocessor object. Parameters: in - The input stream. Parameters: out - The output stream. Parameters: err - The error stream. Parameters: lineSeparator - The line separator. |
addDefinition | public void addDefinition(String name, String value) throws ParseException(Code) | | Adds a predefined Well Know Text (WKT). The
value argument given to this method
can contains itself other definitions specified in some previous calls to this method. This
method do nothing if the
is not an instance of
Preprocessor .
Parameters: name - The name for the definition to be added. Parameters: value - The Well Know Text (WKT) represented by the name. throws: IllegalArgumentException - if the name is invalid. throws: ParseException - if the WKT can't be parsed. |
execute | abstract protected void execute(String instruction) throws Exception(Code) | | Execute the specified instruction.
Parameters: instruction - The instruction to execute. throws: Exception - if the instruction failed. |
getPrompt | public String getPrompt()(Code) | | Returns the command-line prompt, or
null if there is none.
|
parseObject | public Object parseObject(String text, Class type) throws ParseException, FactoryException(Code) | | Parses the specified text. The default implementation delegates the work to the
.
Parameters: text - The text, as a name, a WKT to parse, or an authority code. Parameters: type - The expected type for the object to be parsed (usually a.class or.class ). The object. throws: ParseException - if parsing the specified WKT failed. throws: FactoryException - if the object is not of the expected type. |
printDefinitions | public void printDefinitions() throws IOException(Code) | | Prints to the
a table of all definitions. The content of
this table is inferred from the values given to the
AbstractConsole.addDefinition method. This
method print nothing if the
is not an instance of
Preprocessor .
throws: IOException - if an error occured while writting to the output stream. |
reportError | protected void reportError(Exception exception)(Code) | | Print an exception message to the
.
The error message includes the line number, and the column where the failure
occured in the exception is an instance of
ParseException .
Parameters: exception - The exception to report. |
run | public void run()(Code) | | Process instructions from the
specified at construction
time. All lines are read until the end of stream (
[Ctrl-Z] for input from
the keyboard), or until
AbstractConsole.stop() is invoked. Non-empty and non-comment lines are
given to the
AbstractConsole.execute method. Errors are catched and printed to the
.
|
setPrompt | public void setPrompt(String prompt)(Code) | | Set the command-line prompt, or
null for none.
|
|
|