Skip to content

[IO-855] Clarify PeekableInputStream.peek() behavior in Javadoc#856

Merged
garydgregory merged 1 commit into
apache:masterfrom
sarankumarbaskar:IO-855-clarify-peekable-input-stream-peek
Jun 11, 2026
Merged

[IO-855] Clarify PeekableInputStream.peek() behavior in Javadoc#856
garydgregory merged 1 commit into
apache:masterfrom
sarankumarbaskar:IO-855-clarify-peekable-input-stream-peek

Conversation

@sarankumarbaskar

Copy link
Copy Markdown
Contributor

PeekableInputStream.peek() currently performs an exact match against the provided byte array, but the Javadoc could be read as a prefix / starts-with check.
This PR clarifies the Javadoc to state that peek() requires an exact match and does not consume bytes from the stream.
It also adds tests covering:

  • exact match returns true
  • prefix-only match returns false
  • peek() does not consume bytes
    Resolves IO-855

Checklist:

  • Read the contribution guidelines for this project.
  • Read the ASF Generative Tooling Guidance.
  • Ran mvn -Drat.skip=true -Dtest=PeekableInputStreamTest test
  • Added unit tests matching the documented behavior.

Add tests for exact-match and non-consuming behavior.
@garydgregory garydgregory changed the title [IO-855] Clarify PeekableInputStream.peek() behavior [IO-855] Clarify PeekableInputStream.peek() behavior in Javadoc Jun 11, 2026
@garydgregory garydgregory merged commit a27e4e3 into apache:master Jun 11, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants