org.eclipse.jetty.http.gzip
类 AbstractCompressedStream

java.lang.Object
  继承者 java.io.OutputStream
      继承者 javax.servlet.ServletOutputStream
          继承者 org.eclipse.jetty.http.gzip.AbstractCompressedStream
所有已实现的接口:
Closeable, Flushable

public abstract class AbstractCompressedStream
extends ServletOutputStream

Skeletal implementation of a CompressedStream. This class adds compression features to a ServletOutputStream and takes care of setting response headers, etc. Major work and configuration is done here. Subclasses using different kinds of compression only have to implement the abstract methods doCompress() and setContentEncoding() using the desired compression and setting the appropriate Content-Encoding header string.


字段摘要
protected  ByteArrayOutputStream2 _bOut
           
protected  boolean _closed
           
protected  DeflaterOutputStream _compressedOutputStream
           
protected  boolean _doNotCompress
           
protected  OutputStream _out
           
protected  HttpServletResponse _response
           
protected  String _vary
           
protected  CompressedResponseWrapper _wrapper
           
 
构造方法摘要
AbstractCompressedStream(String encoding, HttpServletRequest request, CompressedResponseWrapper wrapper, String vary)
          Instantiates a new compressed stream.
 
方法摘要
protected  void addHeader(String name, String value)
           
 void close()
           
protected abstract  DeflaterOutputStream createStream()
          Create the stream fitting to the underlying compression type.
 void doCompress()
          Do compress.
 void doNotCompress(boolean sendVary)
          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 setBufferSize(int bufferSize)
           
 void setContentLength()
           
protected  void setHeader(String name, String value)
           
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
从类 javax.servlet.ServletOutputStream 继承的方法
print, print, print, print, print, print, print, println, println, println, println, println, println, println, println
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

_vary

protected final String _vary

_wrapper

protected final CompressedResponseWrapper _wrapper

_response

protected final HttpServletResponse _response

_out

protected OutputStream _out

_bOut

protected ByteArrayOutputStream2 _bOut

_compressedOutputStream

protected DeflaterOutputStream _compressedOutputStream

_closed

protected boolean _closed

_doNotCompress

protected boolean _doNotCompress
构造方法详细信息

AbstractCompressedStream

public AbstractCompressedStream(String encoding,
                                HttpServletRequest request,
                                CompressedResponseWrapper wrapper,
                                String vary)
                         throws IOException
Instantiates a new compressed stream.

抛出:
IOException
方法详细信息

resetBuffer

public void resetBuffer()
Reset buffer.


setBufferSize

public void setBufferSize(int bufferSize)

setContentLength

public void setContentLength()

flush

public void flush()
           throws IOException
指定者:
接口 Flushable 中的 flush
覆盖:
OutputStream 中的 flush
抛出:
IOException
另请参见:
OutputStream.flush()

close

public void close()
           throws IOException
指定者:
接口 Closeable 中的 close
覆盖:
OutputStream 中的 close
抛出:
IOException
另请参见:
OutputStream.close()

finish

public void finish()
            throws IOException
Finish.

抛出:
IOException - Signals that an I/O exception has occurred.

write

public void write(int b)
           throws IOException
指定者:
OutputStream 中的 write
抛出:
IOException
另请参见:
OutputStream.write(int)

write

public void write(byte[] b)
           throws IOException
覆盖:
OutputStream 中的 write
抛出:
IOException
另请参见:
OutputStream.write(byte[])

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
覆盖:
OutputStream 中的 write
抛出:
IOException
另请参见:
OutputStream.write(byte[], int, int)

doCompress

public void doCompress()
                throws IOException
Do compress.

抛出:
IOException - Signals that an I/O exception has occurred.

doNotCompress

public void doNotCompress(boolean sendVary)
                   throws IOException
Do not compress.

抛出:
IOException - Signals that an I/O exception has occurred.

getOutputStream

public OutputStream getOutputStream()
另请参见:
org.eclipse.jetty.http.gzip.CompressedStream#getOutputStream()

isClosed

public boolean isClosed()
另请参见:
org.eclipse.jetty.http.gzip.CompressedStream#isClosed()

newWriter

protected PrintWriter newWriter(OutputStream out,
                                String encoding)
                         throws UnsupportedEncodingException
Allows derived implementations to replace PrintWriter implementation.

抛出:
UnsupportedEncodingException

addHeader

protected void addHeader(String name,
                         String value)

setHeader

protected void setHeader(String name,
                         String value)

createStream

protected abstract DeflaterOutputStream createStream()
                                              throws IOException
Create the stream fitting to the underlying compression type.

抛出:
IOException - Signals that an I/O exception has occurred.


Copyright © 2013. All Rights Reserved.