Package de.hybris.platform.util
Class GZIPResponseStream
- java.lang.Object
-
- java.io.OutputStream
-
- javax.servlet.ServletOutputStream
-
- de.hybris.platform.util.GZIPResponseStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class GZIPResponseStream extends javax.servlet.ServletOutputStreamThis is an implementation of a ServletOutputStream which uses a GZIPOutputStream to provide gzip compression for a HttpServletResponse (seeGZIPResponseWrapper).
-
-
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 (seeGZIPResponseWrapper).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringapplyRegExp(java.lang.StringBuilder complete)voidclose()Closes this stream (which implies finishing the underlying GZIPOutputStream, adding correct response headers and flushing/closing the outputstream).booleanclosed()Returns true if this stream has been closed (usingclose()).protected booleanfilterOutput()voidflush()Flushes this stream (and thus flushes the underlying GZIPOutputStream).booleanisReady()voidsetWriteListener(javax.servlet.WriteListener writeListener)voidwrite(byte[] b)Writes the given byte array to this stream (and thus to the underlying GZIPOutputStream).voidwrite(byte[] b, int off, int len)Writes the given byte array to this stream (and thus to the underlying GZIPOutputStream).voidwrite(int b)Writes the given byte to this stream (and thus to the underlying GZIPOutputStream).
-
-
-
Constructor Detail
-
GZIPResponseStream
public GZIPResponseStream(javax.servlet.http.HttpServletResponse response, boolean captureText) throws java.io.IOExceptionCreates a new GZIPOutputStream which is an implementation of a ServletOutputStream which uses a GZIPOutputStream to provide gzip compression for a HttpServletResponse (seeGZIPResponseWrapper).- Throws:
java.io.IOException
-
-
Method Detail
-
filterOutput
protected boolean filterOutput()
-
flush
public void flush() throws java.io.IOExceptionFlushes this stream (and thus flushes the underlying GZIPOutputStream).- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionCloses this stream (which implies finishing the underlying GZIPOutputStream, adding correct response headers and flushing/closing the outputstream).- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.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 (usingclose()).- Returns:
- true if this stream has been closed
-
write
public void write(int b) throws java.io.IOExceptionWrites the given byte to this stream (and thus to the underlying GZIPOutputStream).- Specified by:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] b) throws java.io.IOExceptionWrites the given byte array to this stream (and thus to the underlying GZIPOutputStream).- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOExceptionWrites the given byte array to this stream (and thus to the underlying GZIPOutputStream).- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
isReady
public boolean isReady()
- Specified by:
isReadyin classjavax.servlet.ServletOutputStream
-
setWriteListener
public void setWriteListener(javax.servlet.WriteListener writeListener)
- Specified by:
setWriteListenerin classjavax.servlet.ServletOutputStream
-
-