问题描述
ByteBufferbyteBuffer=ByteBuffer.allocate(BUFFERSIZE);booleanisConnect=true;try{intnbytes=channel.read(byteBuffer);if(nbytes==-1){isConnect=false;}}catch(IOExceptione){isConnect=false;}if(!isConnect){channel.close();msgBufs=newStringBuffer("");return;}byteBuffer.flip();Stringstr=bytesToHexStr(byteBuffer.array());System.out.println(str);//输出十六进制byte[]b=str.getBytes("UnicodeBigUnmarked");System.out.println(newString(b,"GBK"));//乱码高手解决下,急
解决方案
解决方案二:
愁人
时间: 2024-12-20 22:49:48