public class PrintWriterImpl extends java.io.PrintWriter implements Loggable
Modifier and Type | Field and Description |
---|---|
protected java.lang.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 |
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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(java.lang.Object x)
Print an object in the buffer.
|
void |
print(java.lang.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(java.lang.Object x)
Send the buffer and an object to the logger
|
void |
println(java.lang.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(java.lang.String s)
Write a string in the buffer.
|
void |
write(java.lang.String s,
int off,
int len)
Write a portion of a string in the buffer.
|
protected Logger logger
protected LoggerFactory loggerFactory
protected int level
protected java.lang.String currentLine
protected boolean errors
public PrintWriterImpl(Logger l) throws java.lang.NullPointerException
l
- is the logger toward which the message must be sendjava.lang.NullPointerException
- if the parameter is null.public PrintWriterImpl(Logger logger, LoggerFactory loggerFactory) throws java.lang.NullPointerException
logger
- is the logger toward which the message must be sendloggerFactory
- is the loggerFactory of the loggerjava.lang.NullPointerException
- if one of the parameters is null.public PrintWriterImpl(Logger l, int level) throws java.lang.NullPointerException
l
- is the logger toward which the message must be sendlevel
- is the level used to log message.java.lang.NullPointerException
- if the parameter is null.public int getLevel()
public void setLevel(int level)
public Logger getLogger()
public void setLogger(Logger logger)
public LoggerFactory getLoggerFactory()
getLoggerFactory
in interface Loggable
public void setLoggerFactory(LoggerFactory lf)
setLoggerFactory
in interface Loggable
public boolean checkError()
checkError
in class java.io.PrintWriter
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.PrintWriter
public void flush()
flush
in interface java.io.Flushable
flush
in class java.io.PrintWriter
public void print(boolean x)
print
in class java.io.PrintWriter
public void print(char x)
print
in class java.io.PrintWriter
public void print(char[] x)
print
in class java.io.PrintWriter
public void print(double x)
print
in class java.io.PrintWriter
public void print(float x)
print
in class java.io.PrintWriter
public void print(int x)
print
in class java.io.PrintWriter
public void print(long x)
print
in class java.io.PrintWriter
public void print(java.lang.Object x)
print
in class java.io.PrintWriter
public void print(java.lang.String x)
print
in class java.io.PrintWriter
public void println()
println
in class java.io.PrintWriter
public void println(boolean x)
println
in class java.io.PrintWriter
public void println(char x)
println
in class java.io.PrintWriter
public void println(char[] x)
println
in class java.io.PrintWriter
public void println(double x)
println
in class java.io.PrintWriter
public void println(float x)
println
in class java.io.PrintWriter
public void println(int x)
println
in class java.io.PrintWriter
public void println(long x)
println
in class java.io.PrintWriter
public void println(java.lang.Object x)
println
in class java.io.PrintWriter
public void println(java.lang.String x)
println
in class java.io.PrintWriter
protected void setError()
setError
in class java.io.PrintWriter
public void write(char[] buf)
write
in class java.io.PrintWriter
public void write(char[] buf, int off, int len)
write
in class java.io.PrintWriter
public void write(int c)
write
in class java.io.PrintWriter
public void write(java.lang.String s)
write
in class java.io.PrintWriter
public void write(java.lang.String s, int off, int len)
write
in class java.io.PrintWriter