Luke Hutchison
2018-08-08 05:16:53 UTC
The current ModuleReader API has methods list(), open(String name), and
read(String name). However, there is no way to get the length (file size)
of a resource short of opening or reading the whole resource, then
examining the number of bytes read or mapped. This can lead to unnecessary
resizing of arrays, and therefore unnecessary array copying.
Internally, the resource size is available in
ImageLocation#getUncompressedSize(). Can this be exposed as a size hint in
the ModuleReader API, e.g. in a method ModuleReader#getSizeHint(String
name) ?
read(String name). However, there is no way to get the length (file size)
of a resource short of opening or reading the whole resource, then
examining the number of bytes read or mapped. This can lead to unnecessary
resizing of arrays, and therefore unnecessary array copying.
Internally, the resource size is available in
ImageLocation#getUncompressedSize(). Can this be exposed as a size hint in
the ModuleReader API, e.g. in a method ModuleReader#getSizeHint(String
name) ?