The package contains the following classes:
App2Class - this is an executable class which generates a single
.class file from the given list of files. See the
DecoderStream - this class is packed in the generated one and used for decoding other stored data.
AppLoader - the class that contains code for loading and running the encoded application. It is used to construct the output.
The generated code works as follows: When
App2Class generates the output class, it loads
AppLoader.class file, renames the class to the required name, and adds
static final String constants to it. For each resource added, field with name
dataN, and fields with names
dataN_n are inserted.
dataN holds the resource's name (N is its number) and
dataN_n stores its data. Each
String has a limited length, so there may be multiple
String for one resource.
When the generated class is instantiated, it examines itself using Reflection for the fields mentioned above. Then, it uses them to load all other data.
String constants are stored in UTF format, it is efficient to use only characters in the range
\u007f. So each resource is first Deflated and then encoded to contain only characters
0x00 character is stored in two bytes). This is why the
DecodingStream class is needed.