Class ModuleLayerFromSingleClassLoaderDecorator.AbstractModuleReader

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable
    Enclosing class:
    ModuleLayerFromSingleClassLoaderDecorator

    public abstract static class ModuleLayerFromSingleClassLoaderDecorator.AbstractModuleReader
    extends java.lang.Object
    implements java.io.Closeable
    An abstract implementation of a module reader that provides access to dynamically generated types.

    This class serves as a base for creating module readers that can handle byte code representations of classes within a module. It implements the Closeable interface but provides an empty implementation for the close method.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​byte[]> types
      The map containing type names and their byte representations.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractModuleReader​(java.util.Map<java.lang.String,​byte[]> types)
      Creates a new abstract module reader.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      protected java.lang.Object doFind​(java.lang.String name)
      Finds a resource within the module.
      protected java.lang.Object doList()
      Lists all resources in the module.
      protected java.lang.Object doOpen​(java.lang.String name)
      Opens an input stream to a resource within the module.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • types

        private final java.util.Map<java.lang.String,​byte[]> types
        The map containing type names and their byte representations.
    • Constructor Detail

      • AbstractModuleReader

        protected AbstractModuleReader​(java.util.Map<java.lang.String,​byte[]> types)
        Creates a new abstract module reader.
        Parameters:
        types - The map of type names to their byte representations.
    • Method Detail

      • doFind

        protected java.lang.Object doFind​(java.lang.String name)
        Finds a resource within the module.
        Parameters:
        name - The resource name.
        Returns:
        An optional containing the resource URI if found, empty otherwise.
      • doList

        protected java.lang.Object doList()
        Lists all resources in the module.
        Returns:
        An empty stream as listing is not supported.
      • doOpen

        protected java.lang.Object doOpen​(java.lang.String name)
        Opens an input stream to a resource within the module.
        Parameters:
        name - The resource name.
        Returns:
        An optional containing the input stream if the resource exists, empty otherwise.
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable