- java.lang.Object
-
- uk.autores.handling.GenerateByteArraysFromFiles
-
- All Implemented Interfaces:
Handler
public final class GenerateByteArraysFromFiles extends Object implements Handler
Handlerthat, for each resource, generates a class with a name derived from the resource name usingNamer.simplifyResourceName(String)andNamer.nameType(String). The class will have a static method calledbytesthat returns the resource as a new byte array.Resource files over
Integer.MAX_VALUEin size will result in an error during compilation.
-
-
Constructor Summary
Constructors Constructor Description GenerateByteArraysFromFiles()Ctor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<ConfigDef>config()All configuration is optional.voidhandle(Context context)Handles the context resources.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface uk.autores.handling.Handler
validConfig
-
-
-
-
Method Detail
-
config
public Set<ConfigDef> config()
All configuration is optional.
Use "visibility" to make the generated classes public.
Strategy:-
CfgStrategy.AUTO:CfgStrategy.INLINEfor files up to 128 bytes;CfgStrategy.CONSTfor files up to 65535 bytes;CfgStrategy.LAZYotherwise 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.
- Specified by:
configin interfaceHandler- Returns:
- visibility strategy
- See Also:
CfgVisibility,CfgStrategy
-
-
-