Class BoundedInputStream

java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.apache.axis2.builder.BoundedInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class BoundedInputStream extends FilterInputStream
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.