public java.lang.String read(java.lang.ClassLoader classLoader, java.lang.String name, boolean all) throws java.io.IOException { return StringUtil.read(classLoader, name, all); }
public java.lang.String read(java.io.InputStream is) throws java.io.IOException { return StringUtil.read(is); }
public static String read(ClassLoader classLoader, String name) throws IOException { return read(classLoader, name, false); }
public java.lang.String read(java.lang.ClassLoader classLoader, java.lang.String name) throws java.io.IOException { return StringUtil.read(classLoader, name); }
public static String read(Class<?> clazz, String name) { try (InputStream inputStream = clazz.getResourceAsStream(name)) { return read(inputStream); } catch (IOException ioe) { return ReflectionUtil.throwException(ioe); } }
private String _resolveFile(String location) { if (!location.startsWith("///")) { throw new IllegalArgumentException( StringBundler.concat( "Invalid file location ", location, " because only local ", "file URIs starting with file:/// are supported")); } try { return StringUtil.read(new FileInputStream(location.substring(2))); } catch (IOException ioe) { throw new SystemException("Unable to read file " + location, ioe); } }
@Override public String getTemplatesHelpContent(String language) { String content = StringPool.BLANK; try { Class<?> clazz = getClass(); content = StringUtil.read( clazz.getClassLoader(), getTemplatesHelpPath(language)); } catch (IOException ioe1) { try { content = StringUtil.read( PortalClassLoaderUtil.getClassLoader(), getTemplatesHelpPath(language)); } catch (IOException ioe2) { } } return content; }
public static String read(ClassLoader classLoader, String name, boolean all) throws IOException { if (all) { StringBundler sb = new StringBundler(); Enumeration<URL> enu = classLoader.getResources(name); while (enu.hasMoreElements()) { URL url = enu.nextElement(); try (InputStream is = url.openStream()) { String s = read(is); if (s != null) { sb.append(s); sb.append(StringPool.NEW_LINE); } } } String s = sb.toString(); return s.trim(); } try (InputStream is = classLoader.getResourceAsStream(name)) { if (is == null) { throw new IOException( StringBundler.concat( "Unable to open resource ", name, " in class loader ", String.valueOf(classLoader))); } String s = read(is); return s; } }
@Override public List<Element> getDefaultTemplateElements() throws Exception { String templatesConfigPath = getTemplatesConfigPath(); if (Validator.isNull(templatesConfigPath)) { return Collections.emptyList(); } Class<?> clazz = getClass(); String xml = StringUtil.read( clazz.getClassLoader(), templatesConfigPath, false); Document document = UnsecureSAXReaderUtil.read(xml); Element rootElement = document.getRootElement(); return rootElement.elements("template"); }
private String _resolveResource(String location) { ResourceRetriever resourceRetriever = _resourceManager.getResourceRetriever(location); try { return StringUtil.read(resourceRetriever.getInputStream()); } catch (IOException ioe) { throw new SystemException( "Unable to read resource " + location, ioe); } }
rules.substring(5))) { rules = StringUtil.read(is);
String propertiesString = StringUtil.read(inputStream);
public java.lang.String read(java.lang.ClassLoader classLoader, java.lang.String name, boolean all) throws java.io.IOException { return StringUtil.read(classLoader, name, all); }
public java.lang.String read(java.lang.ClassLoader classLoader, java.lang.String name) throws java.io.IOException { return StringUtil.read(classLoader, name); }
public static String read(ClassLoader classLoader, String name) throws IOException { return read(classLoader, name, false); }
@Override protected void doUpgrade() throws Exception { try (LoggingTimer loggingTimer = new LoggingTimer()) { String template = StringUtil.read( UpgradeSchema.class.getResourceAsStream( "dependencies/update.sql")); runSQLTemplateString(template, false, false); } }
protected void updateSQL() throws Exception { try (LoggingTimer loggingTimer = new LoggingTimer()) { String template = StringUtil.read( UpgradeSchema.class.getResourceAsStream( "dependencies/update.sql")); runSQLTemplateString(template, false, false); } }
private String _get(ClassLoader classLoader, String location, boolean all) { String content = _contentPool.get(location); if (content == null) { try { content = StringUtil.read(classLoader, location, all); _put(location, content); } catch (IOException ioe) { _log.error(ioe, ioe); } } return content; }
protected void upgradeSchema() throws Exception { if (hasTable("JournalArticleLocalization")) { runSQL("drop table JournalArticleLocalization"); } String template = StringUtil.read( UpgradeJournalArticleLocalizedValues.class.getResourceAsStream( "dependencies/update.sql")); runSQLTemplateString(template, false, false); }
protected List<Element> getDDMStructures( ClassLoader classLoader, String fileName, Locale locale) throws Exception { String xml = StringUtil.read(classLoader, fileName); xml = StringUtil.replace(xml, "[$LOCALE_DEFAULT$]", locale.toString()); Document document = UnsecureSAXReaderUtil.read(xml); Element rootElement = document.getRootElement(); return rootElement.elements("structure"); }