Module org.elasticsearch.xcore
Class SimpleBoundedInputStream
java.lang.Object
java.io.InputStream
org.elasticsearch.xpack.core.ml.inference.utils.SimpleBoundedInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
This is a pared down bounded input stream.
Only read is specifically enforced.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
SimpleBoundedInputStream
-
-
Method Details
-
read
A simple wrapper around the injected input stream that restricts the total number of bytes able to be read.- Specified by:
readin classInputStream- Returns:
- The byte read.
- Throws:
SimpleBoundedInputStream.StreamSizeExceededException- when byte limit is exceededIOException- on failure
-
close
Delegates `close` to the wrapped InputStream- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException- on failure
-