Package org.apache.james.mime4j.io
Class LimitedInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.apache.james.mime4j.io.PositionInputStream
-
- org.apache.james.mime4j.io.LimitedInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class LimitedInputStream extends PositionInputStream
-
-
Field Summary
Fields Modifier and Type Field Description private long
limit
-
Fields inherited from class org.apache.james.mime4j.io.PositionInputStream
position
-
-
Constructor Summary
Constructors Constructor Description LimitedInputStream(java.io.InputStream instream, long limit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
enforceLimit()
private int
getBytesLeft()
int
read()
int
read(byte[] b, int off, int len)
long
skip(long n)
-
Methods inherited from class org.apache.james.mime4j.io.PositionInputStream
available, close, getPosition, mark, markSupported, reset
-
-
-
-
Method Detail
-
enforceLimit
private void enforceLimit() throws java.io.IOException
- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException
- Overrides:
read
in classPositionInputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in classPositionInputStream
- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException
- Overrides:
skip
in classPositionInputStream
- Throws:
java.io.IOException
-
getBytesLeft
private int getBytesLeft()
-
-