IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
VfsAssemblyClassFile.cs
Go to the documentation of this file.
1using System;
2using System.IO;
3
4using IKVM.Runtime;
6
7namespace IKVM.Runtime.Vfs
8{
9
13 internal sealed class VfsAssemblyClassFile : VfsFile
14 {
15
16 readonly RuntimeJavaType type;
17 readonly Lazy<byte[]> buff;
18
24 internal VfsAssemblyClassFile(VfsContext context, RuntimeJavaType type) :
25 base(context)
26 {
27 this.type = type ?? throw new ArgumentNullException(nameof(type));
28 this.buff = new Lazy<byte[]>(GenerateClassFile, true);
29 }
30
35 byte[] GenerateClassFile()
36 {
37#if FIRST_PASS || IMPORTER || EXPORTER
38 throw new NotImplementedException();
39#else
40 var stream = new MemoryStream();
41 Context.Context.StubGenerator.Write(stream, type, true, true, true, true, false);
42 return stream.ToArray();
43#endif
44 }
45
50 protected override Stream OpenRead() => new MemoryStream(buff.Value);
51
55 public override long Size => buff.Value.Length;
56
57 }
58
59}
StubGenerator StubGenerator
Gets the StubGenerator associated with this instance of the runtime.