Am I closing my input stream correctly in Java?
问题 I created a class that extends InputStream so that I can keep count of the number of bytes being read and throw an exception if it exceeds a max limit that I define. Here is my class: public class LimitedSizeInputStream extends InputStream { private final InputStream original; private final long maxSize; private long total; public LimitedSizeInputStream(InputStream original, long maxSize) { this.original = original; this.maxSize = maxSize; } @Override public int read() throws IOException {