commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting (JIRA)" <j...@apache.org>
Subject [jira] Reopened: (IO-203) Add skipFully() method for InputStreams
Date Mon, 08 Mar 2010 12:35:27 GMT

     [ https://issues.apache.org/jira/browse/IO-203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jukka Zitting reopened IO-203:
------------------------------


I don't think the skipFully() method works as intended the way it's currently implemented.
As said in the InputStream.skip() javadocs: "The skip method may, for a variety of reasons,
end up skipping over some smaller number of bytes, possibly 0." Thus the skipFully() method
should always fall back to read() when the skip() method returns something less than the number
of bytes requested.

As an added complexity, note that a FileInputStream allows skipping any number of bytes past
the end of the file! If we want to detect that case, the skipFully() method should first skip()
n-1 bytes and then try to read() all the remaining bytes.

> Add skipFully() method for InputStreams
> ---------------------------------------
>
>                 Key: IO-203
>                 URL: https://issues.apache.org/jira/browse/IO-203
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>            Reporter: Sebb
>             Fix For: 2.0
>
>
> The skip() method is not guaranteed to skip the requested number of bytes, even if there
is more data available. This is particularly true of Buffered input streams.
> It would be useful to have a skip() method that keeps skipping until the required number
of bytes have been read, or EOF was reached, in which case it should throw an Exception.
> [I'll add a patch later.]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message