类 ChannelUtil

java.lang.Object
com.weicoder.common.io.ChannelUtil
直接已知子类:
U.Ch

public class ChannelUtil extends Object
nio通道操作
作者:
WD
  • 构造器详细资料

    • ChannelUtil

      public ChannelUtil()
  • 方法详细资料

    • read

      public static byte[] read(ReadableByteChannel ch)
      读取出通道的所有字节
      参数:
      ch - 通道
      返回:
      字节数组
    • read

      public static byte[] read(ReadableByteChannel ch, boolean isClose)
      读取出通道的所有字节
      参数:
      ch - 通道
      isClose - 是否关闭流
      返回:
      字节数组
    • write

      public static long write(WritableByteChannel wbc, byte[] b)
      把text写入到os中
      参数:
      wbc - 写入通道
      b - 字节数组
      返回:
      true false
    • write

      public static long write(WritableByteChannel wbc, byte[] b, boolean isClose)
      把text写入到os中
      参数:
      wbc - 写入通道
      b - 字节数组
      isClose - 是否关闭流
      返回:
      true false
    • write

      public static long write(WritableByteChannel wbc, InputStream in)
      把text写入到os中
      参数:
      wbc - 写入通道
      in - 输入流
      返回:
      true false
    • write

      public static long write(WritableByteChannel wbc, InputStream in, boolean isClose)
      把text写入到os中
      参数:
      wbc - 写入通道
      in - 输入流
      isClose - 是否关闭流
      返回:
      true false
    • write

      public static int write(String file, ByteBuffer src)
      写入文件
      参数:
      file - 要写入的文件
      src - 原始数据
      返回:
      写入字节数
    • write

      public static long write(ReadableByteChannel rbc, WritableByteChannel wbc, boolean isClose)
      把text写入到os中
      参数:
      wbc - 写入通道
      rbc - 输入流
      isClose - 是否关闭流
      返回:
      true false
    • write

      public static long write(ReadableByteChannel rbc, WritableByteChannel wbc, int buff, Callback<Buffer,Buffer> call)
      读取并写入数据 默认不关闭流
      参数:
      rbc - 读取通道
      wbc - 写入通道
      buff - 每次读取缓存熟
      call - 回调
      返回:
      读取流总数
    • write

      public static long write(ReadableByteChannel rbc, WritableByteChannel wbc, int buff, boolean isClose, Callback<Buffer,Buffer> call)
      读取并写入数据
      参数:
      rbc - 读取通道
      wbc - 写入通道
      buff - 每次读取缓存数
      isClose - 是否关闭流
      call - 回调
      返回:
      读取流总数