Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
IO-251added optimization for reading files with known size as byte arrays, but it was reverted inIO-453due to regression, because File.length() method may return 0 for path files denoting system-dependent entities such as devices or pipesMore 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).