本文整理了Java中org.mule.util.IOUtils.toString()
方法的一些代码示例,展示了IOUtils.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils.toString()
方法的具体详情如下:
包路径:org.mule.util.IOUtils
类名称:IOUtils
方法名:toString
[英]This method wraps org.apache.commons.io.IOUtils' toString(InputStream)
method but catches any IOException and wraps it into a RuntimeException.
[中]这个方法包装了组织。阿帕奇。平民木卫一。IOUtils'toString(InputStream)
方法,但捕获任何IOException并将其包装为RuntimeException。
代码示例来源:origin: org.mule/mule-core
protected String createStringFromInputStream(InputStream input)
{
try
{
return IOUtils.toString(input);
}
finally
{
IOUtils.closeQuietly(input);
}
}
代码示例来源:origin: org.mule/mule-core
/**
* Attempts to load a resource from the file system, from a URL, or from the
* classpath, in that order.
*
* @param resourceName The name of the resource to load
* @param callingClass The Class object of the calling object
* @return the requested resource as a string
* @throws java.io.IOException IO error
*/
public static String getResourceAsString(final String resourceName, final Class callingClass)
throws IOException
{
try (InputStream is = getResourceAsStream(resourceName, callingClass))
{
if (is != null)
{
return toString(is);
}
else
{
throw new IOException("Unable to load resource " + resourceName);
}
}
}
代码示例来源:origin: org.mule/mule-core
@Override
protected Object doTransform(Object src, String encoding) throws TransformerException
{
String string;
if (src instanceof byte[])
{
string = new String((byte[]) src);
}
else if (src instanceof InputStream)
{
InputStream input = (InputStream) src;
try
{
string = IOUtils.toString(input);
}
finally
{
IOUtils.closeQuietly(input);
}
}
else
{
string = (String) src;
}
return append(message, string);
}
代码示例来源:origin: org.mule.modules/mule-module-devkit-support
return IOUtils.toString(conn.getInputStream());
String response = IOUtils.toString(errorStream);
String errorMsg = String.format("Received status code [%d] while trying to get OAuth2 verification code. Response body was [%s]", responseCode, response);
logger.error(errorMsg);
代码示例来源:origin: org.mule/mule-core
@Override
public Object doTransform(Object src, String encoding) throws TransformerException
{
try
{
String data;
if (src instanceof byte[])
{
data = new String((byte[]) src, encoding);
}
else if (src instanceof InputStream)
{
data = IOUtils.toString((InputStream)src);
}
else
{
data = (String) src;
}
return XMLEntityCodec.decodeString(data);
}
catch (Exception ex)
{
throw new TransformerException(
CoreMessages.transformFailed(src.getClass().getName(), "XML"),
this, ex);
}
}
代码示例来源:origin: org.mule/mule-core
try
data = IOUtils.toString(input);
代码示例来源:origin: org.mule.modules/mule-module-db
@Override
public void setParameterValue(PreparedStatement statement, int index, Object value) throws SQLException
{
if (value != null && !(value instanceof Clob))
{
Clob clob = statement.getConnection().createClob();
if (value instanceof String)
{
clob.setString(1, (String) value);
}
else if (value instanceof InputStream)
{
clob.setString(1, IOUtils.toString((InputStream) value));
}
else
{
throw new IllegalArgumentException(createUnsupportedTypeErrorMessage(value));
}
value = clob;
}
super.setParameterValue(statement, index, value);
}
代码示例来源:origin: org.mule/mule-core
return IOUtils.toString(pushbackStream, encoding);
代码示例来源:origin: org.mule.modules/mule-module-http
payload = decodeUrlEncodedBody(IOUtils.toString(((InputStreamHttpEntity) entity).getInputStream()), encoding);
代码示例来源:origin: org.mule.transports/mule-transport-http
parts[i] = new CustomStringPart(ds.getName(), IOUtils.toString(ds.getInputStream()), mimeType.getParameter(CHARSET_PARAM_NAME), mimeType.getBaseType());
代码示例来源:origin: org.mule.modules/mule-module-http
payload = HttpParser.decodeString(IOUtils.toString(responseInputStream), encoding);
内容来源于网络,如有侵权,请联系作者删除!