Package 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
,AutoCloseable
public class LimitedOutputStream extends FilterOutputStream
Pass data to the underlying system until a given amount of bytes is reached.
-
-
Field Summary
-
Fields inherited from class java.io.FilterOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description LimitedOutputStream(OutputStream out, int limit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getComputedBytes()
boolean
isLimited()
void
write(byte[] b, int off, int len)
void
write(int b)
-
Methods inherited from class java.io.FilterOutputStream
close, flush, write
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
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
-
-
Method Detail
-
write
public void write(byte[] b, int off, int len) throws IOException
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
write
public void write(int b) throws IOException
- Overrides:
write
in classFilterOutputStream
- 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.
-
-