Class CompressionResponseStream
java.lang.Object
java.io.OutputStream
jakarta.servlet.ServletOutputStream
org.jumpmind.symmetric.web.compression.CompressionResponseStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class CompressionResponseStream
extends jakarta.servlet.ServletOutputStream
Implementation of ServletOutputStream that works with the CompressionServletResponseWrapper implementation.
This package is derived from the Jakarta Tomcat examples compression filter and is distributed in SymmetricDS
for convenience.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanHas this stream been closed?protected OutputStreamThe underlying gzip output stream to which we should write data.protected jakarta.servlet.http.HttpServletResponseThe response with which this servlet output stream is associated. -
Constructor Summary
ConstructorsConstructorDescriptionCompressionResponseStream(jakarta.servlet.http.HttpServletResponse response, int compressionLevel, int compressionStrategy) Construct a servlet output stream associated with the specified Response. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close this output stream, causing any buffered data to be flushed and any further output data to throw an IOException.booleanclosed()Has this response stream been closed?voidflush()Flush any buffered data for this output stream, which also causes the response to be committed.booleanisReady()voidsetWriteListener(jakarta.servlet.WriteListener writeListener) voidwrite(byte[] b) Writeb.lengthbytes from the specified byte array to our output stream.voidwrite(byte[] b, int off, int len) Writelenbytes from the specified byte array, starting at the specified offset, to our output stream.voidwrite(int b) Write the specified byte to our output stream.Methods inherited from class jakarta.servlet.ServletOutputStream
print, print, print, print, print, print, print, println, println, println, println, println, println, println, printlnMethods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
gzipstream
The underlying gzip output stream to which we should write data. -
closed
protected boolean closedHas this stream been closed? -
response
protected jakarta.servlet.http.HttpServletResponse responseThe response with which this servlet output stream is associated.
-
-
Constructor Details
-
CompressionResponseStream
public CompressionResponseStream(jakarta.servlet.http.HttpServletResponse response, int compressionLevel, int compressionStrategy) throws IOException Construct a servlet output stream associated with the specified Response.- Parameters:
response- The associated response- Throws:
IOException
-
-
Method Details
-
close
Close this output stream, causing any buffered data to be flushed and any further output data to throw an IOException.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
flush
Flush any buffered data for this output stream, which also causes the response to be committed.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
write
Write the specified byte to our output stream.- Specified by:
writein classOutputStream- Parameters:
b- The byte to be written- Throws:
IOException- if an input/output error occurs
-
write
Writeb.lengthbytes from the specified byte array to our output stream.- Overrides:
writein classOutputStream- Parameters:
b- The byte array to be written- Throws:
IOException- if an input/output error occurs
-
write
Writelenbytes from the specified byte array, starting at the specified offset, to our output stream.- Overrides:
writein classOutputStream- Parameters:
b- The byte array containing the bytes to be writtenoff- Zero-relative starting offset of the bytes to be writtenlen- The number of bytes to be written- Throws:
IOException- if an input/output error occurs
-
isReady
public boolean isReady()- Specified by:
isReadyin classjakarta.servlet.ServletOutputStream
-
closed
public boolean closed()Has this response stream been closed? -
setWriteListener
public void setWriteListener(jakarta.servlet.WriteListener writeListener) - Specified by:
setWriteListenerin classjakarta.servlet.ServletOutputStream
-