org.apache.struts.util
Class ServletContextWriter
PrintWriter
org.apache.struts.util.ServletContextWriter
public class ServletContextWriter
extends PrintWriter
A PrintWriter implementation that uses the logging facilities of a
javax.servlet.ServletContext
to output its results. Output
will be buffered until a newline character is output, flush()
is called, or until one of the println()
methods is called.
Along the way, carriage return characters are skipped.
$Rev: 54929 $ $Date: 2004-10-16 17:38:42 +0100 (Sat, 16 Oct 2004) $protected StringBuffer | buffer - The buffer into which we accumulate lines to be logged.
|
protected ServletContext | context - The servlet context with which we are associated.
|
protected boolean | error - The error state for this stream.
|
ServletContextWriter(ServletContext context) - Construct a ServletContextWriter associated with the specified
ServletContext instance.
|
boolean | checkError() - Flush the stream and check for its error state.
|
void | close() - Close the stream.
|
void | flush() - Flush the stream.
|
void | print(Object o) - Print an object.
|
void | print(String s) - Print a String value.
|
void | print(boolean b) - Print a boolean value.
|
void | print(c[] ) - Print a character array.
|
void | print(char c) - Print a character value.
|
void | print(double d) - Print a double value.
|
void | print(float f) - Print a float value.
|
void | print(int i) - Print an integer value.
|
void | print(long l) - Print a long value.
|
void | println() - Terminate the current line and flush the buffer.
|
void | println(Object o) - Print an object and terminate the line.
|
void | println(String s) - Print a String value and terminate the line.
|
void | println(boolean b) - Print a boolean value and terminate the line.
|
void | println(c[] ) - Print a character array and terminate the line.
|
void | println(char c) - Print a character value and terminate the line.
|
void | println(double d) - Print a double value and terminate the line.
|
void | println(float f) - Print a float value and terminate the line.
|
void | println(int i) - Print an integer value and terminate the line.
|
void | println(long l) - Print a long value and terminate the line.
|
void | setError() - Set the error state for this stream.
|
void | write(String s) - Write a String to this stream.
|
void | write(String s, int off, int len) - Write the specified portion of a String to this stream.
|
void | write(buf[] ) - Write an array of charaters to this stream.
|
void | write(buf[] , int off, int len) - Write the specified subset of an array of characters to this stream.
|
void | write(char c) - Write a single character to this stream.
|
void | write(int c) - Write a single character to this stream.
|
buffer
protected StringBuffer buffer
The buffer into which we accumulate lines to be logged.
context
protected ServletContext context
The servlet context with which we are associated.
error
protected boolean error
The error state for this stream.
ServletContextWriter
public ServletContextWriter(ServletContext context)
Construct a ServletContextWriter associated with the specified
ServletContext instance.
context
- The associated servlet context
checkError
public boolean checkError()
Flush the stream and check for its error state. IMPLEMENTATION
NOTE - our associated servlet context gives no indication of
problems with logging, so the only way this method will return
true
is if setError()
is called.
close
public void close()
Close the stream.
flush
public void flush()
Flush the stream.
print
public void print(Object o)
Print an object.
o
- The value to be printed
print
public void print(String s)
Print a String value.
s
- The value to be printed
print
public void print(boolean b)
Print a boolean value.
b
- The value to be printed
print
public void print(c[] )
Print a character array.
print
public void print(char c)
Print a character value.
c
- The value to be printed
print
public void print(double d)
Print a double value.
d
- The value to be printed
print
public void print(float f)
Print a float value.
f
- The value to be printed
print
public void print(int i)
Print an integer value.
i
- The value to be printed
print
public void print(long l)
Print a long value.
l
- The value to be printed
println
public void println()
Terminate the current line and flush the buffer.
println
public void println(Object o)
Print an object and terminate the line.
o
- The value to be printed
println
public void println(String s)
Print a String value and terminate the line.
s
- The value to be printed
println
public void println(boolean b)
Print a boolean value and terminate the line.
b
- The value to be printed
println
public void println(c[] )
Print a character array and terminate the line.
println
public void println(char c)
Print a character value and terminate the line.
c
- The value to be printed
println
public void println(double d)
Print a double value and terminate the line.
d
- The value to be printed
println
public void println(float f)
Print a float value and terminate the line.
f
- The value to be printed
println
public void println(int i)
Print an integer value and terminate the line.
i
- The value to be printed
println
public void println(long l)
Print a long value and terminate the line.
l
- The value to be printed
setError
public void setError()
Set the error state for this stream.
write
public void write(String s)
Write a String to this stream.
s
- The string to be written
write
public void write(String s,
int off,
int len)
Write the specified portion of a String to this stream.
s
- The String from which to writeoff
- The zero-relative starting offset to writelen
- The number of characters to write
write
public void write(buf[] )
Write an array of charaters to this stream.
write
public void write(buf[] ,
int off,
int len)
Write the specified subset of an array of characters to this stream.
off
- The zero-relative starting offset to writelen
- The number of characters to write
write
public void write(char c)
Write a single character to this stream.
c
- The character to be written
write
public void write(int c)
Write a single character to this stream.
c
- The character to be written
Copyright B) 2000-2007 - The Apache Software Foundation