热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.mule.util.IOUtils类的使用及代码示例

本文整理了Java中org.mule.util.IOUtils类的一些代码示例,展示了IOUtils类的具体用法。这些代码示例主要来源于

本文整理了Java中org.mule.util.IOUtils类的一些代码示例,展示了IOUtils类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils类的具体详情如下:
包路径:org.mule.util.IOUtils
类名称:IOUtils

IOUtils介绍

[英]Mule input/output utilities.
[中]Mule输入/输出实用程序。

代码示例

代码示例来源: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 an InputStream to the resource or null if resource not found
* @throws java.io.IOException IO error
*/
public static InputStream getResourceAsStream(final String resourceName,
final Class callingClass) throws IOException
{
return getResourceAsStream(resourceName, callingClass, true, true);
}

代码示例来源:origin: org.mule.modules/mule-module-spring-config

public CachedResource(Reader reader, String encoding) throws IOException
{
this(IOUtils.toByteArray(reader, encoding), DEFAULT_DESCRIPTION);
}

代码示例来源: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/mule-core

protected String createStringFromInputStream(InputStream input)
{
try
{
return IOUtils.toString(input);
}
finally
{
IOUtils.closeQuietly(input);
}
}

代码示例来源:origin: com.mulesoft.munit/mule-munit-support

public static synchronized void copyStreamToFile(InputStream input, File destination) throws IOException {
if (destination.exists() && !destination.canWrite()) {
throw new IOException("Destination file does not exist or is not writeable");
}
try {
FileOutputStream output = new FileOutputStream(destination);
try {
IOUtils.copy(input, output);
} finally {
IOUtils.closeQuietly(output);
}
} 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.modules/mule-module-db

@Override
public String getResourceAsString(String resourceName) throws IOException
{
return IOUtils.getResourceAsString(resourceName, getClass());
}
}

代码示例来源:origin: org.mule.transports/mule-transport-servlet

InputStream in = IOUtils.getResourceAsStream(file, getClass(), false, false);
if (in == null)
IOUtils.copyLarge(in, baos);
byte[] buffer = baos.toByteArray();

代码示例来源:origin: org.mule/mule-core

private void updateTextFile()
{
Properties props = getStoreAsProperties();
try
{
if (output != null)
{
closeQuietly(output);
}
output = new FileOutputStream(fileStore, false);
props.store(output, StringUtils.EMPTY);
}
catch (IOException e)
{
logger.error(e.getMessage(), e);
}
}

代码示例来源:origin: org.mule/mule-core

try
bytes = IOUtils.toByteArray(input);
IOUtils.closeQuietly(input);

代码示例来源:origin: org.mule/mule-core

/**
* Attempts to load a resource from the file system 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 an URL to the resource or null if resource not found
*/
public static URL getResourceAsUrl(final String resourceName, final Class callingClass)
{
return getResourceAsUrl(resourceName, callingClass, true, true);
}

代码示例来源:origin: org.mule.transports/mule-transport-http

parts[i] = new CustomStringPart(ds.getName(), IOUtils.toString(ds.getInputStream()), mimeType.getParameter(CHARSET_PARAM_NAME), mimeType.getBaseType());
IOUtils.toByteArray(dh.getInputStream())), dh.getContentType(), null);

代码示例来源: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.transports/mule-transport-http

IOUtils.copyLarge(in, baos);
IOUtils.closeQuietly(in);

代码示例来源:origin: org.mule/mule-core

public void write(MuleEvent event, OutputStream out) throws IOException
{
InputStream is = (InputStream) src;
try
{
IOUtils.copyLarge(is, out);
}
finally
{
is.close();
}
}
};

代码示例来源:origin: org.mule/mule-core

protected String createStringFromInputStream(InputStream input, String outputEncoding)
throws TransformerException
{
try
{
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
IOUtils.copy(input, byteOut);
return byteOut.toString(outputEncoding);
}
catch (IOException e)
{
throw new TransformerException(CoreMessages.errorReadingStream(), e);
}
finally
{
try
{
input.close();
}
catch (IOException e)
{
logger.warn("Could not close stream", e);
}
}
}

代码示例来源:origin: org.mule/mule-core

public static synchronized void copyStreamToFile(InputStream input, File destination) throws IOException
{
if (destination.exists() && !destination.canWrite())
{
throw new IOException("Destination file does not exist or is not writeable");
}
try
{
FileOutputStream output = new FileOutputStream(destination);
try
{
IOUtils.copy(input, output);
}
finally
{
IOUtils.closeQuietly(output);
}
}
finally
{
IOUtils.closeQuietly(input);
}
}

代码示例来源: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

@Override
public synchronized void dispose()
{
Properties props = getStoreAsProperties();
if (output == null)
{
try
{
output = new FileOutputStream(fileStore, false);
props.store(output, StringUtils.EMPTY);
closeQuietly(output);
}
catch (IOException e)
{
logger.error(e.getMessage(), e);
}
}
else
{
closeQuietly(output);
}
super.dispose();
}

代码示例来源: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);
}

推荐阅读
  • SpringBoot uri统一权限管理的实现方法及步骤详解
    本文详细介绍了SpringBoot中实现uri统一权限管理的方法,包括表结构定义、自动统计URI并自动删除脏数据、程序启动加载等步骤。通过该方法可以提高系统的安全性,实现对系统任意接口的权限拦截验证。 ... [详细]
  • Java容器中的compareto方法排序原理解析
    本文从源码解析Java容器中的compareto方法的排序原理,讲解了在使用数组存储数据时的限制以及存储效率的问题。同时提到了Redis的五大数据结构和list、set等知识点,回忆了作者大学时代的Java学习经历。文章以作者做的思维导图作为目录,展示了整个讲解过程。 ... [详细]
  • Java学习笔记之面向对象编程(OOP)
    本文介绍了Java学习笔记中的面向对象编程(OOP)内容,包括OOP的三大特性(封装、继承、多态)和五大原则(单一职责原则、开放封闭原则、里式替换原则、依赖倒置原则)。通过学习OOP,可以提高代码复用性、拓展性和安全性。 ... [详细]
  • 本文介绍了Swing组件的用法,重点讲解了图标接口的定义和创建方法。图标接口用来将图标与各种组件相关联,可以是简单的绘画或使用磁盘上的GIF格式图像。文章详细介绍了图标接口的属性和绘制方法,并给出了一个菱形图标的实现示例。该示例可以配置图标的尺寸、颜色和填充状态。 ... [详细]
  • Java序列化对象传给PHP的方法及原理解析
    本文介绍了Java序列化对象传给PHP的方法及原理,包括Java对象传递的方式、序列化的方式、PHP中的序列化用法介绍、Java是否能反序列化PHP的数据、Java序列化的原理以及解决Java序列化中的问题。同时还解释了序列化的概念和作用,以及代码执行序列化所需要的权限。最后指出,序列化会将对象实例的所有字段都进行序列化,使得数据能够被表示为实例的序列化数据,但只有能够解释该格式的代码才能够确定数据的内容。 ... [详细]
  • 阿,里,云,物,联网,net,core,客户端,czgl,aliiotclient, ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 本文详细介绍了Java中vector的使用方法和相关知识,包括vector类的功能、构造方法和使用注意事项。通过使用vector类,可以方便地实现动态数组的功能,并且可以随意插入不同类型的对象,进行查找、插入和删除操作。这篇文章对于需要频繁进行查找、插入和删除操作的情况下,使用vector类是一个很好的选择。 ... [详细]
  • 本文介绍了iOS数据库Sqlite的SQL语句分类和常见约束关键字。SQL语句分为DDL、DML和DQL三种类型,其中DDL语句用于定义、删除和修改数据表,关键字包括create、drop和alter。常见约束关键字包括if not exists、if exists、primary key、autoincrement、not null和default。此外,还介绍了常见的数据库数据类型,包括integer、text和real。 ... [详细]
  • Java中包装类的设计原因以及操作方法
    本文主要介绍了Java中设计包装类的原因以及操作方法。在Java中,除了对象类型,还有八大基本类型,为了将基本类型转换成对象,Java引入了包装类。文章通过介绍包装类的定义和实现,解答了为什么需要包装类的问题,并提供了简单易用的操作方法。通过本文的学习,读者可以更好地理解和应用Java中的包装类。 ... [详细]
  • 基于Socket的多个客户端之间的聊天功能实现方法
    本文介绍了基于Socket的多个客户端之间实现聊天功能的方法,包括服务器端的实现和客户端的实现。服务器端通过每个用户的输出流向特定用户发送消息,而客户端通过输入流接收消息。同时,还介绍了相关的实体类和Socket的基本概念。 ... [详细]
  • ***byte(字节)根据长度转成kb(千字节)和mb(兆字节)**parambytes*return*publicstaticStringbytes2kb(longbytes){ ... [详细]
  • 本文整理了Java面试中常见的问题及相关概念的解析,包括HashMap中为什么重写equals还要重写hashcode、map的分类和常见情况、final关键字的用法、Synchronized和lock的区别、volatile的介绍、Syncronized锁的作用、构造函数和构造函数重载的概念、方法覆盖和方法重载的区别、反射获取和设置对象私有字段的值的方法、通过反射创建对象的方式以及内部类的详解。 ... [详细]
  • 本文介绍了使用Spark实现低配版高斯朴素贝叶斯模型的原因和原理。随着数据量的增大,单机上运行高斯朴素贝叶斯模型会变得很慢,因此考虑使用Spark来加速运行。然而,Spark的MLlib并没有实现高斯朴素贝叶斯模型,因此需要自己动手实现。文章还介绍了朴素贝叶斯的原理和公式,并对具有多个特征和类别的模型进行了讨论。最后,作者总结了实现低配版高斯朴素贝叶斯模型的步骤。 ... [详细]
  • 微信官方授权及获取OpenId的方法,服务器通过SpringBoot实现
    主要步骤:前端获取到code(wx.login),传入服务器服务器通过参数AppID和AppSecret访问官方接口,获取到OpenId ... [详细]
author-avatar
尽做好风水_549_881
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有