|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SK.gnome.dwarf.mail.utils.LoggedReader
Provides line reader with a built-in logging capability.
This class may be used to read lines from the underlying input stream while automatically logging them for debugging purposes. It is suitable for handling text-based network protocols, such as SMTP or POP3, for example.
Constructor Summary | |
LoggedReader(SK.gnome.dwarf.log.Logger logger,
java.lang.String facility,
java.lang.String prefix,
java.io.InputStream stream,
int limit)
Creates a new LoggedReader. |
Method Summary | |
java.io.InputStream |
getStream()
Returns the underlying input stream. |
int |
read()
Reads a single character. |
java.lang.String |
readLine()
Reads a single line. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LoggedReader(SK.gnome.dwarf.log.Logger logger, java.lang.String facility, java.lang.String prefix, java.io.InputStream stream, int limit) throws java.io.UnsupportedEncodingException
The reader will read from stream and log each read line via the logger. The log messages have the LOG_TRACE logging level and the logging facility associated with them. Each logged line is prepended with the prefix string. The reader will refuse to read lines larger than the limit argument.
The log messages will be generated only if it is enabled for the given facility via the SK.gnome.dwar.log.Log.setTrace(String) method.
This reader converts the input stream octets using the ISO 8859-1 character encoding.
logger
- the logging servicefacility
- the logging facilityprefix
- the prefix identifying the log messagesstream
- the input stream to read fromlimit
- the maximum line length limit
java.io.UnsupportedEncodingException
- if the required encoding is not knownMethod Detail |
public int read() throws java.io.IOException
java.io.IOException
- if an error occurspublic java.lang.String readLine() throws java.io.IOException
java.io.IOException
- if an error occurspublic java.io.InputStream getStream()
The stream may be used to directly read byte octets when line-oriented input or logging function is not desired.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |