Package eu.bandm.tools.message
Class OffsetIndicationPrinter
java.lang.Object
eu.bandm.tools.message.OffsetIndicationPrinter
- All Implemented Interfaces:
MessageReceiver<SimpleMessage<String>>
public class OffsetIndicationPrinter
extends Object
implements MessageReceiver<SimpleMessage<String>>
Prints textual representations of all receiv1ed messages to an
output stream.
Assumes that the DocumentId is the one line document contents (i.e. a string contents which is its own identifier), and indicates the error position by indentation in a second line below the printed contents.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final PrintWriter
The target of all print activities.protected boolean
Whether to emit a leading newline, Can be set by class derivation -
Constructor Summary
ConstructorDescriptionPrints toSystem.err
, using default encoding.Prints to a newly createdPrintWriter
to theOutputStream
provided.
Consequently using a default encoding. -
Method Summary
Modifier and TypeMethodDescriptionvoid
receive
(SimpleMessage<String> message) Print the message to the output stream.
First the id is printed (= the document contents), then a newline, an indentation, a caret symbol, the message kind and the message text.
-
Field Details
-
out
The target of all print activities. -
prependNewline
protected boolean prependNewlineWhether to emit a leading newline, Can be set by class derivationnew OffsetIndicationPrinter(){{prependNewline=true;}}
-
-
Constructor Details
-
OffsetIndicationPrinter
public OffsetIndicationPrinter()Prints toSystem.err
, using default encoding. -
OffsetIndicationPrinter
Prints to a newly createdPrintWriter
to theOutputStream
provided.
Consequently using a default encoding. -
OffsetIndicationPrinter
-
-
Method Details
-
receive
Print the message to the output stream.
First the id is printed (= the document contents), then a newline, an indentation, a caret symbol, the message kind and the message text. After each printed message the output stream isflushed
explicitly.
In situations where stderr is likely to be contaminated with other output, not terminated by newline, an extra newline can be prepended to make the indentation correct.- Specified by:
receive
in interfaceMessageReceiver<SimpleMessage<String>>
-