Class 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 Detail

      • ModularRuntimeImage

        public ModularRuntimeImage()
                            throws IOException
        Constructs a default instance.
        Throws:
        IOException - an I/O error occurs accessing the file system
      • 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

      • 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
      • getFileSystem

        public FileSystem getFileSystem()