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写的很清楚了
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写的很清楚了
这是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
为什么不是This method will block until a character is not available
英语太差,专业词汇总理理解不了。
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());
} }
}
这是我刚写的一个,