示例#1
0
  /**
   * Reads local resources from - Jar files - Class folders - Jar Library folders
   *
   * @param fol
   * @param packName
   * @throws IOException
   */
  private void loadResource(File fol, String packName) throws IOException {
    if (fol.isFile()) {
      if (fol.getName().toLowerCase().endsWith(".class")) {
        loadClassContent(fol.getAbsolutePath(), packName);
      } else {
        if (fol.getName().toLowerCase().endsWith(".jar")) {
          loadJar(fol.getAbsolutePath());
        } else {
          loadResourceContent(fol.getAbsolutePath());
        }
      }

      return;
    }

    if (fol.list() != null) {
      for (String f : fol.list()) {
        File fl = new File(fol.getAbsolutePath() + "/" + f);

        String pn = packName;

        if (fl.isDirectory()) {

          if (!pn.equals("")) pn = pn + "/";

          pn = pn + fl.getName();
        }

        loadResource(fl, pn);
      }
    }
  }
示例#2
0
 /**
  * Reads local and remote resources
  *
  * @param url
  * @throws IOException
  */
 public void loadResource(URL url) throws IOException {
   try {
     // Is Local
     loadResource(new File(url.toURI()), "");
   } catch (IllegalArgumentException iae) {
     // Is Remote
     loadRemoteResource(url);
   } catch (URISyntaxException e) {
     throw new JclException("URISyntaxException", e);
   }
 }
示例#3
0
 /**
  * Reads local resources from - Jar files - Class folders - Jar Library folders
  *
  * @param path
  * @throws IOException
  */
 public void loadResource(String path) throws IOException {
   if (logger.isTraceEnabled()) logger.trace("Resource: " + path);
   loadResource(new File(path), "");
 }