Override available() in RandomAccessDataFile's InputStream

See gh-29295
This commit is contained in:
Gnaily 2022-01-09 21:59:58 +08:00 committed by Andy Wilkinson
parent c761dc517b
commit 49bf620f4b
1 changed files with 5 additions and 0 deletions

View File

@ -180,6 +180,11 @@ public class RandomAccessDataFile implements RandomAccessData {
return (n <= 0) ? 0 : moveOn(cap(n));
}
@Override
public int available() throws IOException {
return (int) RandomAccessDataFile.this.length - this.position;
}
/**
* Cap the specified value such that it cannot exceed the number of bytes
* remaining.