Interface IContextSource
-
- All Known Implementing Classes:
DirectoryContextSource
public interface IContextSourceA specific type of context unit.Implementations do not need to cache the results of any provided methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classIContextSource.EntriesAll entries in the context unit.static classIContextSource.EntryAn entry in a context unit, which may be a multirelease variant.static interfaceIContextSource.IOutputSinkA collector for output derived from this specific context entry.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCLASS_SUFFIXThe file extension for class files.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default IContextSource.IOutputSinkcreateOutputSink(IResultSaver saver)Create a sink that can write the decompiled output from this context element.default byte[]getClassBytes(java.lang.String className)Get the full bytes for a class's contents.IContextSource.EntriesgetEntries()Get a listing of all entries in this context unit.java.io.InputStreamgetInputStream(java.lang.String resource)Get an input stream for a specific resource.default java.io.InputStreamgetInputStream(IContextSource.Entry resource)Get an input stream for a specific resource.java.lang.StringgetName()Get a human-readable name to identify this context source.
-
-
-
Field Detail
-
CLASS_SUFFIX
static final java.lang.String CLASS_SUFFIX
The file extension for class files.- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
java.lang.String getName()
Get a human-readable name to identify this context source.- Returns:
- a human-readable name
-
getEntries
IContextSource.Entries getEntries()
Get a listing of all entries in this context unit.- Returns:
- the entries in this unit
-
getClassBytes
default byte[] getClassBytes(java.lang.String className) throws java.io.IOExceptionGet the full bytes for a class's contents.- Parameters:
className- the class name, with no trailing/- Returns:
- the bytes, or
nullif no class with that name is present - Throws:
java.io.IOException- if an error is encountered while reading the class data
-
getInputStream
default java.io.InputStream getInputStream(IContextSource.Entry resource) throws java.io.IOException
Get an input stream for a specific resource. This will returnnullif a directory is requested.- Parameters:
resource- the resource to request- Returns:
- an input stream
- Throws:
java.io.IOException- if an input stream could not be opened
-
getInputStream
java.io.InputStream getInputStream(java.lang.String resource) throws java.io.IOExceptionGet an input stream for a specific resource. This will returnnullif a directory is requested.- Parameters:
resource- the resource to request- Returns:
- an input stream
- Throws:
java.io.IOException- if an input stream could not be opened
-
createOutputSink
default IContextSource.IOutputSink createOutputSink(IResultSaver saver)
Create a sink that can write the decompiled output from this context element.If this context source type does not support writing, return a null sink.
- Parameters:
saver- the source result saver for this decompiler, for delegation- Returns:
- the output sink, or null if unwritable
-
-