Package net.bytebuddy.build
Class Plugin.Engine.Source.InMemory
- java.lang.Object
-
- net.bytebuddy.build.Plugin.Engine.Source.InMemory
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.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 java.lang.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
Plugin.Engine.Source.InMemory.MapEntryIterator
An iterator that represents map entries as sources.-
Nested classes/interfaces inherited from interface net.bytebuddy.build.Plugin.Engine.Source
Plugin.Engine.Source.Element, Plugin.Engine.Source.Empty, Plugin.Engine.Source.Filtering, Plugin.Engine.Source.ForFolder, Plugin.Engine.Source.ForJarFile, Plugin.Engine.Source.InMemory, Plugin.Engine.Source.Origin
-
Nested classes/interfaces inherited from interface net.bytebuddy.build.Plugin.Engine.Source.Origin
Plugin.Engine.Source.Origin.Filtering, Plugin.Engine.Source.Origin.ForJarFile
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,byte[]>
storage
A mapping of resource names to their binary representation.-
Fields inherited from interface net.bytebuddy.build.Plugin.Engine.Source.Origin
NO_MANIFEST
-
-
Constructor Summary
Constructors Constructor Description InMemory(java.util.Map<java.lang.String,byte[]> storage)
Creates a new in-memory source.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
ClassFileLocator
getClassFileLocator()
Returns a class file locator for the represented source.java.util.jar.Manifest
getManifest()
Returns the manifest file of the source location ornull
if no manifest exists.java.util.Iterator<Plugin.Engine.Source.Element>
iterator()
static Plugin.Engine.Source
ofTypes(java.lang.Class<?>... type)
Represents a collection of types as a in-memory source.static Plugin.Engine.Source
ofTypes(java.util.Collection<? extends java.lang.Class<?>> types)
Represents a collection of types as a in-memory source.static Plugin.Engine.Source
ofTypes(java.util.Map<TypeDescription,byte[]> binaryRepresentations)
Represents a map of type names to their binary representation as an in-memory source.Plugin.Engine.Source.Origin
read()
Initiates reading from a source.
-
-
-
Method Detail
-
ofTypes
public static Plugin.Engine.Source ofTypes(java.lang.Class<?>... type)
Represents a collection of types as a in-memory source.- Parameters:
type
- The types to represent.- Returns:
- A source representing the supplied types.
-
ofTypes
public static Plugin.Engine.Source ofTypes(java.util.Collection<? extends java.lang.Class<?>> types)
Represents a collection of types as a in-memory source.- Parameters:
types
- The types to represent.- Returns:
- A source representing the supplied types.
-
ofTypes
public static Plugin.Engine.Source ofTypes(java.util.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.
-
read
public Plugin.Engine.Source.Origin read()
Initiates reading from a source.- Specified by:
read
in interfacePlugin.Engine.Source
- Returns:
- The origin to read from.
-
getClassFileLocator
public ClassFileLocator getClassFileLocator()
Returns 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:
getClassFileLocator
in interfacePlugin.Engine.Source.Origin
- Returns:
- A class file locator for locating class files of this instance..
-
getManifest
public java.util.jar.Manifest getManifest() throws java.io.IOException
Returns the manifest file of the source location ornull
if no manifest exists.- Specified by:
getManifest
in interfacePlugin.Engine.Source.Origin
- Returns:
- This source's manifest or
null
. - Throws:
java.io.IOException
- If an I/O error occurs.
-
iterator
public java.util.Iterator<Plugin.Engine.Source.Element> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<Plugin.Engine.Source.Element>
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
-