当前位置: 技术问答>java相关
socket读取中文数字混合字符出错
来源: 互联网 发布时间:2015-08-26
本文导语: 当提交数据为中文和数字连续书写时,得不到正确内容,测试程序片断如下 PushbackReader bis = new PushbackReader(new BufferedReader(new InputStreamReader(socket.getInputStream()),socket.getReceiveBufferSize())); char[] b1=new char[50]; ...
当提交数据为中文和数字连续书写时,得不到正确内容,测试程序片断如下
PushbackReader bis = new PushbackReader(new BufferedReader(new InputStreamReader(socket.getInputStream()),socket.getReceiveBufferSize()));
char[] b1=new char[50];
int c;
while (true) {
c=bis.read();
if (c==-1) {
break;
}
else{
bis.unread(c);
}
int count=bis.read(b1);
for (int i=0;i
PushbackReader bis = new PushbackReader(new BufferedReader(new InputStreamReader(socket.getInputStream()),socket.getReceiveBufferSize()));
char[] b1=new char[50];
int c;
while (true) {
c=bis.read();
if (c==-1) {
break;
}
else{
bis.unread(c);
}
int count=bis.read(b1);
for (int i=0;i