public abstract class AbstractCompressedStream
extends javax.servlet.ServletOutputStream
| Modifier and Type | Field and Description |
|---|---|
protected ByteArrayOutputStream2 |
_bOut |
protected int |
_bufferSize |
protected boolean |
_closed |
protected java.util.zip.DeflaterOutputStream |
_compressedOutputStream |
protected long |
_contentLength |
protected boolean |
_doNotCompress |
protected int |
_minCompressSize |
protected java.io.OutputStream |
_out |
protected javax.servlet.http.HttpServletRequest |
_request |
protected javax.servlet.http.HttpServletResponse |
_response |
| Constructor and Description |
|---|
AbstractCompressedStream(java.lang.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 java.util.zip.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() |
java.io.OutputStream |
getOutputStream() |
boolean |
isClosed() |
protected java.io.PrintWriter |
newWriter(java.io.OutputStream out,
java.lang.String encoding)
Allows derived implementations to replace PrintWriter implementation.
|
void |
resetBuffer()
Reset buffer.
|
void |
setContentLength(long length)
Sets the content length.
|
protected void |
setHeader(java.lang.String name,
java.lang.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 java.io.OutputStream _out
protected ByteArrayOutputStream2 _bOut
protected java.util.zip.DeflaterOutputStream _compressedOutputStream
protected boolean _closed
protected int _bufferSize
protected int _minCompressSize
protected long _contentLength
protected boolean _doNotCompress
public AbstractCompressedStream(java.lang.String encoding,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
long contentLength,
int bufferSize,
int minCompressSize)
throws java.io.IOException
request - the requestresponse - the responsecontentLength - the content lengthbufferSize - the buffer sizeminCompressSize - the min compress sizejava.io.IOException - Signals that an I/O exception has occurred.public void resetBuffer()
public void setContentLength(long length)
length - the new content lengthpublic void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOExceptionOutputStream.flush()public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOExceptionOutputStream.close()public void finish()
throws java.io.IOException
java.io.IOException - Signals that an I/O exception has occurred.public void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionOutputStream.write(int)public void write(byte[] b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionOutputStream.write(byte[])public void write(byte[] b,
int off,
int len)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionOutputStream.write(byte[], int, int)public void doCompress()
throws java.io.IOException
java.io.IOException - Signals that an I/O exception has occurred.public void doNotCompress()
throws java.io.IOException
java.io.IOException - Signals that an I/O exception has occurred.public java.io.OutputStream getOutputStream()
CompressedStreampublic boolean isClosed()
CompressedStreamprotected java.io.PrintWriter newWriter(java.io.OutputStream out,
java.lang.String encoding)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingExceptionprotected void setHeader(java.lang.String name,
java.lang.String value)
protected abstract java.util.zip.DeflaterOutputStream createStream()
throws java.io.IOException
java.io.IOException - Signals that an I/O exception has occurred.Copyright © 2013 FuseSource, Corp.. All Rights Reserved.