public class ByteLimitOutputStream extends LimitOutputStream
EOFException when the limit is exceeded.LimitOutputStream.DoneCallback_callback, _isDoneout| Constructor and Description |
|---|
ByteLimitOutputStream(OutputStream out,
LimitOutputStream.DoneCallback done,
long limit)Creates a new byte-limited output stream. |
| Modifier and Type | Method and Description |
|---|---|
void | write(byte[] src,
int off,
int len)Subclasses MUST override the following method
such that it calls done() when finished
and throws EOFException if called again |
isDone, setDone, writeclose, flush, writepublic ByteLimitOutputStream(OutputStream out, LimitOutputStream.DoneCallback done, long limit)
out - the underlying output streamdone - callback invoked when the limit is reachedlimit - maximum number of bytes allowed, must be greater than zeroIllegalArgumentException - if limit is not greater than zeropublic void write(byte[] src,
int off,
int len)
throws IOExceptionLimitOutputStreamwrite in class LimitOutputStreamIOException