Package org.xnio.streams
Class LimitedOutputStream
java.lang.Object
java.io.OutputStream
org.xnio.streams.LimitedOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
An output stream which truncates the writable output to the given length. Attempting to exceed the
fixed limit will result in an exception.
- Author:
- David M. Lloyd
-
Constructor Summary
ConstructorsConstructorDescriptionLimitedOutputStream(OutputStream delegate, long size) Construct a new instance. -
Method Summary
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
Constructor Details
-
LimitedOutputStream
Construct a new instance.- Parameters:
delegate- the delegate output streamsize- the number of bytes to allow
-
-
Method Details
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-