Class LoadedJarLibrary

java.lang.Object
i5.las2peer.classLoaders.libraries.LoadedLibrary
i5.las2peer.classLoaders.libraries.LoadedJarLibrary

public class LoadedJarLibrary extends LoadedLibrary
a loaded jar library implements a library on the basis of a standard jar file
  • Constructor Details

    • LoadedJarLibrary

      public LoadedJarLibrary(String filename, LibraryIdentifier ident) throws IOException
      create a new LodadJarLibrary
      Parameters:
      filename - A jar file name
      ident - A library identifier
      Throws:
      IOException - If the given jar filename could not be used
  • Method Details

    • getResourceAsUrl

      public URL getResourceAsUrl(String name) throws ResourceNotFoundException
      Description copied from class: LoadedLibrary
      for class and resource loading: get the URL for the specified resource
      Specified by:
      getResourceAsUrl in class LoadedLibrary
      Parameters:
      name - A resource name
      Returns:
      a URL for the requested resource
      Throws:
      ResourceNotFoundException - the given resource does not exists in this library
    • getContainedClasses

      public String[] getContainedClasses()
      Returns all classes stored in the corresponding jar file.
      Returns:
      a String[] array with the class names (in . - notation )
    • getContainedResources

      public String[] getContainedResources()
      returns an array with names of resources (other than classes) contained in the jar archive of this ClassLoader
      Returns:
      a String[]
    • getContainedFiles

      public LinkedList<String> getContainedFiles()
      Gets a list with all file names from files contained in the given jar package file.
      Returns:
      Returns a list of filenames.
    • getJarFileName

      public String getJarFileName()
      Returns the name of the corresponding jar file.
      Returns:
      a String
    • createFromJar

      public static LoadedJarLibrary createFromJar(String filename) throws IllegalArgumentException, IOException
      factory: create a LoadedJarLibrary from a JAR file and the information contained in its manifest
      Parameters:
      filename - filename of the jar file
      Returns:
      a loaded jar library representing the given file
      Throws:
      IOException - If the given jar filename could not be used
      IllegalArgumentException - If the library identifier could not be created