public class GzipResponseStream
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 |
compressionThreshold
The threshold number which decides to compress or not.
|
protected java.util.zip.GZIPOutputStream |
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 javax.servlet.http.HttpServletResponse |
response
The response with which this servlet output stream is associated.
|
| Constructor and Description |
|---|
GzipResponseStream(javax.servlet.http.HttpServletResponse response)
Constructs a servlet output stream associated with the specified Response.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this output stream, causing any buffered data to be flushed and any
further output data to throw an IOException.
|
boolean |
closed()
Returns
true if this response stream been closed. |
void |
flush()
Flushes any buffered data for this output stream, which also causes the
response to be committed.
|
void |
flushToGZip() |
boolean |
isReady() |
protected void |
setBuffer(int threshold)
Sets the compressionThreshold number and create buffer for this size.
|
void |
setWriteListener(javax.servlet.WriteListener writeListener) |
void |
write(byte[] b)
Writes
b.length bytes from the specified byte array to our
output stream. |
void |
write(byte[] b,
int off,
int len)
Writes
len bytes from the specified byte array, starting at
the specified offset, to our output stream. |
void |
write(int b)
Writes the specified byte to our output stream.
|
void |
writeToGZip(byte[] b,
int off,
int len)
Writes byte array to gzip output stream.
|
protected int compressionThreshold
protected byte[] buffer
protected int bufferCount
protected java.util.zip.GZIPOutputStream gzipstream
protected boolean closed
protected int length
protected javax.servlet.http.HttpServletResponse response
protected javax.servlet.ServletOutputStream output
public GzipResponseStream(javax.servlet.http.HttpServletResponse response)
throws java.io.IOException
java.io.IOExceptionprotected void setBuffer(int threshold)
public boolean isReady()
isReady in class javax.servlet.ServletOutputStreampublic void setWriteListener(javax.servlet.WriteListener writeListener)
setWriteListener in class javax.servlet.ServletOutputStreampublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOExceptionpublic void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOExceptionpublic void flushToGZip()
throws java.io.IOException
java.io.IOExceptionpublic void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void write(byte[] b)
throws java.io.IOException
b.length bytes from the specified byte array to our
output stream.write in class java.io.OutputStreamjava.io.IOExceptionpublic void write(byte[] b,
int off,
int len)
throws java.io.IOException
len bytes from the specified byte array, starting at
the specified offset, to our output stream.write in class java.io.OutputStreamb - byte array containing the bytes to be writtenoff - zero-relative starting offset of the bytes to be writtenlen - number of bytes to be writtenjava.io.IOExceptionpublic void writeToGZip(byte[] b,
int off,
int len)
throws java.io.IOException
GZIPOutputStream
if not created yet. Also sets the "Content-Encoding" header.java.io.IOExceptionpublic boolean closed()
true if this response stream been closed.Copyright © 2003-present Jodd Team