| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A managed .NET library for parsing Java Virtual Machine (JVM) class (*.class) files. It provides strongly typed access to the full constant pool, fields, methods, interfaces and all attribute blocks defined in the Java Class File Format (JVM Spec §4).
Package manager:
Install-Package AlphaOmega.ByteCodeReader
dotnet CLI:
dotnet add package AlphaOmega.ByteCodeReader
using System;
using AlphaOmega.Debug;
using(ClassFile cls = new ClassFile(StreamLoader.FromFile(@"C:\Test\MyClass.class")))
{
if(!cls.IsValid)
throw new InvalidOperationException("Invalid JVM class file");
Console.WriteLine($"Class: {cls.ThisClass.Bytes}");
Console.WriteLine($"Super: {cls.SuperClass?.Bytes ?? "<Object>"}");
Console.WriteLine($"Version: {cls.MajorVersion}.{cls.MinorVersion}");
// Fields
foreach(var f in cls.Fields)
Console.WriteLine($"Field: {f.Name.Bytes} {f.Descriptor.Bytes}");
// Methods
foreach(var m in cls.Methods)
Console.WriteLine($"Method: {m.Name.Bytes}{m.Descriptor.Bytes}");
// Constant Pool (example: list all Utf8 entries)
foreach(var utf8 in cls.ConstantPool.Utf8)
Console.WriteLine($"Utf8[{utf8.Index}]: {utf8.Bytes}");
}The reader currently handles:
Common attribute types recognized (JVM Spec §4.7):
Unrecognized attributes are preserved (spec requires silent ignore) so tooling can still inspect raw data.
You can access raw constant pool bytes or attribute blocks for advanced analysis or re-emission.
Byte[] rawConstants = cls.ConstantPool.GetData();Planned:
Class file version exposed via ClassFile.Version, MajorVersion, MinorVersion (e.g. 61.0 for Java 17).
Only parses local byte arrays / streams. No code execution or dynamic loading.
Feedback and improvements welcome.
| Back | FazBrowse Home | New Git URL |