public MimeTypeDescriptions(String descriptionsResource) { InputStream stream = ResourceUtil.getInputStream(descriptionsResource); descriptions = new Properties(); try { descriptions.load(stream); stream.close(); } catch (IOException e) { Logger logger = LoggerFactory.getLogger(getClass()); logger.error("Unable to load MIME type descriptions", e); } }
InputStream stream = ResourceUtil.getInputStream(resource); if (stream == null) { logger.error("Unable to locate language profile " + resource);
InputStream defaults = ResourceUtil.getInputStream(defaultResource); if (defaults != null) { try { InputStream overrides = ResourceUtil.getInputStream(overrideResource); if (overrides != null) { logger.info("Loading overriding MIME type tree");
/** * Retrieve the String contents of the specified resource, obtained by * opening in inputstream on the resource and then interpreting the bytes * contained in the inputstream as if they represented characters. This may * not make sense on all resources. There is no "magic" in this method to * read anything other than plain text. * * @param resourceName * the name of the resource * @return the String contents of the specified resource, or null if the * specified resource could not be found * @throws IOException * when something goes wrong trying to read the resource */ public static String getString(String resourceName) throws IOException { String result = null; InputStream in = ResourceUtil.getInputStream(resourceName); if (in != null) { try { result = IOUtil.readString(in); } finally { in.close(); } } return result; }
/** * Load configuration settings from a resource on the classpath. * * @param resourceName * the name of the resource * @return the contents of the resources as a String, or null if the * resource, nor its default, could be found * @throws IOException * if the resource could not be read due to an I/O problem */ public static String loadConfigurationContents(String resourceName) throws IOException { String result = null; InputStream in = ResourceUtil.getInputStream(getResourceName(resourceName)); if (in == null) { in = ResourceUtil.getInputStream(getDefaultResourceName(resourceName)); } if (in != null) { result = IOUtil.readString(in); } return result; }
/** * Load configuration settings from a resource on the classpath. * * @param resourceName * the name of the resource * @return the contents of the resources as a String, or null if the * resource, nor its default, could be found * @throws IOException * if the resource could not be read due to an I/O problem */ public static String loadConfigurationContents(String resourceName) throws IOException { String result = null; InputStream in = ResourceUtil.getInputStream(getResourceName(resourceName)); if (in == null) { in = ResourceUtil.getInputStream(getDefaultResourceName(resourceName)); } if (in != null) { result = IOUtil.readString(in); } return result; }
InputStream in = ResourceUtil.getInputStream(defaultResourceName); if (in != null) { defaultResult = IOUtil.readProperties(in, defaults); in = ResourceUtil.getInputStream(getResourceName(resourceName)); if (in != null) { result = IOUtil.readProperties(in, defaultResult);
InputStream in = ResourceUtil.getInputStream(defaultResourceName); if (in != null) { defaultResult = IOUtil.readProperties(in, defaults); in = ResourceUtil.getInputStream(getResourceName(resourceName)); if (in != null) { result = IOUtil.readProperties(in, defaultResult);