read
public int read()
         throws IOException
Read a single character. This method will block until a character is available, an I/O error occurs, or the end of the stream is reached. 
Subclasses that intend to support efficient single-character input should override this method. 
Returns:
The character read, as an integer in the range 0 to 65535 (0x00-0xffff), or -1 if the end of the stream has been reached 
Throws: 
IOException - If an I/O error occurs写的很清楚了

解决方案 »

  1.   

    read
    这是javadoc:public int read()
             throws IOExceptionRead a single character. Overrides:
    read in class Reader
    Returns:
    The character read, or -1 if the end of the stream has been reached 
    Throws: 
    IOException - If an I/O error occurs
      

  2.   

    楼上你比我快,我就打开了一下javadoc,你就比我先了
      

  3.   

    This method will block until a character is available,这句话不太明白。
    为什么不是This method will block until a character is not available
    英语太差,专业词汇总理理解不了。
      

  4.   

    这句话是说这个方法会发生阻塞直到有一个有效的字符,
    import java.io.*;public class Test1 { public static void main(String[] args) {
    try {
    BufferedReader in1 = 
    new BufferedReader(
    new FileReader("Test1.java"));
    BufferedWriter out1 = 
    new BufferedWriter(
    new FileWriter("TEMP.txt")); String s2 = new String();
    String s; while((s = in1.readLine()) != null){
    s2 += s + "\n";
    }
    out1.write(s2);
    in1.close();
    out1.close();
    } catch (Exception e) {
    System.out.println(e.toString());
    } }
    }
    这是我刚写的一个,
      

  5.   

    你看看nio的channel,两个channel,然后一个transform就可以了,嘿嘿。根本不用这么多代码