/** * Constructor. * * @param name * the name of the library; the "<library>.properties" (where <<library> * is the name of the library) will be loaded from the root of the classpath. */ protected Library(String name) { this.name = name; String path = PROPERTIES_FILE.replaceAll("\\$\\{library\\}", name); logger.trace("loading from '{}'", path); try(InputStream stream = Streams.fromURL(path)){ properties.load(stream); } catch (IOException e) { logger.error("error loading library properties from input stream", e); } catch (PropertiesException e) { logger.error("error loading library properties from input stream", e); } }
String path = PROPERTIES_FILE.replaceAll("\\$\\{library\\}", name); logger.trace("loading from '{}'", path); stream = Streams.fromURL(path); properties.load(stream); } catch (IOException e) {
String path = PROPERTIES_FILE.replaceAll("\\$\\{library\\}", name); logger.trace("loading from '{}'", path); stream = Streams.fromURL(path); properties.load(stream); } catch (IOException e) {
/** * Reads a resource from an URL, specified as a string; since this class makes * use of the URL factory, URLs may also represent resources in the class * path, re (in the format "classpath:org/dihedron/resources/MyResource.png"). * * @param url * a string presenting an URL. * @return * an input stream to access the URL. * @throws IOException * if the URL is malformed or an error occurs opening the stream. */ public static InputStream fromURL(String url) throws IOException { if(Strings.isValid(url)) { return fromURL(URLFactory.makeURL(url)); } return null; }
/** * Reads a resource from an URL, specified as a string; since this class makes * use of the URL factory, URLs may also represent resources in the class * path, re (in the format "classpath:org/dihedron/resources/MyResource.png"). * * @param url * a string presenting an URL. * @return * an input stream to access the URL. * @throws IOException * if the URL is malformed or an error occurs opening the stream. */ public static InputStream fromURL(String url) throws IOException { if(Strings.isValid(url)) { return fromURL(URLFactory.makeURL(url)); } return null; }
/** * Reads a resource from an URL, specified as a string; since this class makes * use of the URL factory, URLs may also represent resources in the class * path, re (in the format "classpath:org/dihedron/resources/MyResource.png"). * * @param url * a string presenting an URL. * @return * an input stream to access the URL. * @throws IOException * if the URL is malformed or an error occurs opening the stream. */ public static InputStream fromURL(String url) throws IOException { if(Strings.isValid(url)) { return fromURL(URLFactory.makeURL(url)); } return null; }