Pascal Schumacher created IO-542:
------------------------------------
Summary: FileUtils#readFileToByteArray: optimize reading of files
with known size
Key: IO-542
URL: https://issues.apache.org/jira/browse/IO-542
Project: Commons IO
Issue Type: Improvement
Reporter: Pascal Schumacher
{quote}IO-251 added optimization for reading files with known size as byte
arrays, but it was reverted in IO-453 due to regression, because File.length()
method may return 0 for path files denoting system-dependent entities such as
devices or pipes
More optimal solution is to treat 0 as unknown size and use
IOUtils.toByteArray(input), but if size is known (> 0) use more efficient
approach and read content into pre-allocated byte array with exact size by
calling IOUtils.toByteArray(input, size).{quote}
source https://github.com/apache/commons-io/pull/38
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)