Package jodd.io.findfile

Examples of jodd.io.findfile.ClassScanner


  /**
   * Loads props from classpath.
   */
  public static void loadFromClasspath(final Props p, final String... patterns) {
    final ClassScanner scanner = new ClassScanner() {
      @Override
      protected void onEntry(EntryData entryData) throws IOException {
        String encoding = JoddCore.encoding;
        if (StringUtil.endsWithIgnoreCase(entryData.getName(), ".properties")) {
          encoding = StringPool.ISO_8859_1;
        }
        p.load(entryData.openInputStream(), encoding);
      }
    };
    scanner.setIncludeResources(true);
    scanner.setIgnoreException(true);
    scanner.setIncludedEntries(patterns);
    scanner.scanDefaultClasspath();
  }
View Full Code Here


  /**
   * Loads properties from classpath file(s). Properties are specified using wildcards.
   */
  public static Properties loadFromClasspath(final Properties p, String... rootTemplate) {
    ClassScanner scanner = new ClassScanner() {
      @Override
      protected void onEntry(EntryData entryData) throws IOException {
        p.load(entryData.openInputStream());
      }
    };
    scanner.setIncludeResources(true);
    scanner.setIgnoreException(true);
    scanner.setIncludedEntries(rootTemplate);
    scanner.scanDefaultClasspath();
    return p;
  }
View Full Code Here

  /**
   * Loads props from classpath.
   */
  public static void loadFromClasspath(final Props p, final String... patterns) {
    final ClassScanner scanner = new ClassScanner() {
      @Override
      protected void onEntry(EntryData entryData) throws IOException {
        String encoding = JoddCore.encoding;
        if (StringUtil.endsWithIgnoreCase(entryData.getName(), ".properties")) {
          encoding = StringPool.ISO_8859_1;
        }
        p.load(entryData.openInputStream(), encoding);
      }
    };
    scanner.setIncludeResources(true);
    scanner.setIgnoreException(true);
    scanner.setExcludeAllEntries(true);
    scanner.setIncludedEntries(patterns);
    scanner.scanDefaultClasspath();
  }
View Full Code Here

  /**
   * Loads properties from classpath file(s). Properties are specified using wildcards.
   */
  public static Properties loadFromClasspath(final Properties p, String... rootTemplate) {
    ClassScanner scanner = new ClassScanner() {
      @Override
      protected void onEntry(EntryData entryData) throws IOException {
        p.load(entryData.openInputStream());
      }
    };
    scanner.setIncludeResources(true);
    scanner.setIgnoreException(true);
    scanner.setExcludeAllEntries(true);
    scanner.setIncludedEntries(rootTemplate);
    scanner.scanDefaultClasspath();
    return p;
  }
View Full Code Here

    File containerFile = FileUtil.toContainerFile(url);

    final ValueHolder<String> jqueryName = new ValueHolder<String>();

    ClassScanner classScanner = new ClassScanner() {
      @Override
      protected void onEntry(EntryData entryData) throws Exception {
        if (entryData.getName().endsWith("jquery.js")) {
          jqueryName.setValue(entryData.getName());
        }
      }
    };

    classScanner.setIncludeResources(true);
    classScanner.scan(containerFile);

    assertNotNull(url);

    assertEquals("/META-INF/resources/webjars/jquery/2.1.1/jquery.js", jqueryName.getValue());
  }
View Full Code Here

TOP

Related Classes of jodd.io.findfile.ClassScanner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.