Package media
Class LimitedInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- media.LimitedInputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class LimitedInputStream extends FilterInputStream
Stream che permette la lettura di byte fino a un limite arbitrario.
Se il limite fissato viene superato, un ulteriore tentativo di lettura provoca il lancio di una
ReadLimitExceededException
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description LimitedInputStream(InputStream in, long byteLimit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
-
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, reset, skip
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
LimitedInputStream
public LimitedInputStream(InputStream in, long byteLimit)
-
-
Method Detail
-
read
public int read() throws IOException
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
public int read(byte[] b) throws IOException
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
-