An instance of ResponseWriter is the PrintWriter subclass returned by HttpServletResponse#getWriter().
It differs from the standard PrintWriter in that:
format(String, Object...) is the locale obtained by ServletResponse#getLocale()checkError() returns true, then a RuntimeIOException is thrown to stop needless iterations.| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private Formatter | |
| private IOException | |
| private boolean | |
| private final Locale | |
| private final WriteThroughWriter | |
| private static final Logger |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | checkError()
Overrides java. |
| protected void | |
| public void | close()
Overrides java. Implements java. |
| public void | |
| public PrintWriter | format(String
A format string as described in Format string syntax. format, Object... Arguments referenced by the format specifiers in the format
string. If there are more arguments than format specifiers, the
extra arguments are ignored. The number of arguments is
variable and may be zero. The maximum number of arguments is
limited by the maximum dimension of a Java array as defined by
The Java Virtual Machine Specification.
The behaviour on a
args)null argument depends on the conversion.Overrides java. |
| public PrintWriter | format(Locale locale, String
A format string as described in Format string syntax. format, Object... Arguments referenced by the format specifiers in the format
string. If there are more arguments than format specifiers, the
extra arguments are ignored. The number of arguments is
variable and may be zero. The maximum number of arguments is
limited by the maximum dimension of a Java array as defined by
The Java Virtual Machine Specification.
The behaviour on a
args)null argument depends on the conversion.Overrides java. |
| public boolean | |
| private void | |
| pack-priv void | |
| public void | print(boolean
The b)boolean to be printedOverrides java. |
| public void | |
| public void | |
| public void | |
| public void | print(float
The f)float to be printedOverrides java. |
| public void | print(double
The d)double to be printedOverrides java. |
| public void | print(char[]
The array of chars to be printed s)Overrides java. |
| public void | |
| public void | |
| public PrintWriter | printf(String
A format string as described in Format string syntax. format, Object... Arguments referenced by the format specifiers in the format
string. If there are more arguments than format specifiers, the
extra arguments are ignored. The number of arguments is
variable and may be zero. The maximum number of arguments is
limited by the maximum dimension of a Java array as defined by
The Java Virtual Machine Specification.
The behaviour on a
args)null argument depends on the conversion.Overrides java. |
| public PrintWriter | printf(Locale l, String
A format string as described in Format string syntax. format, Object... Arguments referenced by the format specifiers in the format
string. If there are more arguments than format specifiers, the
extra arguments are ignored. The number of arguments is
variable and may be zero. The maximum number of arguments is
limited by the maximum dimension of a Java array as defined by
The Java Virtual Machine Specification.
The behaviour on a
args)null argument depends on the conversion.Overrides java. |
| public void | println()
Overrides java. |
| public void | println(boolean
the b)boolean value to be printedOverrides java. |
| public void | println(char
the c)char value to be printedOverrides java. |
| public void | println(int
the x)int value to be printedOverrides java. |
| public void | println(long
the x)long value to be printedOverrides java. |
| public void | println(float
the x)float value to be printedOverrides java. |
| public void | println(double
the x)double value to be printedOverrides java. |
| public void | println(char[]
the array of s)char values to be printedOverrides java. |
| public void | println(String
the s)String value to be printedOverrides java. |
| public void | println(Object
The x)Object to be printed.Overrides java. |
| public void | |
| private void | |
| protected void | |
| public void | write(int
int specifying a character to be written. c)Overrides java. |
| public void | write(char[]
Array of characters buf, int Offset from which to start writing characters off, int Number of characters to write len)Overrides java. |
| public void | write(char[]
Array of characters to be written buf)Overrides java. |
| public void | write(String
A String s, int Offset from which to start writing characters off, int Number of characters to write len)Overrides java. |
| public void |
| _encoding | back to summary |
|---|---|
| private final String _encoding | |
| _formatter | back to summary |
|---|---|
| private Formatter _formatter | |
| _ioException | back to summary |
|---|---|
| private IOException _ioException | |
| _isClosed | back to summary |
|---|---|
| private boolean _isClosed | |
| _locale | back to summary |
|---|---|
| private final Locale _locale | |
| _writer | back to summary |
|---|---|
| private final WriteThroughWriter _writer | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| ResponseWriter | back to summary |
|---|---|
| public ResponseWriter(WriteThroughWriter writer, Locale locale, String encoding) | |
| checkError | back to summary |
|---|---|
| public boolean checkError() Overrides java. Doc from java. Flushes the stream if it's not closed and checks its error state.
| |
| clearError | back to summary |
|---|---|
| protected void clearError() Overrides java. Doc from java. Clears the error state of this stream. This method will cause subsequent invocations of
| |
| close | back to summary |
|---|---|
| public void close() Overrides java. Implements java. Doc from java. Closes the stream and releases any system resources associated with it. Closing a previously closed stream has no effect.
| |
| flush | back to summary |
|---|---|
| public void flush() Overrides java. Implements java. Doc from java. Flushes the stream.
| |
| format | back to summary |
|---|---|
| public PrintWriter format(String format, Object... args) Overrides java. Doc from java. Writes a formatted string to this writer using the specified format string and arguments. If automatic flushing is enabled, calls to this method will flush the output buffer. The locale always used is the one returned by
| |
| format | back to summary |
|---|---|
| public PrintWriter format(Locale locale, String format, Object... args) Overrides java. Doc from java. Writes a formatted string to this writer using the specified format string and arguments. If automatic flushing is enabled, calls to this method will flush the output buffer.
| |
| isFor | back to summary |
|---|---|
| public boolean isFor(Locale locale, String encoding) | |
| isOpen | back to summary |
|---|---|
| private void isOpen() throws IOException Check to make sure that the stream has not been closed | |
| markAsClosed | back to summary |
|---|---|
| pack-priv void markAsClosed() Used to mark this writer as closed during any asynchronous completion operation. | |
| back to summary | |
|---|---|
| public void print(boolean b) Overrides java. Doc from java. Prints a boolean value. The string produced by
| |
| back to summary | |
|---|---|
| public void print(char c) Overrides java. Doc from java. Prints a character. The character is translated into one or more bytes
according to the default charset, and these bytes
are written in exactly the manner of the
| |
| back to summary | |
|---|---|
| public void print(int i) Overrides java. Doc from java. Prints an integer. The string produced by
| |
| back to summary | |
|---|---|
| public void print(long l) Overrides java. Doc from java. Prints a long integer. The string produced by
| |
| back to summary | |
|---|---|
| public void print(float f) Overrides java. Doc from java. Prints a floating-point number. The string produced by
| |
| back to summary | |
|---|---|
| public void print(double d) Overrides java. Doc from java. Prints a double-precision floating-point number. The string produced by
| |
| back to summary | |
|---|---|
| public void print(char[] s) Overrides java. Doc from java. Prints an array of characters. The characters are converted into bytes
according to the default charset, and these bytes
are written in exactly the manner of the
| |
| back to summary | |
|---|---|
| public void print(String s) Overrides java. Doc from java. Prints a string. If the argument is | |
| back to summary | |
|---|---|
| public void print(Object obj) Overrides java. Doc from java. Prints an object. The string produced by the | |
| printf | back to summary |
|---|---|
| public PrintWriter printf(String format, Object... args) Overrides java. Doc from java. A convenience method to write a formatted string to this writer using the specified format string and arguments. If automatic flushing is enabled, calls to this method will flush the output buffer. An invocation of this method of the form
out.format(format, args)
| |
| printf | back to summary |
|---|---|
| public PrintWriter printf(Locale l, String format, Object... args) Overrides java. Doc from java. A convenience method to write a formatted string to this writer using the specified format string and arguments. If automatic flushing is enabled, calls to this method will flush the output buffer. An invocation of this method of the form
out.format(l, format, args)
| |
| println | back to summary |
|---|---|
| public void println() Overrides java. Doc from java. Terminates the current line by writing the line separator string. The
line separator is
| |
| println | back to summary |
|---|---|
| public void println(boolean b) Overrides java. Doc from java. Prints a boolean value and then terminates the line. This method behaves
as though it invokes
| |
| println | back to summary |
|---|---|
| public void println(char c) Overrides java. Doc from java. Prints a character and then terminates the line. This method behaves as
though it invokes
| |
| println | back to summary |
|---|---|
| public void println(int x) Overrides java. Doc from java. Prints an integer and then terminates the line. This method behaves as
though it invokes
| |
| println | back to summary |
|---|---|
| public void println(long x) Overrides java. Doc from java. Prints a long integer and then terminates the line. This method behaves
as though it invokes
| |
| println | back to summary |
|---|---|
| public void println(float x) Overrides java. Doc from java. Prints a floating-point number and then terminates the line. This method
behaves as though it invokes
| |
| println | back to summary |
|---|---|
| public void println(double x) Overrides java. Doc from java. Prints a double-precision floating-point number and then terminates the
line. This method behaves as though it invokes
| |
| println | back to summary |
|---|---|
| public void println(char[] s) Overrides java. Doc from java. Prints an array of characters and then terminates the line. This method
behaves as though it invokes
| |
| println | back to summary |
|---|---|
| public void println(String s) Overrides java. Doc from java. Prints a String and then terminates the line. This method behaves as
though it invokes | |
| println | back to summary |
|---|---|
| public void println(Object x) Overrides java. Doc from java. Prints an Object and then terminates the line. This method calls
at first String.valueOf(x) to get the printed object's string value,
then behaves as
though it invokes | |
| reopen | back to summary |
|---|---|
| public void reopen() | |
| setError | back to summary |
|---|---|
| private void setError(Throwable th) | |
| setError | back to summary |
|---|---|
| protected void setError() Overrides java. Doc from java. Sets the error state of the stream to This method will cause subsequent invocations of
| |
| write | back to summary |
|---|---|
| public void write(int c) Overrides java. Doc from java. Writes a single character.
| |
| write | back to summary |
|---|---|
| public void write(char[] buf, int off, int len) Overrides java. Doc from java. Writes A Portion of an array of characters.
| |
| write | back to summary |
|---|---|
| public void write(char[] buf) Overrides java. Doc from java. Writes an array of characters. This method cannot be inherited from the Writer class because it must suppress I/O exceptions.
| |
| write | back to summary |
|---|---|
| public void write(String s, int off, int len) Overrides java. Doc from java. Writes a portion of a string. | |
| write | back to summary |
|---|---|
| public void write(String s) Overrides java. Doc from java. Writes a string. This method cannot be inherited from the Writer class because it must suppress I/O exceptions. | |