T - The type of the underlying OutputStream.public class LimitOutputStream<T extends java.io.OutputStream>
extends java.io.OutputStream
OutputStream implementation used for limiting the number of bytes to be written to an underlying
OutputStream.
An InterruptedIOException is thrown as soon as the given limit is reached.
| Constructor and Description |
|---|
LimitOutputStream(T out,
long limit)
Construct
LimitOutputStream. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
T |
outputStream()
The underlying
OutputStream. |
void |
write(byte[] _b) |
void |
write(byte[] _b,
int off,
int len) |
void |
write(int b) |
public LimitOutputStream(T out, long limit)
LimitOutputStream.out - The output stream to limit.limit - The limit to apply.public T outputStream()
OutputStream.public void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void write(@Nullable byte[] _b) throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void write(@Nullable byte[] _b, int off, int len) throws java.io.IOException
write 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 close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOException