jj2000.j2k.util
Interface MsgLogger

All Known Implementing Classes:
StreamMsgLogger

public interface MsgLogger

This class provides a simple common abstraction of a facility that logs and/or displays messages or simple strings. The underlying facility can be a terminal, text file, text area in a GUI display, dialog boxes in a GUI display, etc., or a combination of those. <>Messages are short strings (a couple of lines) that indicate some state of the program, and that have a severity code associated with them (see below). Simple strings is text (can be long) that has no severity code associated with it. Typical use of simple strings is to display help texts.

Each message has a severity code, which can be one of the following: LOG, INFO, WARNING, ERROR. Each implementation should treat each severity code in a way which corresponds to the type of diplay used.

Messages are printed via the 'printmsg()' method. Simple strings are printed via the 'print()', 'println()' and 'flush()' methods, each simple string is considered to be terminated once the 'flush()' method has been called. The 'printmsg()' method should never be called before a previous simple string has been terminated.


Field Summary
static int ERROR
          Severity of message.
static int INFO
          Severity of message.
static int LOG
          Severity of message.
static int WARNING
          Severity of message.
 
Method Summary
 void flush()
          Writes any buffered data from the println() method to the device.
 void println(java.lang.String str, int flind, int ind)
          Prints the string 'str' to the output device, appending a line return.
 void printmsg(int sev, java.lang.String msg)
          Prints the message 'msg' to the output device, appending a newline, with severity 'sev'.
 

Field Detail

LOG

public static final int LOG
Severity of message. LOG messages are just for bookkeeping and do not need to be displayed in the majority of cases

See Also:
Constant Field Values

INFO

public static final int INFO
Severity of message. INFO messages should be displayed just for user feedback.

See Also:
Constant Field Values

WARNING

public static final int WARNING
Severity of message. WARNING messages denote that an unexpected state has been reached and should be given as feedback to the user.

See Also:
Constant Field Values

ERROR

public static final int ERROR
Severity of message. ERROR messages denote that something has gone wrong and probably that execution has ended. They should be definetely displayed to the user.

See Also:
Constant Field Values
Method Detail

printmsg

public void printmsg(int sev,
                     java.lang.String msg)
Prints the message 'msg' to the output device, appending a newline, with severity 'sev'. Some implementations where the appended newline is irrelevant may not append the newline. Depending on the implementation the severity of the message may be added to it. The message is reformatted as appropriate for the output devic, but any newline characters are respected.

Parameters:
sev - The message severity (LOG, INFO, etc.)
msg - The message to display

println

public void println(java.lang.String str,
                    int flind,
                    int ind)
Prints the string 'str' to the output device, appending a line return. The message is reformatted as appropriate to the particular diplaying device, where 'flind' and 'ind' are used as hints for performing that operation. However, any newlines appearing in 'str' are respected. The output device may not display the string until flush() is called. Some implementations may automatically flush when this method is called. This method just prints the string, the string does not make part of a "message" in the sense that no severity is associated to it.

Parameters:
str - The string to print
flind - Indentation of the first line
ind - Indentation of any other lines.

flush

public void flush()
Writes any buffered data from the println() method to the device.