Class ChannelUtil

  • Direct Known Subclasses:
    U.Ch

    public class ChannelUtil
    extends java.lang.Object
    nio通道操作
    Author:
    WD
    • Constructor Summary

      Constructors 
      Constructor Description
      ChannelUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] read​(java.nio.channels.ReadableByteChannel ch)
      读取出通道的所有字节
      static byte[] read​(java.nio.channels.ReadableByteChannel ch, boolean isClose)
      读取出通道的所有字节
      static boolean write​(java.nio.channels.WritableByteChannel wbc, byte[] b)
      把text写入到os中
      static boolean write​(java.nio.channels.WritableByteChannel wbc, byte[] b, boolean isClose)
      把text写入到os中
      static boolean write​(java.nio.channels.WritableByteChannel wbc, java.io.InputStream in)
      把text写入到os中
      static boolean write​(java.nio.channels.WritableByteChannel wbc, java.io.InputStream in, boolean isClose)
      把text写入到os中
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ChannelUtil

        public ChannelUtil()
    • Method Detail

      • read

        public static byte[] read​(java.nio.channels.ReadableByteChannel ch)
        读取出通道的所有字节
        Parameters:
        ch - 通道
        Returns:
        字节数组
      • read

        public static byte[] read​(java.nio.channels.ReadableByteChannel ch,
                                  boolean isClose)
        读取出通道的所有字节
        Parameters:
        ch - 通道
        isClose - 是否关闭流
        Returns:
        字节数组
      • write

        public static boolean write​(java.nio.channels.WritableByteChannel wbc,
                                    byte[] b)
        把text写入到os中
        Parameters:
        wbc - 写入通道
        b - 字节数组
        Returns:
        true false
      • write

        public static boolean write​(java.nio.channels.WritableByteChannel wbc,
                                    byte[] b,
                                    boolean isClose)
        把text写入到os中
        Parameters:
        wbc - 写入通道
        b - 字节数组
        isClose - 是否关闭流
        Returns:
        true false
      • write

        public static boolean write​(java.nio.channels.WritableByteChannel wbc,
                                    java.io.InputStream in)
        把text写入到os中
        Parameters:
        wbc - 写入通道
        in - 输入流
        Returns:
        true false
      • write

        public static boolean write​(java.nio.channels.WritableByteChannel wbc,
                                    java.io.InputStream in,
                                    boolean isClose)
        把text写入到os中
        Parameters:
        wbc - 写入通道
        in - 输入流
        isClose - 是否关闭流
        Returns:
        true false