|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SK.gnome.dwarf.mail.utils.LoggedWriter
Provides line writer with a built-in logging capability.
This class may be used to write lines to the underlying output 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 | |
LoggedWriter(SK.gnome.dwarf.log.Logger logger,
java.lang.String facility,
java.lang.String prefix,
java.io.OutputStream stream)
Creates a new LoggedWriter. |
Method Summary | |
java.io.OutputStream |
getStream()
Returns the underlying output stream. |
void |
print(java.lang.String s)
Prints the string. |
void |
println(java.lang.String s)
Prints the string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LoggedWriter(SK.gnome.dwarf.log.Logger logger, java.lang.String facility, java.lang.String prefix, java.io.OutputStream stream) throws java.io.UnsupportedEncodingException
The writer will write to stream and log each written 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 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 writer converts the written characters using the ISO 8859-1 character encoding.
logger
- the logging servicefacility
- the logging facilityprefix
- the prefix identifying the log messagesstream
- the output stream to write to
java.io.UnsupportedEncodingException
- if the required encoding is not knownMethod Detail |
public void println(java.lang.String s) throws java.io.IOException
s
- the string
java.io.IOException
- if an error occurspublic void print(java.lang.String s) throws java.io.IOException
s
- the string
java.io.IOException
- if an error occurspublic java.io.OutputStream getStream()
The stream may be used to directly write byte octets when line-oriented output or logging function is not desired.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |