ppkarwasz opened a new pull request, #778:
URL: https://github.com/apache/commons-io/pull/778

   `BoundedInputStream.getRemaining()` previously returned `0` when no read 
limit was set, which was misleading. It now returns `Long.MAX_VALUE` to more 
clearly represent an unbounded stream.
   
   The Javadoc was also updated to clarify that the method reflects only the 
configured limit and does **not** report the actual number of bytes available 
in the underlying stream.
   
   Although `Long.MAX_VALUE` represents almost 8 EiB, the behavior of 
`getMaxCount()` is unchanged: it still returns `EOF` (`-1`) to signal an 
unbounded stream. The Javadoc was updated to make this explicit, and new unit 
tests were added to clearly differentiate an unbounded stream from one 
explicitly limited to `Long.MAX_VALUE`:
   
   * When `getMaxCount()` returns `-1`, `getRemaining()` always reports 
`Long.MAX_VALUE`, regardless of how many bytes have been read.
   * When `getMaxCount()` returns `Long.MAX_VALUE`, `getRemaining()` begins at 
`Long.MAX_VALUE` but decreases as bytes are consumed.
   
   Before you push a pull request, review this list:
   
   - [x] I used AI to create Javadoc and unit test comments.
   - [x] Run a successful build using the default 
[Maven](https://maven.apache.org/) goal with `mvn`; that's `mvn` on the command 
line by itself.
   - [x] Write unit tests that match behavioral changes, where the tests fail 
if the changes to the runtime are not applied. This may not always be possible, 
but it is a best-practice.
   - [x] Write a pull request description that is detailed enough to understand 
what the pull request does, how, and why.
   - [x] Each commit in the pull request should have a meaningful subject line 
and body. Note that a maintainer may squash commits during the merge process.
   


-- 
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: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to