org.apache.cxf.io
Class AbstractThresholdOutputStream
java.lang.Object
java.io.OutputStream
org.apache.cxf.io.AbstractWrappedOutputStream
org.apache.cxf.io.AbstractThresholdOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
- Direct Known Subclasses:
- HTTPConduit.WrappedOutputStream, SoapTcpOutputStream
public abstract class AbstractThresholdOutputStream
- extends AbstractWrappedOutputStream
Outputstream that will buffer a certain amount before writing anything to the underlying
stream. When the threshold is reached, provides a callback point to allow the
subclass to update headers, replace/set the output stream, etc...
Also provides a callback for when the stream is closed without it reaching the threshold.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
threshold
protected int threshold
buffer
protected LoadingByteArrayOutputStream buffer
AbstractThresholdOutputStream
public AbstractThresholdOutputStream(int threshold)
thresholdReached
public abstract void thresholdReached()
throws IOException
- Throws:
IOException
thresholdNotReached
public abstract void thresholdNotReached()
throws IOException
- Throws:
IOException
write
public void write(byte[] b,
int off,
int len)
throws IOException
- Overrides:
write
in class AbstractWrappedOutputStream
- Throws:
IOException
write
public void write(int b)
throws IOException
- Overrides:
write
in class AbstractWrappedOutputStream
- Throws:
IOException
unBuffer
public void unBuffer()
throws IOException
- Throws:
IOException
close
public void close()
throws IOException
- Specified by:
close
in interface Closeable
- Overrides:
close
in class AbstractWrappedOutputStream
- Throws:
IOException
Apache CXF