Package net.i2p.i2ptunnel.util
Class LimitOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
net.i2p.i2ptunnel.util.LimitOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
- Direct Known Subclasses:
ByteLimitOutputStream,DechunkedOutputStream
Base class for limiting writes and calling a callback when finished
- Since:
- 0.9.62
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final LimitOutputStream.DoneCallbackprotected booleanFields inherited from class java.io.FilterOutputStream
out -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanisDone()protected voidsetDone()flush(), call the callback, and set _isDonevoidwrite(byte[] buf, int off, int len) Subclasses MUST override the following method such that it calls done() when finished and throws EOFException if called againvoidwrite(int c) Methods inherited from class java.io.FilterOutputStream
close, flush, writeMethods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
_callback
-
_isDone
protected boolean _isDone
-
-
Constructor Details
-
LimitOutputStream
- Parameters:
done- non-null
-
-
Method Details
-
write
- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
write
Subclasses MUST override the following method such that it calls done() when finished and throws EOFException if called again- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
isDone
protected boolean isDone() -
setDone
flush(), call the callback, and set _isDone- Throws:
IOException
-