System.out.print((char)in.readByte());
不要变成char型,不能支持中文的啊用string sMessage=new String(byte[] bMessage);

解决方案 »

  1.   

    我改为
    String str = new String(Byte.toString(in.readByte()).getBytes("ISO8859_1"),"GBK");
    System.out.print(str);
    则全部显示乱码,英文也显示不了了,在这里byte怎么不能转换为String呢?
      

  2.   

    text = new String(text.toString().getBytes("8859_1"),"gb2312")
      

  3.   

    byte[] buffer=new byte[n];
    int length=in.read(buffer);
    String tmp=new String(buffer, 0, length, "UnicodeLittleUned");
    if(length>0)
         System.out.println(tmp);
      

  4.   

    中文字符可是又字节的,你要用类FileInputStream或FileOutputStream啊!还有读取的方法也不对!