Marcono1234 opened a new pull request #293:
URL: https://github.com/apache/commons-io/pull/293


   The new implementation follows more closely the required behavior defined by 
`CharsetEncoder`, instead of assuming that buffers of certain size will work 
without having to resize them.
   
   Relates to:
   - https://issues.apache.org/jira/browse/IO-714
   - https://issues.apache.org/jira/browse/IO-716
   
   Sorry for creating this pull request so late and not participating in the 
review of the previous pull requests for these issues.
   If you don't think this pull request is worth it, feel free to close it. The 
current implementation will probably work in most situations correctly, but 
[here](https://github.com/apache/commons-io/blob/d47d625275b05643459d47ea9862e827bd672653/src/main/java/org/apache/commons/io/input/ReaderInputStream.java#L239)
 it overwrites the `lastCoderResult`, even when the previous `encode` was 
unsuccessful, e.g. OVERFLOW or ERROR.
   
   I also tried refactoring 
`org.apache.commons.io.input.CharSequenceInputStream` to use 
`ReaderInputStream` to reduce error-prone usage of `CharsetEncoder` there. 
However, this causes some behavior changes:
   - `available()` will in most cases return 0
   - `readLimit` parameter of `mark` is now actually considered, so code 
calling `mark(0)` will not work anymore
   
   I have marked this pull request as draft for now because I have not 
extensively tested it. Please let me know what you think.


-- 
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]


Reply via email to