use
Reader r = new BufferedReader(new InputStreamReader(InputStream,encoding));

解决方案 »

  1.   

    import java.io.*;public class Echo {
      public static void main(String[] args) {
        DataInputStream in =
          new DataInputStream(
            new BufferedInputStream(System.in));
        String s;
        try {
          while((s = in.readLine()).length() != 0)
            System.out.println(Echo.makecn(s));
          // An empty line terminates the program
        } catch(IOException e) {
          e.printStackTrace();
        }
      }
     public static String makecn(String cn_string)
       {
            String temp = null;
            try
            {
                temp = new String(cn_string.getBytes("ISO8859_1"), "GB2312");
            }
            catch(Exception exception) { }
            return temp;
       }
    } ///:~
      

  2.   

    你好:
    首先:初始化一个InputStream,然后调用里面的一个方法(忘了),得到有几个byte.
    然后:初始化一个byte array ,用来存放InputStream 里面的bytes.
    接着:调用InputStream 里面的一个方法,按一个一个字节写入byte array .
    最后:用一个String什么的吧byte array 连接起来。
    好了,我的测试代码不在身边,应该没有问题的,你自己试试看吧。
    呵呵
      

  3.   

    to xmvigour(微电)
       Your are Great!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11