[
https://issues.apache.org/jira/browse/IO-486?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14996353#comment-14996353
]
Sebb commented on IO-486:
-------------------------
bq. Here we may as well miss data, if OS returns a file length less then the
real data size. Should this be fixed? What do you think?
I think the best would be to document that the method relies on the file size
returned by the OS.
The short-circuit in {{IOUtils.toByteArray()}} is not relevant; it is a valid
short-circuit whatever the OS behaviour is.
> FileUtils.readFileToString() can immediately return empty string if file
> length is zero
> ---------------------------------------------------------------------------------------
>
> Key: IO-486
> URL: https://issues.apache.org/jira/browse/IO-486
> Project: Commons IO
> Issue Type: Improvement
> Reporter: Viktor Isaev
>
> If {{file.length() == 0}}, there is no point of doing extra work of opening
> and closing an input stream - we can return an empty string right away.
> Same applies for {{FileUtils.readFileToByteArray()}} and
> {{FileUtils.readLines()}}.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)