Package org.apache.nifi.stream.io
Class MaxLengthInputStream
java.lang.Object
java.io.InputStream
org.apache.nifi.stream.io.MaxLengthInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate long
private static final String
private final String
private final InputStream
private final long
private long
-
Constructor Summary
ConstructorsConstructorDescriptionMaxLengthInputStream
(InputStream in, long limit) Constructs an input stream that will throw an exception if reading past a maximum length of bytes. -
Method Summary
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
ERROR_MESSAGE_FORMAT
- See Also:
-
in
-
limit
private final long limit -
bytesRead
private long bytesRead -
markOffset
private long markOffset -
errorMessage
-
-
Constructor Details
-
MaxLengthInputStream
Constructs an input stream that will throw an exception if reading past a maximum length of bytes.- Parameters:
in
- the underlying input streamlimit
- maximum length of bytes to read from underlying input stream
-
-
Method Details
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
available
- Overrides:
available
in classInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
mark
in classInputStream
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classInputStream
-
reset
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
getLimit
public long getLimit()
-