org.xwiki.portlet.util
Class StringServletPrintWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.PrintWriter
          extended by org.xwiki.portlet.util.StringServletPrintWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable

public class StringServletPrintWriter
extends PrintWriter

Class used to write the servlet response in a string.

Version:
$Id: ce380f5be98f27ede2bec9a3b8c7664ad3199d94 $

Field Summary
 
Fields inherited from class java.io.PrintWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
StringServletPrintWriter()
          Creates a new print writer that writes the servlet response content in a string.
 
Method Summary
 void close()
           
 InputStream toInputStream(String encoding)
           
 Reader toReader()
           
 
Methods inherited from class java.io.PrintWriter
append, append, append, checkError, clearError, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError, write, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringServletPrintWriter

public StringServletPrintWriter()
Creates a new print writer that writes the servlet response content in a string.

Method Detail

toInputStream

public InputStream toInputStream(String encoding)
                          throws UnsupportedEncodingException
Parameters:
encoding - the encoding used to convert characters to bytes
Returns:
an input stream that can be used to access the content written so far
Throws:
UnsupportedEncodingException - if the specified encoding is not supported

toReader

public Reader toReader()
Returns:
a reader that can be used to access the content written so far

close

public void close()
Specified by:
close in interface Closeable
Overrides:
close in class PrintWriter


Copyright © 2004-2013 XWiki. All Rights Reserved.