public abstract class ThresholdingOutputStream
extends java.io.OutputStream
| Modifier and Type | Field and Description |
|---|---|
protected java.io.OutputStream |
output |
| Constructor and Description |
|---|
ThresholdingOutputStream(java.io.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) |
public ThresholdingOutputStream(java.io.OutputStream base,
int thresholdBytes)
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOExceptionpublic void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOExceptionpublic void write(byte[] b,
int off,
int len)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void write(byte[] b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionprotected void checkThreshold(int count)
throws java.io.IOException
java.io.IOExceptionpublic int getThreshold()
protected abstract void thresholdReached(int current,
int predicted)
throws java.io.IOException
current - is the current number of bytes that have been writtenpredicted - is the total number after the write completesjava.io.IOExceptionCopyright © 2006-2013. All Rights Reserved.