Class Plugin.Engine.Source.InMemory

java.lang.Object
net.bytebuddy.build.Plugin.Engine.Source.InMemory
All Implemented Interfaces:
Closeable, AutoCloseable, Iterable<Plugin.Engine.Source.Element>, Plugin.Engine.Source, Plugin.Engine.Source.Origin
Enclosing interface:
Plugin.Engine.Source

@Enhance public static class Plugin.Engine.Source.InMemory extends Object implements Plugin.Engine.Source, Plugin.Engine.Source.Origin
A source that represents a collection of in-memory resources that are represented as byte arrays.
  • Field Details

    • storage

      private final Map<String,byte[]> storage
      A mapping of resource names to their binary representation.
  • Constructor Details

    • InMemory

      public InMemory(Map<String,byte[]> storage)
      Creates a new in-memory source.
      Parameters:
      storage - A mapping of resource names to their binary representation.
  • Method Details

    • ofTypes

      public static Plugin.Engine.Source ofTypes(Class<?>... type)
      Represents a collection of types as an in-memory source.
      Parameters:
      type - The types to represent.
      Returns:
      A source representing the supplied types.
    • ofTypes

      public static Plugin.Engine.Source ofTypes(Collection<? extends Class<?>> types)
      Represents a collection of types as an in-memory source.
      Parameters:
      types - The types to represent.
      Returns:
      A source representing the supplied types.
    • ofTypes

      public static Plugin.Engine.Source ofTypes(Collection<? extends Class<?>> types, Map<ClassFileVersion,Collection<? extends Class<?>>> versionedTypes)
      Represents a collection of types as an in-memory source.
      Parameters:
      types - The types to represent.
      versionedTypes - A versioned mapping of types to represent.
      Returns:
      A source representing the supplied types.
    • ofTypes

      public static Plugin.Engine.Source ofTypes(Map<TypeDescription,byte[]> binaryRepresentations)
      Represents a map of type names to their binary representation as an in-memory source.
      Parameters:
      binaryRepresentations - A mapping of type names to their binary representation.
      Returns:
      A source representing the supplied types.
    • ofTypes

      public static Plugin.Engine.Source ofTypes(Map<TypeDescription,byte[]> binaryRepresentations, Map<ClassFileVersion,Map<TypeDescription,byte[]>> versionedBinaryRepresentations)
      Represents a map of type names to their binary representation as an in-memory source.
      Parameters:
      binaryRepresentations - A mapping of type names to their binary representation.
      versionedBinaryRepresentations - A versioned mapping of type names to their binary representation.
      Returns:
      A source representing the supplied types.
    • read

      Initiates reading from a source.
      Specified by:
      read in interface Plugin.Engine.Source
      Returns:
      The origin to read from.
    • toClassFileLocator

      public ClassFileLocator toClassFileLocator(@MaybeNull ClassFileVersion classFileVersion)
      Creates a class file locator for the represented source. If the class file locator needs to be closed, it is the responsibility of this origin to close the locator or its underlying resources.
      Specified by:
      toClassFileLocator in interface Plugin.Engine.Source.Origin
      Parameters:
      classFileVersion - The class file version to consider for multi-release jars or null if multi-release jars should not be considered.
      Returns:
      A class file locator for locating class files of this instance.
    • getManifest

      @MaybeNull public Manifest getManifest() throws IOException
      Returns the manifest file of the source location or null if no manifest exists.
      Specified by:
      getManifest in interface Plugin.Engine.Source.Origin
      Returns:
      This source's manifest or null.
      Throws:
      IOException - If an I/O error occurs.
    • iterator

      Specified by:
      iterator in interface Iterable<Plugin.Engine.Source.Element>
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable