- All Implemented Interfaces:
Handler
Handler
that, for each resource, generates a class with a name derived from the resource name
using Namer.simplifyResourceName(String)
and Namer.nameType(String)
.
The class will have a static method called bytes
that returns the resource
as a new byte array.
Resource files over Integer.MAX_VALUE
in size will result in an error during compilation.
-
Constructor Details
-
GenerateByteArraysFromFiles
public GenerateByteArraysFromFiles()Ctor.
-
-
Method Details
-
config
All configuration is optional.
Use "visibility" to make the generated classes public.
Strategy:-
CfgStrategy.AUTO
:CfgStrategy.INLINE
for files up to 128 bytes;CfgStrategy.CONST
for files up to 65535 bytes;CfgStrategy.LAZY
otherwise CfgStrategy.INLINE
: files become bytecode instructionsCfgStrategy.CONST
: files are encoded in string literals in the class constant poolCfgStrategy.LAZY
: files are loaded using usingClass.getResourceAsStream(String)
The lazy strategy requires that the resource file be provided at runtime. The inline strategy results in larger class files than the const strategy by a factor of about 8. The inline strategy uses the stack to fill the byte array. The const strategy copies from the heap to fill the byte array. The inline and const strategies will break down as the resource file approaches 500MB due to class file limitations.
-
-
handle
Description copied from interface:Handler
Handles the context resources.
-