public class PluginLoader
extends java.lang.Object
Constructor and Description |
---|
PluginLoader() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
fileToByteArray(java.io.File file)
Converts the whole content of a file into a byte array.
|
static <ClassType> |
loadExternalClass(java.io.File file)
Loads the external class at runtime.
|
static <ClassType> |
loadExternalClass(java.lang.String filename)
Loads the external class at runtime.
|
public static <ClassType> ClassType loadExternalClass(java.io.File file) throws java.io.IOException, java.lang.InstantiationException, java.lang.IllegalAccessException
file
- The file of the classjava.io.IOException
- If an error occurs when reading the filejava.lang.InstantiationException
- If the external class could not be instantiatedjava.lang.IllegalAccessException
- If the external class could not be accessed after loadingpublic static <ClassType> ClassType loadExternalClass(java.lang.String filename) throws java.io.IOException, java.lang.InstantiationException, java.lang.IllegalAccessException
filename
- The relative or absolute path to the classjava.io.IOException
- If an error occurs when reading the filejava.lang.InstantiationException
- If the external class could not be instantiatedjava.lang.IllegalAccessException
- If the external class could not be accessed after loadingpublic static byte[] fileToByteArray(java.io.File file) throws java.io.IOException
file
- The input file. The file must existjava.io.IOException
- If there was an error when reading the file