锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产亚洲人成网站观看,亚洲mv国产精品mv日本mv,亚洲AV综合永久无码精品天堂 http://www.tkk7.com/huhu/category/1634.htmlHuhu'Blogzh-cnTue, 27 Feb 2007 12:25:41 GMTTue, 27 Feb 2007 12:25:41 GMT60Java 涓鏂囦歡鐨勮鍐欐搷浣滀箣姣旇緝http://www.tkk7.com/huhu/archive/2005/06/23/6606.html浼兼按嫻佸勾浼兼按嫻佸勾Thu, 23 Jun 2005 09:46:00 GMThttp://www.tkk7.com/huhu/archive/2005/06/23/6606.htmlhttp://www.tkk7.com/huhu/comments/6606.htmlhttp://www.tkk7.com/huhu/archive/2005/06/23/6606.html#Feedback0http://www.tkk7.com/huhu/comments/commentRss/6606.htmlhttp://www.tkk7.com/huhu/services/trackbacks/6606.htmlJava 涓鏂囦歡鐨勮鍐欐搷浣滀箣姣旇緝
涓錛庡湪 JDK 1.0 涓紝閫氬父鏄敤 InputStream & OutputStream 榪欎袱涓熀綾繪潵榪涜璇誨啓鎿嶄綔鐨勩?BR>InputStream 涓殑 FileInputStream 綾諱技涓涓枃浠跺彞鏌勶紝閫氳繃瀹冩潵瀵規枃浠惰繘琛屾搷浣滐紝綾諱技鐨勶紝鍦?
OutputStream 涓垜浠湁 FileOutputStream 榪欎釜瀵硅薄銆?BR>
鐢‵ileInputStream 鏉ヨ鍙栨暟鎹殑甯哥敤鏂規硶鏄細
FileInputStream fstream = new FileInputStream(args[0]);
DataInputStream in = new DataInputStream(fstream);
鐢?in.readLine() 鏉ュ緱鍒版暟鎹紝鐒跺悗鐢?in.close() 鍏抽棴杈撳叆嫻併?BR>瀹屾暣浠g爜瑙?Example 1銆?BR>
鐢‵ileOutputStream 鏉ュ啓鍏ユ暟鎹殑甯哥敤鏂規硶鏄細
FileOutputStream out out = new FileOutputStream("myfile.txt");    
PrintStream p = new PrintStream( out );
鐢?p.println() 鏉ュ啓鍏ユ暟鎹紝鐒跺悗鐢?p.close() 鍏抽棴杈撳叆銆?BR>瀹屾暣浠g爜瑙?Example 2銆?BR>

浜岋紟鍦?JDK 1.1涓紝鏀寔涓や釜鏂扮殑瀵硅薄 Reader & Writer, 瀹冧滑鍙兘鐢ㄦ潵瀵規枃鏈枃浠惰繘琛屾搷浣滐紝鑰?
JDK1.1涓殑 InputStream & OutputStream 鍙互瀵規枃鏈枃浠舵垨浜岃繘鍒舵枃浠惰繘琛屾搷浣溿?BR>
鐢‵ileReader 鏉ヨ鍙栨枃浠剁殑甯哥敤鏂規硶鏄細
FileReader fr = new FileReader("mydata.txt");
BufferedReader br = new BufferedReader(fr);
鐢?br.readLing() 鏉ヨ鍑烘暟鎹紝鐒跺悗鐢╞r.close() 鍏抽棴緙撳瓨錛岀敤fr.close() 鍏抽棴鏂囦歡銆?BR>瀹屾暣浠g爜瑙?Example 3銆?

鐢?FileWriter 鏉ュ啓鍏ユ枃浠剁殑甯哥敤鏂規硶鏄細
FileWriter fw = new FileWriter("mydata.txt");
PrintWriter out = new PrintWriter(fw);  
鍦ㄧ敤out.print 鎴?out.println 鏉ュ線鏂囦歡涓啓鍏ユ暟鎹紝out.print 鍜?out.println鐨勫敮涓鍖哄埆鏄悗鑰呭啓
鍏ユ暟鎹垨浼氳嚜鍔ㄥ紑涓鏂拌銆傚啓瀹屽悗瑕佽寰?鐢╫ut.close() 鍏抽棴杈撳嚭錛岀敤fw.close() 鍏抽棴鏂囦歡銆?nbsp;  
瀹屾暣浠g爜瑙?Example 4銆?BR>
-------------------------------------------------------------- following is the source code of examples------------------------------------------------------

Example 1:
// FileInputDemo
// Demonstrates FileInputStream and DataInputStream
import java.io.*;

class FileInputDemo {
  
public static void main(String args[]) {
    
// args.length is equivalent to argc in C
    if (args.length == 1{
      
try {
        
// Open the file that is the first command line parameter
        FileInputStream fstream = new FileInputStream(args[0]);
        
// Convert our input stream to a DataInputStream
        DataInputStream in = new DataInputStream(fstream);
        
// Continue to read lines while there are still some left to read
        while (in.available() !=0{
          
// Print file line to screen
          System.out.println (in.readLine());
        }

        
in.close();
      }
 catch (Exception e) {
        System.err.println(
"File input error");
      }

    }

    
else
      System.
out.println("Invalid parameters");
  }

}


Example 2:
// FileOutputDemo
// Demonstration of FileOutputStream and PrintStream classes
import java.io.*;

class FileOutputDemo 
{    
  
public static void main(String args[])  {              
  FileOutputStream 
out// declare a file output object
    PrintStream p; // declare a print stream object

try {
  
// connected to "myfile.txt"
      out = new FileOutputStream("myfile.txt");
      
// Connect print stream to the output stream
      p = new PrintStream( out );
      p.println (
"This is written to a file");
      p.close();
    }
 catch (Exception e) {
      System.err.println (
"Error writing to file");
    }

  }

}


Example 3:
// FileReadTest.java
// User FileReader in JDK1.1 to read a file 
import java.io.*;

class FileReadTest {      
  
public static void main (String[] args) {
    FileReadTest t 
= new FileReadTest();
    t.readMyFile();
}
 
    
  
void readMyFile() 
    String record 
= null;
    
int recCount = 0
    
try 
FileReader fr 
= new FileReader("mydata.txt");
       BufferedReader br 
= new BufferedReader(fr);
       record 
= new String();
       
while ((record = br.readLine()) != null{
         recCount
++;
         System.
out.println(recCount + "" + record); 
}

br.close();
fr.close(); 
     }
 catch (IOException e) 
         System.
out.println("Uh oh, got an IOException error!");
         e.printStackTrace();
     }

}
 
  
}
    

Example 4:
// FileWriteTest.java
// User FileWriter in JDK1.1 to writer a file 
import java.io.*;

class FileWriteTest {      
  
public static void main (String[] args) {
    FileWriteTest t 
= new FileWriteTest();
    t.WriteMyFile();
}
 
    
  
void WriteMyFile() 
    
try 
FileWriter fw 
= new FileWriter("mydata.txt");
PrintWriter 
out = new PrintWriter(fw);    
out.print(鈥渉i,this will be wirte into the file!鈥?;   
out.close();
fw.close();
     }
 catch (IOException e) 
         System.
out.println("Uh oh, got an IOException error!");
         e.printStackTrace();
     }

}
 
  
}
    


浼兼按嫻佸勾 2005-06-23 17:46 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 亚洲综合色婷婷在线观看| 亚洲AV无码久久精品成人| 亚洲一级在线观看| 84pao强力永久免费高清| 亚洲av无码不卡| 污污网站免费观看| 亚洲精彩视频在线观看| 91精品国产免费网站| 久久久久亚洲AV无码专区首JN| 91大神免费观看| 亚洲一级毛片免观看| 免费高清小黄站在线观看| 婷婷亚洲综合五月天小说在线| www.亚洲色图| 日韩精品无码免费专区午夜不卡| 久久精品亚洲综合专区| 18禁美女黄网站色大片免费观看| 亚洲中文字幕在线无码一区二区| 67194成是人免费无码| 看Aⅴ免费毛片手机播放| 久久亚洲国产成人精品无码区| 男的把j放进女人下面视频免费| 亚洲综合一区二区国产精品| **aaaaa毛片免费| 亚洲av成人一区二区三区在线播放 | 日韩亚洲AV无码一区二区不卡| 亚洲视频在线免费看| 亚洲av无码专区在线观看下载 | 国产亚洲成人在线播放va| 波多野结衣免费一区视频| 亚洲视频在线观看地址| 国产一区二区三区免费在线观看| 国产免费一区二区三区免费视频| 亚洲av日韩av不卡在线观看| 久久精品免费全国观看国产| 免费看一级一级人妻片| 国产精品亚洲片在线花蝴蝶 | 国产精品视频白浆免费视频| 亚洲jjzzjjzz在线观看| 亚洲高清无码专区视频| 91青青青国产在观免费影视|