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:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-