本文整理了Java中org.mule.util.IOUtils.getResourceAsString()
方法的一些代码示例,展示了IOUtils.getResourceAsString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils.getResourceAsString()
方法的具体详情如下:
包路径:org.mule.util.IOUtils
类名称:IOUtils
方法名:getResourceAsString
[英]Attempts to load a resource from the file system, from a URL, or from the classpath, in that order.
[中]尝试按该顺序从文件系统、URL或类路径加载资源。
代码示例来源:origin: org.mule.modules/mule-module-db
@Override
public String getResourceAsString(String resourceName) throws IOException
{
return IOUtils.getResourceAsString(resourceName, getClass());
}
}
代码示例来源:origin: org.mule.modules/mule-module-management
private void loadLicense(String licenseFile) throws IOException
{
license = IOUtils.getResourceAsString(licenseFile, getClass());
license = StringMessageUtils.getBoilerPlate(license, ' ', 80);
}
代码示例来源:origin: org.mule/mule-core
public void initialise() throws InitialisationException
{
if (dataFile != null)
{
try
{
data = IOUtils.getResourceAsString(dataFile, getClass());
}
catch (IOException e)
{
throw new InitialisationException(e, this);
}
}
}
代码示例来源:origin: org.mule/mule-core
private void loadTemplate() throws InitialisationException
{
try
{
if(location == null)
{
throw new IllegalArgumentException("Location cannot be null");
}
template = IOUtils.getResourceAsString(location, this.getClass());
}
catch(Exception e)
{
throw new InitialisationException(e, this);
}
}
代码示例来源:origin: org.mule.modules/mule-module-spring-config
public Object getObject() throws Exception
{
if(data!=null)
{
return data;
}
if(file!=null)
{
if(binary)
{
data = IOUtils.toByteArray(IOUtils.getResourceAsStream(file, getClass()));
}
else
{
data = IOUtils.getResourceAsString(file, getClass());
}
}
else if(ref!=null)
{
data = context.getBean(ref);
}
if(data==null)
{
throw new IllegalArgumentException("Data is null was not found");
}
return data;
}
代码示例来源:origin: org.mule.modules/mule-module-spring-config
try
returnData = IOUtils.getResourceAsString(file, getClass());
代码示例来源:origin: org.mule.modules/mule-module-xml
@Override
protected void doInitialise() throws InitialisationException
{
logger.debug("Initialising transformer: " + this);
try
{
// Only load the file once at initialize time
if (xslFile != null)
{
this.xslt = IOUtils.getResourceAsString(xslFile, getClass());
}
if (uriResolver == null)
{
this.uriResolver = new LocalURIResolver(xslFile);
}
transformerPool.addObject();
}
catch (Throwable te)
{
throw new InitialisationException(te, this);
}
}
代码示例来源:origin: org.mule/mule-core
@Override
public void initialise() throws InitialisationException
{
if (expressionFile != null)
{
try
{
expression = IOUtils.getResourceAsString(expressionFile, getClass());
}
catch (IOException e)
{
throw new InitialisationException(e, this);
}
}
else if (expression == null)
{
throw new InitialisationException(CoreMessages.objectIsNull("expression"), this);
}
}
代码示例来源:origin: org.mule/mule-core
protected void loadGlobalFunctions() throws InitialisationException
{
// Global functions defined in external file
if (globalFunctionsFile != null)
{
try
{
globalFunctions.putAll(CompilerTools.extractAllDeclaredFunctions(new ExpressionCompiler(
IOUtils.getResourceAsString(globalFunctionsFile, getClass())).compile()));
}
catch (IOException e)
{
throw new InitialisationException(CoreMessages.failedToLoad(globalFunctionsFile), e, this);
}
}
// Global functions defined in configuration file (take precedence over functions in file)
globalFunctions.putAll(CompilerTools.extractAllDeclaredFunctions(new ExpressionCompiler(
globalFunctionsString).compile()));
}
代码示例来源:origin: org.mule.transports/mule-transport-soap
this.wsdlFileContents = IOUtils.getResourceAsString(this.wsdlFile, getClass());
代码示例来源:origin: org.mule.modules/mule-module-xml
@Override
protected void doInitialise() throws InitialisationException
{
if (xquery != null && xqueryFile != null)
{
throw new InitialisationException(XmlMessages.canOnlySetFileOrXQuery(), this);
}
try
{
if (xqueryFile != null)
{
xquery = IOUtils.getResourceAsString(xqueryFile, getClass());
}
if (configuration == null)
{
configuration = new Configuration();
}
XQDataSource ds = new SaxonXQDataSource(configuration);
connection = ds.getConnection();
transformerPool.addObject();
}
catch (Throwable te)
{
throw new InitialisationException(te, this);
}
}
代码示例来源:origin: org.mule.modules/mule-module-cxf
this.wsdlFileContents = IOUtils.getResourceAsString(this.wsdlFile, getClass());
内容来源于网络,如有侵权,请联系作者删除!