source
file_formats_java_class
7.0.0File format reader for the Java programming language CLASS file format
7.0.0
file_formats_java_class provides the facilities for reading CLASS files defined
in the Java Virtual Machine Specification,
Java SE 7, CLASS major file version 51,
chapter 4.
Supported Elements (Java SE 7)
- Class Access Flags (Table 4.1)
ACC_PUBLICACC_FINALACC_SUPERACC_INTERFACEACC_ABSTRACTACC_SYNTHETICACC_ANNOTATIONACC_ENUM
- Constant Pool (Table 4.3)
CONSTANT_Class_infoCONSTANT_Fieldref_infoCONSTANT_Methodref_infoCONSTANT_InterfaceMethodref_infoCONSTANT_String_infoCONSTANT_Integer_infoCONSTANT_Float_infoCONSTANT_Long_infoCONSTANT_Double_infoCONSTANT_NameAndType_infoCONSTANT_Utf8_infoCONSTANT_MethodHandle_infoCONSTANT_MethodType_infoCONSTANT_InvokeDynamic_info
- Field Access Flags (Table 4.4)
ACC_PUBLICACC_PRIVATEACC_PROTECTEDACC_STATICACC_FINALACC_VOLATILEACC_TRANSIENTACC_SYNTHETICACC_ENUM
- Method Access Flags (Table 4.5)
ACC_PUBLICACC_PRIVATEACC_PROTECTEDACC_STATICACC_FINALACC_SYNCHRONIZEDACC_BRIDGEACC_VARARGSACC_NATIVEACC_ABSTRACTACC_STRICTACC_SYNTHETIC
- Attributes (Table 4.6)
ConstantValueCodeStackMapTableExceptionsInnerClassesEnclosingMethodSyntheticSignatureSourceFileSourceDebugExtensionLineNumberTableLocalVariableTableLocalVariableTypeTableDeprecatedRuntimeVisibleAnnotationsRuntimeInvisibleAnnotationsRuntimeVisibleParameterAnnotationsRuntimeInvisibleParameterAnnotationsAnnotationDefaultBootstrapMethodsOther- Used for unrecognized/private attributes- NOTE: All restrictions put in place of each attribute for determining the validity of a CLASS file may not be fully implemented at the current time.
Example Use
All pertinent types and subprograms are available within the package
File_Formats_Java_Class. Reading Class_File is done primarily through the Input aspect,
as shown below.
with Ada.Text_IO;
with File_Formats_Java_Class;
use File_Formats_Java_Class;
procedure Read_Class_File is
F : File_Type;
S : Stream_Access;
begin
Open (F, In_File, "Example.class");
S := Stream (F);
Ada.Text_IO.Put_Line (Class_File'Input (S));
Close (F);
end Read_Class_File;
Development Status
This crate does not yet define operations for writing to CLASS files, but this is a priority. After writing is complete, this crate will be updated to support CLASS files of Java SE 8+. You are free to report issues and contribute at the crate's GitHub repository.