Java IOѧϰ±Ê¼Ç£º×Ö·ûÁ÷
Java IOѧϰ±Ê¼Ç£º×Ö·ûÁ÷
×Ö·ûÁ÷µÄ´¦ÀíºÍ×Ö½ÚÁ÷²î²»¶à£¬API»ù±¾ÉÏÍêÈ«Ò»Ñù£¬¾ÍÊǼÆÁ¿µ¥Î»²»Í¬¡£ÁíÍâ×Ö·ûÁ÷»¹ÌṩһЩÆäËûµÄ´¦ÀíÁ÷£¬±ÈÈç°´ÐжÁÈ¡Á÷¡¢×Ö·û´®Á÷µÈµÈ¡£
ÏÂÃæ¸ø¸öÀý×Ó¿´¿´£º
import java.io.*;
/**
* ×Ö·ûÁ÷²âÊÔ
*
* @author leizhimin 2008-8-27 22:16:44
*/
public class TestIOStream {
public static void main(String[] args) {
testReaderWriter();
testLineNumberReader();
}
/**
* ´ø»º³åµÄ×Ö·ûÁ÷
*/
public static void testReaderWriter() {
int bufsize = 25;
try {
BufferedReader bufferedReader = new BufferedReader(new FileReader(new File("C:\\x.txt")));
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(new File("C:\\xb.txt")));
char buf[] = new char[bufsize]; //×Ö·û»º³åÇø
while (bufferedReader.read(buf) != -1) {
bufferedWriter.write(buf);
}
bufferedWriter.flush();
bufferedReader.close();
bufferedWriter.close();
} catch (FileN
Ïà¹ØÎĵµ£º
²»¹ÜÄãÊÇÐÂÊÖ»¹ÊÇÀÏÄñ£¬ÔÚ³ÌÐòÖжÁÈ¡×ÊÔ´Îļþ×Ü»áÓöµ½Ò»Ð©ÕÒ²»µ½ÎļþµÄÎÊÌ⣬ÕâÓëJavaµ×²ãµÄʵÏÖÓйأ¬²»ÄÜËãbug£¬Ö»Òª·½·¨µÃµ±£¬ÎÊÌ⻹ÊÇ¿ÉÒÔ½â¾öµÄ¡£
ÏîÄ¿µÄÎļþ¼Ð½á¹¹£º
repathtest
©À©¤src
©¦ ©¸©¤com
©¦ &nb ......
ÔÚ Java ³ÌÐòÖÐʹÓöàÏß³ÌÒª±ÈÔÚ C »ò C++ ÖÐÈÝÒ׵ö࣬ÕâÊÇÒòΪ Java ±à³ÌÓïÑÔÌṩÁËÓïÑÔ¼¶µÄÖ§³Ö¡£±¾ÎÄͨ¹ý¼òµ¥µÄ±à³ÌʾÀýÀ´ËµÃ÷ Java ³ÌÐòÖеĶàÏß³ÌÊǶàôֱ¹Û¡£¶ÁÍê±¾ÎÄÒÔºó£¬Óû§Ó¦¸ÃÄܹ»±àд¼òµ¥µÄ¶àÏ̳߳ÌÐò¡£
¡¡ Ϊʲô»áÅŶӵȴý?
¡¡¡¡ÏÂÃæµÄÕâ¸ö¼òµ¥µÄ Java ³ÌÐ ......
ÔÚËãÊõÔËËã·û²¿·Ö£¬ÐèÒªÌرð×¢ÒâµÄÒ»¸öÓï·¨ÏÖÏóÊÇ“½úÉý”¡£½úÉýÖ¸µÍÓÚintµÄ3ÖÖÊý×ÖÀàÐÍ(byte¡¢shortºÍchar)½øÐÐËãÊõÔËËãºó£¬½á¹û»á×Ô¶¯ÌáÉý³ÉintÀàÐÍ¡£Ê¾Àý´úÂëÈçÏ£º
byte b1 = 10;
& ......
JavaÖÐͨ¹ýimplements SerializableÀ´ÊµÏÖ¶ÔÏóµÄÐòÁл¯¡£ÆäʵSerializable½Ó¿ÚÖв¢Ã»ÓÐÐèҪʵÏֵķ½·¨£¬×¢Ã÷ij¸öÀàimplements SerializableÖ»ÊÇΪÁ˱êʶ»ò±íÃ÷Õâ¸öÀà¿ÉÒÔ±»ÐòÁл¯¡£
ÄÇôʲôÊÇÐòÁл¯ÄØ£¬ÐòÁл¯ÓÖÓÐʲô×÷ÓÃÄØ£¿
Ò»¸öÀ࣬»ò ......