|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.Writer
java.io.PrintWriter
org.objectweb.util.monolog.wrapper.printwriter.PrintWriterImpl
public class PrintWriterImpl
This class is a PrintWriter wrapper. It exports the PrintWriter methods but fowards the message to a Logger. This implementation bufferizes the data when a print method is used. The buffer and the data are always written when a println method is used. No end of line are inserted by the println methods. A line is equals to a monolog message.
| Field Summary | |
|---|---|
protected String |
currentLine
This field is the buffer which represents the current line. |
protected boolean |
errors
This field indicates the setError method was called. |
protected int |
level
|
protected Logger |
logger
The inner logger instance |
protected LoggerFactory |
loggerFactory
|
| Fields inherited from class java.io.PrintWriter |
|---|
out |
| Fields inherited from class java.io.Writer |
|---|
lock |
| Constructor Summary | |
|---|---|
PrintWriterImpl(Logger l)
It builds a PrintWriterImpl instance. |
|
PrintWriterImpl(Logger l,
int level)
It builds a PrintWriterImpl instance. |
|
PrintWriterImpl(Logger logger,
LoggerFactory loggerFactory)
It builds a PrintWriterImpl instance. |
|
| Method Summary | |
|---|---|
boolean |
checkError()
Flush the stream and check its error state. |
void |
close()
It writes the buffer if it is not empty |
void |
flush()
It writes the buffer if it is not empty |
int |
getLevel()
|
Logger |
getLogger()
Retrieves the logger instance used |
LoggerFactory |
getLoggerFactory()
Retrieves the logger factory instance used |
void |
print(boolean x)
Print a boolean value in the buffer. |
void |
print(char x)
Print a character in the buffer. |
void |
print(char[] x)
Print an array of characters in the buffer. |
void |
print(double x)
Print a double-precision floating-point number in the buffer. |
void |
print(float x)
Print a floating-point number in the buffer. |
void |
print(int x)
Print an integer in the buffer. |
void |
print(long x)
Print a long integer in the buffer. |
void |
print(Object x)
Print an object in the buffer. |
void |
print(String x)
Print a string in the buffer. |
void |
println()
Send the buffer to the logger |
void |
println(boolean x)
Send the buffer and a boolean value to the logger |
void |
println(char x)
Send the buffer and a character to the logger |
void |
println(char[] x)
Send the buffer and an array of characters to the logger |
void |
println(double x)
Send the buffer and a a double-precision floating-point number to the logger. |
void |
println(float x)
Send the buffer and a floating-point number to the logger |
void |
println(int x)
Send the buffer and an integer to the logger |
void |
println(long x)
Send the buffer and a long integer number to the logger |
void |
println(Object x)
Send the buffer and an object to the logger |
void |
println(String x)
Send the buffer and a String to the logger |
protected void |
setError()
Indicate that an error has occurred. |
void |
setLevel(int level)
|
void |
setLogger(Logger logger)
Assigns the logger instance to use |
void |
setLoggerFactory(LoggerFactory lf)
Assigns the logger factory instance to use |
void |
write(char[] buf)
Write an array of characters in the buffer. |
void |
write(char[] buf,
int off,
int len)
Write a portion of an array of characters in the buffer. |
void |
write(int c)
Write a single character in the buffer. |
void |
write(String s)
Write a string in the buffer. |
void |
write(String s,
int off,
int len)
Write a portion of a string in the buffer. |
| Methods inherited from class java.io.PrintWriter |
|---|
append, append, append, clearError, format, format, printf, printf |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Logger logger
protected LoggerFactory loggerFactory
protected int level
protected String currentLine
protected boolean errors
| Constructor Detail |
|---|
public PrintWriterImpl(Logger l)
throws NullPointerException
l - is the logger toward which the message must be send
NullPointerException - if the parameter is null.
public PrintWriterImpl(Logger logger,
LoggerFactory loggerFactory)
throws NullPointerException
logger - is the logger toward which the message must be sendloggerFactory - is the loggerFactory of the logger
NullPointerException - if one of the parameters is null.
public PrintWriterImpl(Logger l,
int level)
throws NullPointerException
l - is the logger toward which the message must be sendlevel - is the level used to log message.
NullPointerException - if the parameter is null.| Method Detail |
|---|
public int getLevel()
public void setLevel(int level)
public Logger getLogger()
getLogger in interface Loggablepublic void setLogger(Logger logger)
setLogger in interface Loggablepublic LoggerFactory getLoggerFactory()
getLoggerFactory in interface Loggablepublic void setLoggerFactory(LoggerFactory lf)
setLoggerFactory in interface Loggablepublic boolean checkError()
checkError in class PrintWriterpublic void close()
close in interface Closeableclose in class PrintWriterpublic void flush()
flush in interface Flushableflush in class PrintWriterpublic void print(boolean x)
print in class PrintWriterpublic void print(char x)
print in class PrintWriterpublic void print(char[] x)
print in class PrintWriterpublic void print(double x)
print in class PrintWriterpublic void print(float x)
print in class PrintWriterpublic void print(int x)
print in class PrintWriterpublic void print(long x)
print in class PrintWriterpublic void print(Object x)
print in class PrintWriterpublic void print(String x)
print in class PrintWriterpublic void println()
println in class PrintWriterpublic void println(boolean x)
println in class PrintWriterpublic void println(char x)
println in class PrintWriterpublic void println(char[] x)
println in class PrintWriterpublic void println(double x)
println in class PrintWriterpublic void println(float x)
println in class PrintWriterpublic void println(int x)
println in class PrintWriterpublic void println(long x)
println in class PrintWriterpublic void println(Object x)
println in class PrintWriterpublic void println(String x)
println in class PrintWriterprotected void setError()
setError in class PrintWriterpublic void write(char[] buf)
write in class PrintWriter
public void write(char[] buf,
int off,
int len)
write in class PrintWriterpublic void write(int c)
write in class PrintWriterpublic void write(String s)
write in class PrintWriter
public void write(String s,
int off,
int len)
write in class PrintWriter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||