标签:处理 buffere input buffered get read 使用 put exce
1、使用 tcp 协议 读取 输入流的固定长度的字节数
public static byte[] getTcpSpecificBytes(BufferedInputStream bis,int length) throws IOException{
byte[] bytes = new byte[len];
int readLength = 0;
int hasReadedLength = 0;
while((readLength = bis.read(bytes, hasReadedLength, length - hasReadedLength)) > 0 ){
hasReadedLength += readLength;
}
return bytes;
}
标签:处理 buffere input buffered get read 使用 put exce
原文地址:http://www.cnblogs.com/shlerlock/p/7766148.html