Package io.protostuff
Class LimitedInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- io.protostuff.LimitedInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public final class LimitedInputStream extends java.io.FilterInputStream
An InputStream implementations which reads from some other InputStream but is limited to a particular number of bytes.
-
-
Field Summary
Fields Modifier and Type Field Description private int
limit
-
Constructor Summary
Constructors Constructor Description LimitedInputStream(java.io.InputStream in)
LimitedInputStream(java.io.InputStream in, int limit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
(package private) LimitedInputStream
limit(int limit)
int
read()
int
read(byte[] b, int off, int len)
long
skip(long n)
-
-
-
Method Detail
-
limit
LimitedInputStream limit(int limit)
-
available
public int available() throws java.io.IOException
- Overrides:
available
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException
- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException
- Overrides:
skip
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
-