ModularRuntimeImage (Apache Commons BCEL 6.6.1 API)

org.apache.bcel.util

## Class ModularRuntimeImage

- java.lang.Object
- - org.apache.bcel.util.ModularRuntimeImage

- All Implemented Interfaces:
    Closeable, AutoCloseable

      public class ModularRuntimeImage
      extends Object
      implements Closeable

  Wraps a Java 9 JEP 220 modular runtime image. Requires the JRT NIO file system.
  Since:
    6.3

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ModularRuntimeImage()` Constructs a default instance.
    `ModularRuntimeImage(String javaHome)` Constructs an instance using the JRT file system implementation from a specific Java Home.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `FileSystem` | `getFileSystem()`
    `List<Path>` | `list(Path dirPath)` Lists all entries in the given directory.
    `List<Path>` | `list(String dirName)` Lists all entries in the given directory.
    `List<Path>` | `modules()` Lists all modules.
    `List<Path>` | `packages()` Lists all packages.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ModularRuntimeImage

          public ModularRuntimeImage()

      Constructs a default instance.

    - #### ModularRuntimeImage

          public ModularRuntimeImage(String javaHome)
                              throws IOException

      Constructs an instance using the JRT file system implementation from a specific Java Home.
      Parameters:
        `javaHome` - Path to a Java 9 or greater home.
      Throws:
        `IOException` - an I/O error occurs accessing the file system

  - ### Method Detail

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `IOException`

    - #### getFileSystem

          public FileSystem getFileSystem()

    - #### list

          public List<Path> list(Path dirPath)
                          throws IOException

      Lists all entries in the given directory.
      Parameters:
        `dirPath` - directory path.
      Returns:
        a list of dir entries if an I/O error occurs
      Throws:
        `IOException` - an I/O error occurs accessing the file system

    - #### list

          public List<Path> list(String dirName)
                          throws IOException

      Lists all entries in the given directory.
      Parameters:
        `dirName` - directory path.
      Returns:
        a list of dir entries if an I/O error occurs
      Throws:
        `IOException` - an I/O error occurs accessing the file system

    - #### modules

          public List<Path> modules()
                             throws IOException

      Lists all modules.
      Returns:
        a list of modules
      Throws:
        `IOException` - an I/O error occurs accessing the file system

    - #### packages

          public List<Path> packages()
                              throws IOException

      Lists all packages.
      Returns:
        a list of modules
      Throws:
        `IOException` - an I/O error occurs accessing the file system

Copyright © 2004–2022 The Apache Software Foundation. All rights reserved.