public class CompressionResponseStream
extends javax.servlet.ServletOutputStream
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
buffer
The buffer through which all of our output bytes are passed.
|
protected int |
bufferCount
The number of data bytes currently in the buffer.
|
protected boolean |
closed
Has this stream been closed?
|
protected int |
compressionBuffer
The compression buffer size to avoid chunking
|
protected String[] |
compressionMimeTypes
The mime types to compress
|
protected int |
compressionThreshold
The threshold number which decides to compress or not.
|
protected OutputStream |
gzipstream
The underlying gzip output stream to which we should write data.
|
protected int |
length
The content length past which we will not write, or -1 if there is
no defined content length.
|
protected javax.servlet.ServletOutputStream |
output
The underlying servlet output stream to which we should write data.
|
protected CompressionServletResponseWrapper |
response
The response with which this servlet output stream is associated.
|
| Constructor and Description |
|---|
CompressionResponseStream(CompressionServletResponseWrapper responseWrapper,
javax.servlet.ServletOutputStream originalOutput)
Construct a servlet output stream associated with the specified Response.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close this output stream, causing any buffered data to be flushed and
any further output data to throw an IOException.
|
boolean |
closed()
Has this response stream been closed?
|
void |
flush()
Flush any buffered data for this output stream, which also causes the
response to be committed.
|
void |
flushToGZip() |
protected void |
setCompressionBuffer(int compressionBuffer)
The compression buffer size to avoid chunking
|
void |
setCompressionMimeTypes(String[] compressionMimeTypes)
Set supported mime types
|
protected void |
setCompressionThreshold(int compressionThreshold)
Set the compressionThreshold number and create buffer for this size
|
void |
setDebugLevel(int debug)
Set debug level
|
void |
write(byte[] b)
Write
b.length bytes from the specified byte array
to our output stream. |
void |
write(byte[] b,
int off,
int len)
Write
len bytes from the specified byte array, starting
at the specified offset, to our output stream. |
void |
write(int b)
Write the specified byte to our output stream.
|
void |
writeToGZip(byte[] b,
int off,
int len) |
protected int compressionThreshold
protected int compressionBuffer
protected String[] compressionMimeTypes
protected byte[] buffer
protected int bufferCount
protected OutputStream gzipstream
protected boolean closed
protected int length
protected CompressionServletResponseWrapper response
protected javax.servlet.ServletOutputStream output
public CompressionResponseStream(CompressionServletResponseWrapper responseWrapper, javax.servlet.ServletOutputStream originalOutput)
responseWrapper - The associated response wrapperoriginalOutput - the output streampublic void setDebugLevel(int debug)
protected void setCompressionThreshold(int compressionThreshold)
protected void setCompressionBuffer(int compressionBuffer)
public void setCompressionMimeTypes(String[] compressionMimeTypes)
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic void flushToGZip()
throws IOException
IOExceptionpublic void write(int b)
throws IOException
write in class OutputStreamb - The byte to be writtenIOException - if an input/output error occurspublic void write(byte[] b)
throws IOException
b.length bytes from the specified byte array
to our output stream.write in class OutputStreamb - The byte array to be writtenIOException - if an input/output error occurspublic void write(byte[] b,
int off,
int len)
throws IOException
len bytes from the specified byte array, starting
at the specified offset, to our output stream.write in class OutputStreamb - The byte array containing the bytes to be writtenoff - Zero-relative starting offset of the bytes to be writtenlen - The number of bytes to be writtenIOException - if an input/output error occurspublic void writeToGZip(byte[] b,
int off,
int len)
throws IOException
IOExceptionpublic boolean closed()
Copyright © 2015 WSO2 Inc. All rights reserved.