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