org.apache.james.jdkim.canon
Class LimitedOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.apache.james.jdkim.canon.LimitedOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
public class LimitedOutputStream
- extends FilterOutputStream
Pass data to the underlying system until a given amount of bytes is reached.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LimitedOutputStream
public LimitedOutputStream(OutputStream out,
int limit)
- Parameters:
out
- an output stream that will receive the "trucated" stream.limit
- a positive integer of the number of bytes to be passed to
the underlying stream
write
public void write(byte[] b,
int off,
int len)
throws IOException
- Overrides:
write
in class FilterOutputStream
- Throws:
IOException
write
public void write(int b)
throws IOException
- Overrides:
write
in class FilterOutputStream
- Throws:
IOException
getComputedBytes
public int getComputedBytes()
- Returns:
- the number of bytes passed to the underlying stream
isLimited
public boolean isLimited()
- Returns:
- true if the limit has been reached and no data is being passed to
the underlying stream.
Copyright © 2008-2009 The Apache Software Foundation. All Rights Reserved.