Class GZIPResponseStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public class GZIPResponseStream
    extends javax.servlet.ServletOutputStream
    This is an implementation of a ServletOutputStream which uses a GZIPOutputStream to provide gzip compression for a HttpServletResponse (see GZIPResponseWrapper).
    • Constructor Summary

      Constructors 
      Constructor Description
      GZIPResponseStream​(javax.servlet.http.HttpServletResponse response, boolean captureText)
      Creates a new GZIPOutputStream which is an implementation of a ServletOutputStream which uses a GZIPOutputStream to provide gzip compression for a HttpServletResponse (see GZIPResponseWrapper).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String applyRegExp​(java.lang.StringBuilder complete)  
      void close()
      Closes this stream (which implies finishing the underlying GZIPOutputStream, adding correct response headers and flushing/closing the outputstream).
      boolean closed()
      Returns true if this stream has been closed (using close()).
      protected boolean filterOutput()  
      void flush()
      Flushes this stream (and thus flushes the underlying GZIPOutputStream).
      boolean isReady()  
      void setWriteListener​(javax.servlet.WriteListener writeListener)  
      void write​(byte[] b)
      Writes the given byte array to this stream (and thus to the underlying GZIPOutputStream).
      void write​(byte[] b, int off, int len)
      Writes the given byte array to this stream (and thus to the underlying GZIPOutputStream).
      void write​(int b)
      Writes the given byte to this stream (and thus to the underlying GZIPOutputStream).
      • Methods inherited from class javax.servlet.ServletOutputStream

        print, print, print, print, print, print, print, println, println, println, println, println, println, println, println
      • Methods inherited from class java.io.OutputStream

        nullOutputStream
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GZIPResponseStream

        public GZIPResponseStream​(javax.servlet.http.HttpServletResponse response,
                                  boolean captureText)
                           throws java.io.IOException
        Creates a new GZIPOutputStream which is an implementation of a ServletOutputStream which uses a GZIPOutputStream to provide gzip compression for a HttpServletResponse (see GZIPResponseWrapper).
        Throws:
        java.io.IOException
    • Method Detail

      • filterOutput

        protected boolean filterOutput()
      • flush

        public void flush()
                   throws java.io.IOException
        Flushes this stream (and thus flushes the underlying GZIPOutputStream).
        Specified by:
        flush in interface java.io.Flushable
        Overrides:
        flush in class java.io.OutputStream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Closes this stream (which implies finishing the underlying GZIPOutputStream, adding correct response headers and flushing/closing the outputstream).
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.OutputStream
        Throws:
        java.io.IOException
      • applyRegExp

        protected java.lang.String applyRegExp​(java.lang.StringBuilder complete)
      • closed

        public boolean closed()
        Returns true if this stream has been closed (using close()).
        Returns:
        true if this stream has been closed
      • write

        public void write​(int b)
                   throws java.io.IOException
        Writes the given byte to this stream (and thus to the underlying GZIPOutputStream).
        Specified by:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • write

        public void write​(byte[] b)
                   throws java.io.IOException
        Writes the given byte array to this stream (and thus to the underlying GZIPOutputStream).
        Overrides:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • write

        public void write​(byte[] b,
                          int off,
                          int len)
                   throws java.io.IOException
        Writes the given byte array to this stream (and thus to the underlying GZIPOutputStream).
        Overrides:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • isReady

        public boolean isReady()
        Specified by:
        isReady in class javax.servlet.ServletOutputStream
      • setWriteListener

        public void setWriteListener​(javax.servlet.WriteListener writeListener)
        Specified by:
        setWriteListener in class javax.servlet.ServletOutputStream