Package org.bedework.util.servlet.io
Class ByteArrayPrintWriter
- java.lang.Object
-
- org.bedework.util.servlet.io.ByteArrayPrintWriter
-
public class ByteArrayPrintWriter extends Object
PrintWriter which uses an underlying ByteArrayOutputStream- Author:
- Mike Douglass douglm @ rpi.edu
-
-
Constructor Summary
Constructors Constructor Description ByteArrayPrintWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStreamgetInputStream()Get an InputStream for the bytes in the buffer.javax.servlet.ServletOutputStreamgetStream()PrintWritergetWriter()voidrelease()Release the resourcesintsize()Returns the current size of the buffer.voidwriteTo(OutputStream out)Writes the complete contents of this byte array output stream to the specified output stream argument, as if by calling the output stream's write method usingout.write(buf, 0, count).
-
-
-
Method Detail
-
getWriter
public PrintWriter getWriter()
- Returns:
- PrintWriter for this object
-
getStream
public javax.servlet.ServletOutputStream getStream()
- Returns:
- a ServletOutputStream
-
getInputStream
public InputStream getInputStream() throws IOException
Get an InputStream for the bytes in the buffer. No guarantees if writes take place after this is called.- Returns:
- InputStream
- Throws:
IOException
-
writeTo
public void writeTo(OutputStream out) throws IOException
Writes the complete contents of this byte array output stream to the specified output stream argument, as if by calling the output stream's write method usingout.write(buf, 0, count).- Parameters:
out- the output stream to which to write the data.- Throws:
IOException- if an I/O error occurs.
-
size
public int size()
Returns the current size of the buffer.- Returns:
- the value of the
countfield, which is the number of valid bytes in this output stream. - See Also:
ByteArrayOutputStream.count
-
release
public void release() throws IOExceptionRelease the resources- Throws:
IOException
-
-