开发者

Applet Image Cache

开发者 https://www.devze.com 2023-01-13 01:17 出处:网络
I have an applet that shows a couple o开发者_Python百科f images. A lot (10-20) of these images is identical, and is fetched from the internet in a non-parallel way. Is there an imagecache that I can u

I have an applet that shows a couple o开发者_Python百科f images. A lot (10-20) of these images is identical, and is fetched from the internet in a non-parallel way. Is there an imagecache that I can use? So I only fetch the same image once, or do I have to make my own?

Thanks


Much depends on your needs, but I'm guessing you want a minimal footprint in an Applet. This very simple example uses a List implementation to cache images by index. To ease making the list circular, the same index is used in a parallel list of names. In your case, a suitable Map<String, Image> implementation might be simpler. If memory is tight, LinkedHashMap can be used as a Simple (LRU) Cache in Java.

0

精彩评论

暂无评论...
验证码 换一张
取 消