| java.lang.Object org.netbeans.imagecache.CacheWriter
CacheWriter | public class CacheWriter (Code) | | Writes an image cache. It will create two files in the directory set in
setDir: images.cache and images.metadata. The first is a flat binary
cache of image data; the second is metadata about the image names, offsets
into the file, etc.
File formats:
The image cache is a big blob of rgb pixel data with no markers, format
information or anything else. The metadata file is a binary file consisting
of a series of 255 character records. Each record is in the format:
- 4 bytes: integer length of the id (image path in its jar)
- 4 bytes: integer width of the image
- 4 bytes: integer height of the image
- 8 bytes: long offset into the cache file for data start
- 8 bytes: long offset into the cache file for data end
While the width/height of the image could be derived from only one
parameter and the data length, these are included separately to enable
future use of data compression (such as RLE to reduce repeated transparent
pixel data).
As long as the output filename is not user-settable, it should be possible
to indicate future format changes by altering the file name.
author: Tim Boudreau |
ID_OFFSET | final static int ID_OFFSET(Code) | | Offset from the beginning of a metadata entry where the id starts
|
METAENTRY_LENGTH | final static int METAENTRY_LENGTH(Code) | | Fixed length of a single entry of metadata
|
CacheWriter | public CacheWriter()(Code) | | Creates a new instance of CacheWriter
|
writeDir | public void writeDir(String dirname, boolean append) throws IOException(Code) | | Recursively writes all files to the image cache
|
|
|