public class GzipStream extends ServletOutputStream
Modifier and Type | Field and Description |
---|---|
protected ByteArrayOutputStream2 |
_bOut |
protected int |
_bufferSize |
protected boolean |
_closed |
protected long |
_contentLength |
protected boolean |
_doNotGzip |
protected GZIPOutputStream |
_gzOut |
protected int |
_minGzipSize |
protected OutputStream |
_out |
protected HttpServletRequest |
_request |
protected HttpServletResponse |
_response |
Constructor and Description |
---|
GzipStream(HttpServletRequest request,
HttpServletResponse response,
long contentLength,
int bufferSize,
int minGzipSize)
Instantiates a new gzip stream.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
doGzip()
Do gzip.
|
void |
doNotGzip()
Do not gzip.
|
void |
finish()
Finish.
|
void |
flush() |
protected PrintWriter |
newWriter(OutputStream out,
String encoding)
Allows derived implementations to replace PrintWriter implementation.
|
void |
resetBuffer()
Reset buffer.
|
protected boolean |
setContentEncodingGzip()
Sets the content encoding gzip.
|
void |
setContentLength(long length)
Sets the content length.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
protected HttpServletRequest _request
protected HttpServletResponse _response
protected OutputStream _out
protected ByteArrayOutputStream2 _bOut
protected GZIPOutputStream _gzOut
protected boolean _closed
protected int _bufferSize
protected int _minGzipSize
protected long _contentLength
protected boolean _doNotGzip
public GzipStream(HttpServletRequest request, HttpServletResponse response, long contentLength, int bufferSize, int minGzipSize) throws IOException
request
- the requestresponse
- the responsecontentLength
- the content lengthbufferSize
- the buffer sizeminGzipSize
- the min gzip sizeIOException
- Signals that an I/O exception has occurred.public void resetBuffer()
public void setContentLength(long length)
length
- the new content lengthpublic void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
OutputStream.flush()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
OutputStream.close()
public void finish() throws IOException
IOException
- Signals that an I/O exception has occurred.public void write(int b) throws IOException
write
in class OutputStream
IOException
OutputStream.write(int)
public void write(byte[] b) throws IOException
write
in class OutputStream
IOException
OutputStream.write(byte[])
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
OutputStream.write(byte[], int, int)
protected boolean setContentEncodingGzip()
public void doGzip() throws IOException
IOException
- Signals that an I/O exception has occurred.public void doNotGzip() throws IOException
IOException
- Signals that an I/O exception has occurred.protected PrintWriter newWriter(OutputStream out, String encoding) throws UnsupportedEncodingException
UnsupportedEncodingException
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.