Okay, basically this is a rewrite of my previous sprite caches, but I've made it so it can be used to pack any files together into one file. It also compresses each file using GZip to save you space as well.
Click here to download.
Example Usages
You could use this tool to do the following:
- Create a sprite cache that supports any image format and holds transparency data.
- Secure your cache by storing parts of it in this (for example, packing loc.dat, loc.idx, obj.dat, obj.idx, into one file so nobody can steal them).
- Custom cache format for external tools (not limited to sprites or client related stuff).
How to use the Cache Utility
To build a cache simply select the folder you wish to pack into a cache. Then you'll have the option to name it (for example if you're packing "newspritefolder" and you wanna name the cache file "sprites.dat" you may do so). If you leave the name field blank it'll automatically generate the "foldername.dat" file. Once the folder is selected and you're ready just hit "Build" and it'll generate the "cachename.dat" file.
The "Extract" feature has been temporarily disabled.
If you wish to extract the files from the cache you simple put the cache file in the same folder as the Cache Utility.jar and run it, then enter the name of the cache file, and hit "Extract". It will then extract all files from it to the "out" folder.
How to read the Cache Utility File
To read the file, you must use these classes:
Now, to read the files you must call the code:
Code:
FileReader reader = new FileReader();
reader.read("yourname.dat");
And to grab a file from the cache, you can simply do the following:
Code:
reader.getFile("directory", "filename");
And to get the data of a file (byte array, for example for sprites):
Code:
reader.getFile("directory", "filename").getData();
Media