Skip to content

Commit

Permalink
Large files have negative available bytes due to long to int type cas…
Browse files Browse the repository at this point in the history
…ting..
  • Loading branch information
davydotcom committed Jun 28, 2018
1 parent 459ee5d commit 5e8818d
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 5e8818d

Please sign in to comment.