Class LoadedLibrary
java.lang.Object
i5.las2peer.classLoaders.libraries.LoadedLibrary
- Direct Known Subclasses:
LoadedJarLibrary
,LoadedNetworkLibrary
a loaded library represents a library in the l2p classloader context
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
classToResourceName
(String className) Helper method to get the name of a class file from the corresponding name of the classreturns the library identifier for the library, this object is responsible for (including name and version)byte[]
getResourceAsBinary
(String resourceName) get the contents of a resource as a byte arraygetResourceAsString
(String resourceName) get the contents of a resource as a Stringabstract URL
getResourceAsUrl
(String name) for class and resource loading: get the URL for the specified resourcestatic String
resourceToClassName
(String entryName) Helper method to transform the name of an jar file entry into a java classname.
-
Method Details
-
getLibraryIdentifier
- Returns:
- the identifier (name and version) for the library to which this ClassLoader is bound
-
getResourceAsUrl
for class and resource loading: get the URL for the specified resource- Parameters:
name
- A resource name- Returns:
- a URL for the requested resource
- Throws:
ResourceNotFoundException
- the given resource does not exists in this library
-
getResourceAsString
public String getResourceAsString(String resourceName) throws IOException, ResourceNotFoundException get the contents of a resource as a String- Parameters:
resourceName
- A resource name- Returns:
- content of the given resource as string
- Throws:
IOException
- If the resource could not be readResourceNotFoundException
- the given resource does not exists in this library
-
getResourceAsBinary
public byte[] getResourceAsBinary(String resourceName) throws IOException, ResourceNotFoundException get the contents of a resource as a byte array- Parameters:
resourceName
- A resource name- Returns:
- contents of the requested resource
- Throws:
IOException
- If the resource could not be readResourceNotFoundException
- the given resource does not exists in this library
-
getIdentifier
returns the library identifier for the library, this object is responsible for (including name and version)- Returns:
- indentifier of the nested library
-
classToResourceName
Helper method to get the name of a class file from the corresponding name of the class- Parameters:
className
- name of a class- Returns:
- a String
-
resourceToClassName
Helper method to transform the name of an jar file entry into a java classname.- Parameters:
entryName
- name of a jar file entry- Returns:
- class name
-