Class GZIPResponseStream

java.lang.Object
java.io.OutputStream
javax.servlet.ServletOutputStream
de.hybris.platform.util.GZIPResponseStream
All Implemented Interfaces:
Closeable, Flushable, 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

    Modifier and Type
    Method
    Description
    protected String
     
    void
    Closes this stream (which implies finishing the underlying GZIPOutputStream, adding correct response headers and flushing/closing the outputstream).
    boolean
    Returns true if this stream has been closed (using close()).
    protected boolean
     
    void
    Flushes this stream (and thus flushes the underlying GZIPOutputStream).
    boolean
     
    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 Details

    • GZIPResponseStream

      public GZIPResponseStream(javax.servlet.http.HttpServletResponse response, boolean captureText) throws 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:
      IOException
  • Method Details

    • filterOutput

      protected boolean filterOutput()
    • flush

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

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

      protected String applyRegExp(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 IOException
      Writes the given byte to this stream (and thus to the underlying GZIPOutputStream).
      Specified by:
      write in class OutputStream
      Throws:
      IOException
    • write

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

      public void write(byte[] b, int off, int len) throws IOException
      Writes the given byte array to this stream (and thus to the underlying GZIPOutputStream).
      Overrides:
      write in class OutputStream
      Throws:
      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