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 longprivate static final Stringprivate final Stringprivate final InputStreamprivate final longprivate 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:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
markin classInputStream
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
getLimit
public long getLimit()
-