public abstract class AbstractCompressedStream
extends javax.servlet.ServletOutputStream
| Modifier and Type | Field and Description |
|---|---|
protected ByteArrayOutputStream2 |
_bOut |
protected int |
_bufferSize |
protected boolean |
_closed |
protected DeflaterOutputStream |
_compressedOutputStream |
protected long |
_contentLength |
protected boolean |
_doNotCompress |
protected int |
_minCompressSize |
protected OutputStream |
_out |
protected javax.servlet.http.HttpServletRequest |
_request |
protected javax.servlet.http.HttpServletResponse |
_response |
| Constructor and Description |
|---|
AbstractCompressedStream(String encoding,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
long contentLength,
int bufferSize,
int minCompressSize)
Instantiates a new compressed stream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected abstract DeflaterOutputStream |
createStream()
Create the stream fitting to the underlying compression type.
|
void |
doCompress()
Do compress.
|
void |
doNotCompress()
Do not compress.
|
void |
finish()
Finish.
|
void |
flush() |
OutputStream |
getOutputStream() |
boolean |
isClosed() |
protected PrintWriter |
newWriter(OutputStream out,
String encoding)
Allows derived implementations to replace PrintWriter implementation.
|
void |
resetBuffer()
Reset buffer.
|
void |
setContentLength(long length)
Sets the content length.
|
protected void |
setHeader(String name,
String value) |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
protected javax.servlet.http.HttpServletRequest _request
protected javax.servlet.http.HttpServletResponse _response
protected OutputStream _out
protected ByteArrayOutputStream2 _bOut
protected DeflaterOutputStream _compressedOutputStream
protected boolean _closed
protected int _bufferSize
protected int _minCompressSize
protected long _contentLength
protected boolean _doNotCompress
public AbstractCompressedStream(String encoding, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, long contentLength, int bufferSize, int minCompressSize) throws IOException
request - the requestresponse - the responsecontentLength - the content lengthbufferSize - the buffer sizeminCompressSize - the min compress 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 Flushableflush in class OutputStreamIOExceptionOutputStream.flush()public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionOutputStream.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 OutputStreamIOExceptionOutputStream.write(int)public void write(byte[] b)
throws IOException
write in class OutputStreamIOExceptionOutputStream.write(byte[])public void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionOutputStream.write(byte[], int, int)public void doCompress()
throws IOException
IOException - Signals that an I/O exception has occurred.public void doNotCompress()
throws IOException
IOException - Signals that an I/O exception has occurred.public OutputStream getOutputStream()
CompressedStreampublic boolean isClosed()
CompressedStreamprotected PrintWriter newWriter(OutputStream out, String encoding) throws UnsupportedEncodingException
UnsupportedEncodingExceptionprotected abstract DeflaterOutputStream createStream() throws IOException
IOException - Signals that an I/O exception has occurred.Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.