Skip to content

Commit

Permalink
Merge pull request #21 from davydotcom/patch-1
Browse files Browse the repository at this point in the history
Large files have negative available bytes due to long to int type cas…
  • Loading branch information
DavidASeibert committed Jul 26, 2018
2 parents 459ee5d + 5e8818d commit ec62b41
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private byte[] makeBytes(int maximumBufferSize) throws IOException {
*/
public int available() throws IOException {
checkForClosed();
return (int) (_file.length() - _offset + bytesLeftInBuffer());
return (int) Math.min(_file.length() - _offset + bytesLeftInBuffer(), Integer.MAX_VALUE);
}

/*
Expand Down

0 comments on commit ec62b41

Please sign in to comment.