Skip to content

Commit dc1df1d

Browse files
committed
Reuse Math
1 parent ce3a2bb commit dc1df1d

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/main/java/org/apache/commons/io/input/RandomAccessFileInputStream.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,7 @@ public RandomAccessFileInputStream(final RandomAccessFile file, final boolean pr
166166
*/
167167
@Override
168168
public int available() throws IOException {
169-
final long avail = availableLong();
170-
if (avail > Integer.MAX_VALUE) {
171-
return Integer.MAX_VALUE;
172-
}
173-
return (int) avail;
169+
return Math.toIntExact(Math.min(availableLong(), Integer.MAX_VALUE));
174170
}
175171

176172
/**

0 commit comments

Comments
 (0)