public class BufferedServletOutputStream
extends javax.servlet.ServletOutputStream
BufferedServletOutputStream
implements
a buffered ServletOutputStream in a similar way to
ByteArrayOutputStream represents a buffered OutputStream.
Modifier and Type | Field and Description |
---|---|
protected java.io.ByteArrayOutputStream |
buffer
The underlying
ByteArrayOutputStream that the output
is written to |
Constructor and Description |
---|
BufferedServletOutputStream() |
BufferedServletOutputStream(int size) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
void |
reset()
Resets the count field of this buffer to zero,
so that all currently accumulated output in the
ouput stream is discarded.
|
int |
size()
Returns the current size of the buffer.
|
byte[] |
toByteArray()
Creates a newly allocated byte array.
|
java.lang.String |
toString()
Converts the buffer's contents into a string,
translating bytes into characters according
to the platform's default character encoding.
|
java.lang.String |
toString(java.lang.String enc)
Converts the buffer's contents into a string,
translating bytes into characters according
to the specified character encoding.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
void |
writeTo(java.io.OutputStream out)
Writes the complete contents of this buffer
to the specified output stream argument,
as if by calling the output stream's write
method using out.write(buf, 0, count).
|
protected java.io.ByteArrayOutputStream buffer
ByteArrayOutputStream
that the output
is written topublic BufferedServletOutputStream()
public BufferedServletOutputStream(int size)
public void write(byte[] b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
public void reset()
public int size()
public byte[] toByteArray()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String enc) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public void writeTo(java.io.OutputStream out) throws java.io.IOException
java.io.IOException