public class LogWriter extends Writer
get
methods of class Log
and use it
as you would use a PrintWriter
. This class automatically flushes a message to
the logging facility whenever you call one of the println
methods, or
flush()
. It prints all values and objects using the platform's default character
encoding.
Note that the println
methods of this class don't actually write
any line separation characters into the log. Log listeners will want the
messages without such characters anyway, so this is the correct behavior.
Log
Modifier and Type | Field and Description |
---|---|
static int |
CAPACITY |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the log writer.
|
void |
flush()
Flush the log writer.
|
boolean |
isFlushed()
Are we flushed yet?
|
void |
print(boolean b)
Print a boolean value.
|
void |
print(char c)
Print a character.
|
void |
print(char[] a)
Print an array of characters.
|
void |
print(double d)
Print a double-precision floating-point number.
|
void |
print(float f)
Print a floating-point number.
|
void |
print(int i)
Print an integer.
|
void |
print(long l)
Print a long integer.
|
void |
print(Object obj)
Print an object.
|
void |
print(String s)
Print a string.
|
void |
println()
Terminate the current message.
|
void |
println(boolean b)
Print a boolean value and terminate the message.
|
void |
println(char c)
Print a character value and terminate the message.
|
void |
println(char[] a)
Print a character array and terminate the message.
|
void |
println(double d)
Print a double-precision floating-point value and terminate the message.
|
void |
println(float f)
Print a floating-point value and terminate the message.
|
void |
println(int i)
Print an integer value and terminate the message.
|
void |
println(long l)
Print a long integer value and terminate the message.
|
void |
println(Object obj)
Print an Object and terminate the message.
|
void |
println(String s)
Print a String and terminate the message.
|
void |
println(Throwable t) |
void |
write(char[] array)
Write an array of characters.
|
void |
write(char[] array,
int offset,
int length)
Write a portion of an array of characters.
|
void |
write(int c)
Write a single character.
|
void |
write(String string)
Write a string.
|
void |
write(String string,
int offset,
int length)
Write a portion of a string.
|
public static final int CAPACITY
public void write(int c)
println
methods or flush()
.public void write(char[] array, int offset, int length)
public void write(char[] array)
public void write(String string, int offset, int length)
public void write(String string)
public void flush()
public void close()
This flushes any remaining text to the logging facility and then shuts down the log writer. You can't use it again after that (but closing a previously closed log writer is OK).
public void print(boolean b)
b
- The boolean
to print.public void print(char c)
c
- The char
to print.public void print(int i)
i
- The int
to print.public void print(long l)
l
- The long
to print.public void print(float f)
f
- The float
to print.public void print(double d)
d
- The double
to print.public void print(char[] a)
a
- The array of chars to print.public void print(String s)
null
then the string
"null" is printed.s
- The String
to print.public void print(Object obj)
obj
- The Object
to print.public void println(boolean b)
b
- The boolean
to print.public void println(char c)
c
- The char
to print.public void println(int i)
i
- The int
to print.public void println(long l)
l
- The long
to print.public void println(float f)
f
- The float
to print.public void println(double d)
d
- The double
to print.public void println(char[] a)
a
- The array of chars to print.public void println(String s)
s
- The String
to print.public void println(Throwable t)
public void println(Object obj)
obj
- The Object
to print.public void println()
public boolean isFlushed()
Copyright © 1999–2017 Apache OODT. All rights reserved.