CodenameOne icon indicating copy to clipboard operation
CodenameOne copied to clipboard

Handling large resource files

Open ddyer0 opened this issue 3 years ago • 0 comments

Several of my games require a modest number of large images which are sparsely used. For example, there might be 200 images which are 20 megabytes each, of which only 6 need to be used at any given time. The current resource manager is hopeless for this scenario, because it loads everything into memory.

One path to resolving this would be to implement RandomAccessFile, so that a more selective resource manager could be implemented, or perhaps a smart zip file reader.

A stopgap would be to make the existing reader easier to modify, which could be very simple for you to enable with two small changes.
#1 Make Resources(InputStream input, int dpi) the constructor, public so resources can be subclassed #2 Make void setResource(String id, byte type, Object value) public so it can be overridden

ddyer0 avatar Apr 05 '22 18:04 ddyer0