Package com.weicoder.common.io
Class ChannelUtil
- java.lang.Object
-
- com.weicoder.common.io.ChannelUtil
-
- Direct Known Subclasses:
U.Ch
public class ChannelUtil extends java.lang.Objectnio通道操作- 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 booleanwrite(java.nio.channels.WritableByteChannel wbc, byte[] b)把text写入到os中static booleanwrite(java.nio.channels.WritableByteChannel wbc, byte[] b, boolean isClose)把text写入到os中static booleanwrite(java.nio.channels.WritableByteChannel wbc, java.io.InputStream in)把text写入到os中static booleanwrite(java.nio.channels.WritableByteChannel wbc, java.io.InputStream in, boolean isClose)把text写入到os中
-
-
-
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
-
-