Class IOUtil

java.lang.Object
com.wechat.pay.java.core.util.IOUtil

public class IOUtil extends Object
I/O工具
  • Method Details

    • toByteArray

      public static byte[] toByteArray(InputStream inputStream) throws IOException
      转换输入流为字节数组
      Parameters:
      inputStream - 输入流
      Returns:
      字节数组
      Throws:
      IOException - 读取字节失败、关闭流失败等
    • toString

      public static String toString(InputStream inputStream) throws IOException
      转换输入流为字符串
      Parameters:
      inputStream - 输入流
      Returns:
      UTF-8编码的字符串
      Throws:
      IOException - 读取字节失败、关闭流失败等
    • loadStringFromPath

      public static String loadStringFromPath(String path) throws IOException
      从文件路径中读取字符串
      Parameters:
      path - 文件路径
      Returns:
      UTF-8编码的字符串
      Throws:
      IOException - 读取字节失败、关闭流失败等