org.xnio.streams
Class LimitedOutputStream
java.lang.Object
java.io.OutputStream
org.xnio.streams.LimitedOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
public final class LimitedOutputStream
- extends OutputStream
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LimitedOutputStream
public LimitedOutputStream(OutputStream delegate,
long size)
- Construct a new instance.
- Parameters:
delegate
- the delegate output streamsize
- the number of bytes to allow
write
public void write(int b)
throws IOException
-
- Specified by:
write
in class OutputStream
- Throws:
IOException
write
public void write(byte[] b,
int off,
int len)
throws IOException
-
- Overrides:
write
in class OutputStream
- Throws:
IOException
flush
public void flush()
throws IOException
-
- Specified by:
flush
in interface Flushable
- Overrides:
flush
in class OutputStream
- Throws:
IOException
close
public void close()
throws IOException
-
- Specified by:
close
in interface Closeable
- Overrides:
close
in class OutputStream
- Throws:
IOException
Copyright © 2010 JBoss, a division of Red Hat, Inc.