Package com.helger.servlet.response.gzip
Class AbstractCompressedServletOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- jakarta.servlet.ServletOutputStream
-
- com.helger.servlet.io.AbstractServletOutputStream
-
- com.helger.servlet.response.gzip.AbstractCompressedServletOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
- Direct Known Subclasses:
DeflateResponse.DeflateServletOutputStream,GZIPResponse.GZIPServletOutputStream
public abstract class AbstractCompressedServletOutputStream extends AbstractServletOutputStream
SpecialServletOutputStreamthat knows whether it is closed or not- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description AbstractCompressedServletOutputStream(jakarta.servlet.http.HttpServletRequest aHttpRequest, jakarta.servlet.http.HttpServletResponse aHttpResponse, String sContentEncoding, long nContentLength, long nMinCompressSize)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()protected abstract DeflaterOutputStreamcreateDeflaterOutputStream(OutputStream aOS)voiddoCompress(String sDebugInfo)voiddoNotCompress(String sDebugInfo)voidfinishAndClose()voidflush()OutputStreamgetOutputStream()booleanisClosed()voidresetBuffer()voidsetContentLength(long nLength)voidwrite(byte[] aBytes)voidwrite(byte[] aBytes, int nOfs, int nLen)voidwrite(int nByte)-
Methods inherited from class com.helger.servlet.io.AbstractServletOutputStream
isReady, setWriteListener
-
Methods inherited from class jakarta.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
-
-
-
-
Constructor Detail
-
AbstractCompressedServletOutputStream
public AbstractCompressedServletOutputStream(@Nonnull jakarta.servlet.http.HttpServletRequest aHttpRequest, @Nonnull jakarta.servlet.http.HttpServletResponse aHttpResponse, @Nonnull String sContentEncoding, long nContentLength, @Nonnegative long nMinCompressSize) throws IOException
- Throws:
IOException
-
-
Method Detail
-
resetBuffer
public final void resetBuffer()
-
setContentLength
public final void setContentLength(long nLength)
-
createDeflaterOutputStream
@Nonnull protected abstract DeflaterOutputStream createDeflaterOutputStream(@Nonnull OutputStream aOS) throws IOException
- Throws:
IOException
-
doCompress
public final void doCompress(@Nullable String sDebugInfo) throws IOException
- Throws:
IOException
-
doNotCompress
public final void doNotCompress(String sDebugInfo) throws IOException
- Throws:
IOException
-
flush
public final void flush() throws IOException- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
public final void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
isClosed
public final boolean isClosed()
-
finishAndClose
public final void finishAndClose() throws IOException- Throws:
IOException
-
write
public final void write(int nByte) throws IOException- Specified by:
writein classOutputStream- Throws:
IOException
-
write
public final void write(@Nonnull byte[] aBytes) throws IOException
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
public final void write(@Nonnull byte[] aBytes, @Nonnegative int nOfs, @Nonnegative int nLen) throws IOException
- Overrides:
writein classOutputStream- Throws:
IOException
-
getOutputStream
@Nullable public final OutputStream getOutputStream()
-
-