![]() |
VOOZH | about |
dotnet add package IKVM.ByteCode --version 9.3.13
NuGet\Install-Package IKVM.ByteCode -Version 9.3.13
<PackageReference Include="IKVM.ByteCode" Version="9.3.13" />
<PackageVersion Include="IKVM.ByteCode" Version="9.3.13" />Directory.Packages.props
<PackageReference Include="IKVM.ByteCode" />Project file
paket add IKVM.ByteCode --version 9.3.13
#r "nuget: IKVM.ByteCode, 9.3.13"
#:package IKVM.ByteCode@9.3.13
#addin nuget:?package=IKVM.ByteCode&version=9.3.13Install as a Cake Addin
#tool nuget:?package=IKVM.ByteCode&version=9.3.13Install as a Cake Tool
A low-allocation Java class file parser, reader, and writer for .NET. Designed for use by the IKVM project, but usable as a general-purpose library for reading and writing Java .class files.
The API is modeled after System.Reflection.Metadata — constant pool entries are referenced by typed handles rather than resolved eagerly, keeping allocations minimal.
The IKVM.ByteCode.Decoding namespace provides structures for reading Java class files. The main entry point is ClassFile, which can read from a file path, byte array, stream, or ReadOnlyMemory<byte>. ClassFile holds a reference to the underlying memory and parses lazily. It implements IDisposable.
using IKVM.ByteCode.Decoding;
using var clazz = ClassFile.Read("MyClass.class");
// Read the class name from the constant pool
string className = clazz.Constants.Get(clazz.This).Name;
Console.WriteLine($"Class: {className}");
// Enumerate methods
foreach (var method in clazz.Methods)
{
string name = clazz.Constants.Get(method.Name).Value;
string descriptor = clazz.Constants.Get(method.Descriptor).Value;
Console.WriteLine($" Method: {name}{descriptor}");
}
Constant pool entries are not resolved automatically. Obtain a *ConstantHandle from any data structure, then look it up via ClassFile.Constants.
Each decoding structure supports CopyTo (re-emits to an encoder with constant remapping via IConstantHandleMap) and WriteTo (raw emit, assuming constants are already present in the target).
Constants are represented by three families of types:
| Type | Description |
|---|---|
*Constant |
A fully resolved .NET value (e.g. Utf8Constant holds the string). Used for lookup or insertion. |
*ConstantHandle |
A typed handle to a slot in a constant table. Analogous to System.Reflection.Metadata tokens. |
*ConstantData |
The raw constant data as stored in the class file. Decoded lazily on demand. |
Casts between compatible handle and constant types are supported via custom operators.
The IKVM.ByteCode.Encoding namespace provides builders and encoders for writing class files.
BlobBuilder is a linked-list buffer supporting fast append and serialization. Encoders write into a ClassFormatWriter backed by segments of a BlobBuilder.
ClassFileBuilder is the high-level entry point for constructing a complete class file:
using IKVM.ByteCode.Buffers;
using IKVM.ByteCode.Decoding;
using IKVM.ByteCode.Encoding;
// Build a simple public class
var builder = new ClassFileBuilder(
new ClassFormatVersion(53, 0), // Java 9
AccessFlag.Public,
"com/example/MyClass",
"java/lang/Object");
builder.AddField(AccessFlag.Private, "_value", "I");
builder.AddMethod(AccessFlag.Public, "getValue", "()I");
var blob = new BlobBuilder();
builder.Serialize(blob);
// Write to file
File.WriteAllBytes("MyClass.class", blob.ToArray());
For lower-level encoding, individual encoder structures (e.g. MethodEncoder, AttributeTableEncoder) can be used directly, passed by ref between methods.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 is compatible. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 2 NuGet packages that depend on IKVM.ByteCode:
| Package | Downloads |
|---|---|
|
IKVM
Java SE 8 Virtual Machine for .NET |
|
|
IKVM.Java.Extensions
Various extensions for bridging the gap between .NET and Java. |
Showing the top 1 popular GitHub repositories that depend on IKVM.ByteCode:
| Repository | Stars |
|---|---|
|
ikvmnet/ikvm
A Java Virtual Machine and Bytecode-to-IL Converter for .NET
|
| Version | Downloads | Last Updated |
|---|---|---|
| 9.3.13 | 220 | 6/4/2026 |
| 9.3.12 | 785 | 3/8/2026 |
| 9.3.11 | 780 | 12/19/2025 |
| 9.3.10 | 398 | 12/18/2025 |
| 9.3.9 | 399 | 12/18/2025 |
| 9.3.8 | 384 | 12/17/2025 |
| 9.3.7 | 375 | 12/16/2025 |
| 9.3.6 | 433 | 12/15/2025 |
| 9.3.5 | 298 | 12/12/2025 |
| 9.3.4 | 190,211 | 3/13/2025 |
| 9.3.3 | 546 | 3/12/2025 |
| 9.3.2 | 517 | 3/12/2025 |
| 9.3.1 | 573 | 3/12/2025 |
| 9.3.0 | 159,473 | 12/11/2024 |
| 9.2.2 | 48,738 | 10/29/2024 |
| 9.2.1 | 480 | 10/29/2024 |
| 9.2.0 | 500 | 10/28/2024 |
| 9.1.3 | 1,457 | 8/20/2024 |
| 9.1.2 | 525 | 8/19/2024 |
| 9.1.1 | 536 | 8/19/2024 |