Package org.apache.axis2.builder
Class BoundedInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.apache.axis2.builder.BoundedInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
An
InputStream that fails once more than a fixed number of bytes has
been read from it.
This deliberately throws rather than reporting end-of-stream at the limit,
the way org.apache.commons.io.input.BoundedInputStream does. A builder
that silently saw EOF would parse a truncated body and hand the service a
partial message, which is worse than rejecting an over-sized request.
-
Field Summary
Fields inherited from class java.io.FilterInputStream
in -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintread()intread(byte[] b, int off, int len) longskip(long n) static InputStreamwrap(InputStream in, long maxBytes) Wrap a stream, unless no bound was requested.Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, resetMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
BoundedInputStream
-
-
Method Details
-
wrap
Wrap a stream, unless no bound was requested.- Parameters:
in- the stream to boundmaxBytes- the ceiling in bytes, orRequestSizeLimits.UNLIMITED- Returns:
- a bounded view of the stream, or
initself when unbounded
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classFilterInputStream- Throws:
IOException
-