d8e2e6ab0f
This introduces the Resource object which can be either a ClassFile or any other File type ClassFiles get opened as a ClassViewer with mutliple BytecodeViewPanels Everything else gets opened as a FileViewer
37 lines
747 B
Java
37 lines
747 B
Java
package the.bytecode.club.bytecodeviewer.resources;
|
|
|
|
import org.objectweb.asm.tree.ClassNode;
|
|
|
|
/**
|
|
* @author Konloch
|
|
* @since 7/14/2021
|
|
*/
|
|
public class Resource
|
|
{
|
|
public final String name;
|
|
public String workingName;
|
|
public final ResourceContainer container;
|
|
|
|
public Resource(String name, String workingName, ResourceContainer container)
|
|
{
|
|
this.name = name;
|
|
this.workingName = workingName;
|
|
this.container = container;
|
|
}
|
|
|
|
/**
|
|
* Returns the resource bytes from the resource container
|
|
*/
|
|
public byte[] getResourceBytes()
|
|
{
|
|
return container.getFileContents(name);
|
|
}
|
|
|
|
/**
|
|
* Returns the resource bytes from the resource container
|
|
*/
|
|
public ClassNode getResourceClassNode()
|
|
{
|
|
return container.getClassNode(name);
|
|
}
|
|
}
|