}
/**
- * Tries to parse the given string into an int, returning <code>-1</code> if
- * the string can not be parsed.
+ * Tries to parse the given string into an int, returning <code>-1</code>
+ * if the string can not be parsed.
*
* @param value
* The string to parse
throw new EOFException("stream reached eof");
}
destination.write(buffer, 0, read);
- remaining -= read;
+ if (remaining > 0) {
+ remaining -= read;
+ }
}
}