ModuleHelper { public static InputStream getInputStream(String path) throws IOException { FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/")); Path fsPath = fs.getPath(path); return Files.newInputStream(fsPath); } private  ModuleHelper(); static File getJrtFsFile(); static boolean isJrtFsFile(File f); static void walkModule(ModuleConsumer c); static Optional<T> searchModule(ModuleSupplier<T> ms); static void walkModule(String mod, ModuleConsumer c); static InputStream getInputStream(String path); static Optional<String> pathToClassName(Path p); static Optional<String> pathToModule(Path p); @SuppressWarnings("try") static Optional<ClassData> pathToClassData(Path p);  }
@Test public void getInputstream() throws IOException { ModuleHelper.walkModule( p -> { ModuleHelper.pathToClassName(p) .ifPresent( className -> { ModuleHelper.pathToModule(p) .ifPresent( mod -> { try (InputStream in = ModuleHelper.getInputStream(p.toString())) { in.available(); log.info(mod + ":" + className); } catch (IOException e) { log.catching(e); } }); }); }); }