IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
JarModuleReader.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.IO;
4
6
8{
9
14 {
15
16 readonly string _file;
17 readonly JarFile _jar;
18
24 public JarModuleReader(string file, RuntimeVersion runtimeVersion)
25 {
26 _file = file ?? throw new ArgumentNullException(nameof(file));
27 _file = Path.GetFullPath(_file);
28 _jar = new JarFile(_file, runtimeVersion);
29 }
30
32 public override IEnumerable<string> List()
33 {
34 foreach (var i in _jar.GetEntries())
35 yield return i.Name;
36 }
37
39 public override Stream? Open(string name)
40 {
41 var entry = _jar.GetEntry(name);
42 if (entry is not null)
43 return entry.Value.Open();
44
45 return null;
46 }
47
49 public override void Dispose()
50 {
51 _jar.Dispose();
52 }
53
54 }
55
56}
A ModuleReader for a modular JAR file.
override? Stream Open(string name)
override IEnumerable< string > List()
JarModuleReader(string file, RuntimeVersion runtimeVersion)
Initializes a new instance.
Provides access to the content of a module.