XNIO API 3.0.4.GA

org.xnio.streams
Class LimitedOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by 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

Constructor Summary
LimitedOutputStream(OutputStream delegate, long size)
          Construct a new instance.
 
Method Summary
 void close()
          
 void flush()
          
 void write(byte[] b, int off, int len)
          
 void write(int b)
          
 
Methods inherited from class java.io.OutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LimitedOutputStream

public LimitedOutputStream(OutputStream delegate,
                           long size)
Construct a new instance.

Parameters:
delegate - the delegate output stream
size - the number of bytes to allow
Method Detail

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

XNIO API 3.0.4.GA

Copyright © 2010 JBoss, a division of Red Hat, Inc.