public abstract class ThresholdingOutputStream extends OutputStream
| Modifier and Type | Field and Description |
|---|---|
protected OutputStream |
output |
| Constructor and Description |
|---|
ThresholdingOutputStream(OutputStream base,
int thresholdBytes) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkThreshold(int count)
Checks whether reading count bytes would cross the limit.
|
void |
close() |
void |
flush() |
int |
getThreshold() |
protected abstract void |
thresholdReached(int current,
int predicted)
Called when the threshold is about to be exceeded.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
protected OutputStream output
public ThresholdingOutputStream(OutputStream base, int thresholdBytes)
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(int b)
throws IOException
write in class OutputStreamIOExceptionprotected void checkThreshold(int count)
throws IOException
IOExceptionpublic int getThreshold()
protected abstract void thresholdReached(int current,
int predicted)
throws IOException
current - is the current number of bytes that have been writtenpredicted - is the total number after the write completesIOExceptionCopyright © 2006–2021. All rights reserved.