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.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
protected void checkThreshold(int count) throws java.io.IOException
java.io.IOException
public 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.IOException
Copyright © 2006–2018. All rights reserved.