ptolemy.moml
Class StreamErrorHandler
java.lang.Object
ptolemy.moml.StreamErrorHandler
- All Implemented Interfaces:
- ErrorHandler
public class StreamErrorHandler
- extends java.lang.Object
- implements ErrorHandler
Basic error handler for the MoMLParser class. This error handler reports
errors to a stream or to standard error, and requests that parsing continue.
- Since:
- Ptolemy II 2.0
- Version:
- $Id: StreamErrorHandler.java 57040 2010-01-27 20:52:32Z cxh $
- Author:
- Edward A. Lee
- See Also:
MoMLParser
- Accepted Rating:
- Proposed Rating:
Field Summary |
private java.io.PrintStream |
_output
|
Constructor Summary |
StreamErrorHandler()
Create an error handler that sends messages to the standard error. |
StreamErrorHandler(java.io.OutputStream out)
Create an error handler that sends messages to the specified stream. |
Method Summary |
void |
enableErrorSkipping(boolean enable)
Enable or disable skipping of errors. |
int |
handleError(java.lang.String element,
NamedObj context,
java.lang.Throwable exception)
Handle an error by printing a description of the error to
the stream specified in the constructor. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_output
private java.io.PrintStream _output
StreamErrorHandler
public StreamErrorHandler()
- Create an error handler that sends messages to the standard error.
StreamErrorHandler
public StreamErrorHandler(java.io.OutputStream out)
- Create an error handler that sends messages to the specified stream.
- Parameters:
out
- The OutputStream
enableErrorSkipping
public void enableErrorSkipping(boolean enable)
- Enable or disable skipping of errors. This method does nothing.
- Specified by:
enableErrorSkipping
in interface ErrorHandler
- Parameters:
enable
- True to enable skipping, false to disable.
handleError
public int handleError(java.lang.String element,
NamedObj context,
java.lang.Throwable exception)
- Handle an error by printing a description of the error to
the stream specified in the constructor.
- Specified by:
handleError
in interface ErrorHandler
- Parameters:
element
- The XML element that triggered the error.context
- The container object for the element.exception
- The exception that was thrown.
- Returns:
- CONTINUE to request skipping this element.