CH-Abhinav opened a new pull request, #17026:
URL: https://github.com/apache/lucene/pull/17026
Closes #16951
### Description
This PR updates the Javadocs for `IndexInput` and `RandomAccessInput` to
clarify expected stream state after I/O errors and document the contract for
obtaining random-access views:
1. **Undetermined state after `IOException`/`EOFException`**:
- Specified in `IndexInput` class documentation (and `seek(long)`) that
reading or seeking past the end of the file throws `EOFException`, and that
throwing any `IOException` (including `EOFException`) leaves the stream in an
undetermined state where it is recommended to close it rather than attempt
recovery or further reads.
- Added corresponding notes to `RandomAccessInput`.
2. **No direct casting to `RandomAccessInput`**:
- Added a warning in `IndexInput` and `RandomAccessInput` that casting an
`IndexInput` directly to `RandomAccessInput` is not supported (even if a
subclass implements that interface), as doing so can alter the `IndexInput`'s
internal file position or buffer state.
- Documented that `IndexInput#randomAccessSlice(long, long)` is the only
supported way to obtain a `RandomAccessInput`, which always returns an
independent slice.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]