[
https://issues.apache.org/jira/browse/IO-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14087772#comment-14087772
]
Sebb commented on IO-454:
-------------------------
I see.
The basic InputStream.skip implementation uses read() with a skip buffer,
however subclasses such as ByteArrayInputStream use pointer manipulation which
would of course be much faster.
A method which uses read() only should work with all InputStream classes.
A method which uses skip(Integer.MAX_VALUE) should be faster for many IS
subclasses, but may fail for those that fail to override skip.
I doubt it's worth providing a method that uses skip(Long.MAX_VALUE).
It's likely there are other classes that fail to handle the arithmetic overflow
properly.
I'm inclined to agree it might be worth providing skipToEnd() as well as
consumeAll(), but if only one is provided it should be consumeAll() as that is
usable with all InputStreams.
Note: any code should document the reasons for these choices of implementation.
> IOUtils.skipToEnd
> -----------------
>
> Key: IO-454
> URL: https://issues.apache.org/jira/browse/IO-454
> Project: Commons IO
> Issue Type: New Feature
> Components: Utilities
> Reporter: BELUGA BEHR
> Priority: Minor
>
> Hello,
> I'd like to see an IOUtils method that calls skip (or skip/read) on a stream
> until it returns -1.
> Thanks.
--
This message was sent by Atlassian JIRA
(v6.2#6252)