*/
@Override
public synchronized int available() throws IOException {
+ if (remaining == 0) {
+ return 0;
+ }
return (int) Math.min(super.available(), Math.min(Integer.MAX_VALUE, remaining));
}
*/
@Override
public synchronized long skip(long n) throws IOException {
- if (n < 0) {
+ if ((n < 0) || (remaining == 0)) {
return 0;
}
long skipped = super.skip(Math.min(n, remaining));