-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Len = 0 and Insufficient Buffer behaviours for positioned reads (#…
…203) ## Description of change According to InputStream documentation Len = 0 should return 0 `If len is zero, then no bytes are read and 0 is returned;` Following the InputStream implementation, this commit is adding argument checks to Positioned Reads. This validation is implemented in the SeekableInputStream to ensure all subclasses behave the same way in the unhappy path. Checks are done in the same order with InputStream implementation. #### Relevant issues #201 #### Does this contribution introduce any breaking changes to the existing APIs or behaviors? Yes. For a 0-length read to a 0-sized object read will now return 0 instead of -1. Insufficient Buffer Capacity will now throw IndexOutOfBoundsException instead of IllegalArgumentException. #### Does this contribution introduce any new public APIs or behaviors? No, it changes existing public API behaviour. #### How was the contribution tested? Added new unit tests. #### Does this contribution need a changelog entry? - [N/A] I have updated the CHANGELOG or README if appropriate --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the [Developer Certificate of Origin (DCO)](https://developercertificate.org/).
- Loading branch information
Showing
3 changed files
with
80 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters