Package com.sun.appserv.web.cache.filter
Class CachingOutputStreamWrapper
- java.lang.Object
-
- java.io.OutputStream
-
- jakarta.servlet.ServletOutputStream
-
- com.sun.appserv.web.cache.filter.CachingOutputStreamWrapper
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class CachingOutputStreamWrapper extends jakarta.servlet.ServletOutputStream
an output stream wrapper to cache response bytes
-
-
Constructor Summary
Constructors Constructor Description CachingOutputStreamWrapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close this output stream, causing any buffered data to be flushed and any further output data to throw an IOException.void
flush()
` Flush any buffered data for this output stream, which also causes the response to be committed.byte[]
getBytes()
return the cached bytesboolean
isReady()
This method can be used to determine if data can be written without blocking.void
setWriteListener(jakarta.servlet.WriteListener writeListener)
void
write(byte[] b)
Writeb.length
bytes from the specified byte array to our output stream.void
write(byte[] b, int off, int len)
Writelen
bytes from the specified byte array, starting at the specified offset, to our output stream.void
write(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, println
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Method Detail
-
write
public void write(int b) throws IOException
Write the specified byte to our output stream.- Specified by:
write
in classOutputStream
- Parameters:
b
- The byte to be written- Throws:
IOException
- if an input/output error occurs
-
write
public void write(byte[] b) throws IOException
Writeb.length
bytes from the specified byte array to our output stream.- Overrides:
write
in classOutputStream
- Parameters:
b
- The byte array to be written- Throws:
IOException
- if an input/output error occurs
-
write
public void write(byte[] b, int off, int len) throws IOException
Writelen
bytes from the specified byte array, starting at the specified offset, to our output stream.- Overrides:
write
in 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
-
flush
public void flush() throws IOException
` Flush any buffered data for this output stream, which also causes the response to be committed.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
public void close() throws IOException
Close this output stream, causing any buffered data to be flushed and any further output data to throw an IOException.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
isReady
public boolean isReady()
This method can be used to determine if data can be written without blocking.- Specified by:
isReady
in classjakarta.servlet.ServletOutputStream
- Returns:
- true if a write to this ServletOutputStream will succeed, otherwise returns false.
-
setWriteListener
public void setWriteListener(jakarta.servlet.WriteListener writeListener)
- Specified by:
setWriteListener
in classjakarta.servlet.ServletOutputStream
-
getBytes
public byte[] getBytes()
return the cached bytes
-
-