本文整理了Java中org.springframework.roo.support.util.FileUtils.getInputStream()
方法的一些代码示例,展示了FileUtils.getInputStream()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.getInputStream()
方法的具体详情如下:
包路径:org.springframework.roo.support.util.FileUtils
类名称:FileUtils
方法名:getInputStream
[英]Loads the given file from the classpath.
[中]从类路径加载给定文件。
代码示例来源:origin: spring-projects/spring-roo
public InputStream getMessageBundle() {
return FileUtils.getInputStream(getClass(), "messages.properties");
}
}
代码示例来源:origin: spring-projects/spring-roo
public InputStream getMessageBundle() {
return FileUtils.getInputStream(getClass(), "messages_es.properties");
}
}
代码示例来源:origin: spring-projects/spring-roo
public InputStream getFlagGraphic() {
return FileUtils.getInputStream(getClass(), "es.png");
}
代码示例来源:origin: spring-projects/spring-roo
public InputStream getFlagGraphic() {
return FileUtils.getInputStream(getClass(), "gb.png");
}
代码示例来源:origin: spring-projects/spring-roo
public Document getDocumentTemplate(final String templateName) {
return XmlUtils.readXml(FileUtils.getInputStream(getClass(), templateName));
}
}
代码示例来源:origin: spring-projects/spring-roo
@Override
public Properties loadProperties(final String filename, final Class<?> loadingClass) {
return loadProperties(FileUtils.getInputStream(loadingClass, filename));
}
代码示例来源:origin: spring-projects/spring-roo
/**
* Returns the root element of the given XML file.
*
* @param clazz the class from whose package to open the file (required)
* @param xmlFilePath the path of the XML file relative to the given class'
* package (required)
* @return a non-<code>null</code> element
* @see Document#getDocumentElement()
*/
public static Element getRootElement(final Class<?> clazz, final String xmlFilePath) {
final InputStream inputStream = FileUtils.getInputStream(clazz, xmlFilePath);
Validate.notNull(inputStream, "Could not open the file '%s'", xmlFilePath);
return readXml(inputStream).getDocumentElement();
}
代码示例来源:origin: spring-projects/spring-roo
JavaType modelObject) {
String fileIdentifier = targetDirectory.concat(String.format("/%s-flow.xml", this.flowName));
InputStream inputStream = FileUtils.getInputStream(this.getClass(), "flow-template.xml");
代码示例来源:origin: spring-projects/spring-roo
private void setUpLog4jConfiguration() {
final String log4jConfigFile =
getPathResolver().getFocusedIdentifier(Path.SRC_MAIN_RESOURCES, "log4j.properties");
final InputStream templateInputStream =
FileUtils.getInputStream(getClass(), "log4j.properties-template");
OutputStream outputStream = null;
try {
outputStream = getFileManager().createFile(log4jConfigFile).getOutputStream();
IOUtils.copy(templateInputStream, outputStream);
} catch (final IOException e) {
LOGGER.warning("Unable to install log4j logging configuration");
} finally {
IOUtils.closeQuietly(templateInputStream);
IOUtils.closeQuietly(outputStream);
}
}
代码示例来源:origin: spring-projects/spring-roo
private void copyFile(String fileName, String folder) {
String file;
LogicalPath rootPath = LogicalPath.getInstance(Path.ROOT, "");
if (folder != null) {
file = pathResolver.getIdentifier(rootPath, folder + "/src/main/resources/" + fileName);
} else {
file = pathResolver.getIdentifier(rootPath, fileName);
}
InputStream inputStream = null;
OutputStream outputStream = null;
try {
inputStream = FileUtils.getInputStream(getClass(), "resources/" + fileName);
if (!fileManager.exists(file)) {
outputStream = fileManager.createFile(file).getOutputStream();
}
if (outputStream != null) {
IOUtils.copy(inputStream, outputStream);
}
} catch (final IOException ioe) {
throw new IllegalStateException(ioe);
} finally {
IOUtils.closeQuietly(inputStream);
if (outputStream != null) {
IOUtils.closeQuietly(outputStream);
}
}
}
代码示例来源:origin: spring-projects/spring-roo
inputStream = FileUtils.getInputStream(getClass(), "SpringBootApplication-template._java");
String input = IOUtils.toString(inputStream);
代码示例来源:origin: spring-projects/spring-roo
FileUtils.getInputStream(getClass(), type.name().toLowerCase() + "/" + targetFilename
+ "-template");
OutputStream outputStream = null;
代码示例来源:origin: spring-projects/spring-roo
try {
inputStream = FileUtils.getInputStream(getClass(), "ReadOnlyRepository-template._java");
String input = IOUtils.toString(inputStream);
代码示例来源:origin: spring-projects/spring-roo
private void writeAssemblyFile(JavaPackage topLevelPackage, String templateName,
String destinationFolder) {
final InputStream templateInputStream =
FileUtils.getInputStream(getClass(), "xml/" + templateName);
代码示例来源:origin: spring-projects/spring-roo
FileUtils.getInputStream(getClass(), type.name().toLowerCase() + "/obr-template.xml");
final Document docXml = XmlUtils.readXml(templateInputStream);
final Element document = docXml.getDocumentElement();
代码示例来源:origin: spring-projects/spring-roo
FileUtils.getInputStream(getClass(), "wrapper/roo-addon-wrapper-template.xml");
final Document pom = XmlUtils.readXml(templateInputStream);
final Element root = pom.getDocumentElement();
代码示例来源:origin: spring-projects/spring-roo
FileUtils.getInputStream(getClass(), "ConcurrencyExceptionManager-template._java");
String input = IOUtils.toString(inputStream);
代码示例来源:origin: spring-projects/spring-roo
inputStream = FileUtils.getInputStream(getClass(), templateName);
String input = IOUtils.toString(inputStream);
代码示例来源:origin: spring-projects/spring-roo
try {
inputStream = FileUtils.getInputStream(getClass(), "RepositoryCustomImpl-template._java");
String input = IOUtils.toString(inputStream);
代码示例来源:origin: spring-projects/spring-roo
FileUtils.getInputStream(getClass(), type.name().toLowerCase() + "/roo-addon-"
+ type.name().toLowerCase() + "-template.xml");
final Document pom = XmlUtils.readXml(templateInputStream);
内容来源于网络,如有侵权,请联系作者删除!