锘??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 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 猫咪www免费人成网站| free哆拍拍免费永久视频 | 亚洲成A人片在线观看WWW| 亚洲黄色三级视频| 日本一区二区免费看| 日本一区二区三区日本免费| 亚洲а∨天堂久久精品9966| 久久国产精品国产自线拍免费| 中文字幕亚洲图片| 亚洲av色香蕉一区二区三区| 91精品国产免费久久国语麻豆| 久久亚洲精品成人综合| 免费国产va在线观看| 成人黄动漫画免费网站视频 | 亚洲综合色在线观看亚洲| 一级毛片a免费播放王色| 成年网站免费视频A在线双飞| 日韩一区二区免费视频| 色婷婷亚洲一区二区三区| 皇色在线视频免费网站| 亚洲一本一道一区二区三区| 日韩免费毛片视频| 男女作爱免费网站| 久久精品国产亚洲| 免费无码A片一区二三区| 久久亚洲国产成人精品性色| 国产免费女女脚奴视频网| 久久精品亚洲一区二区三区浴池| 中国xxxxx高清免费看视频| 狠狠色香婷婷久久亚洲精品| 免费A级毛片无码A∨男男 | 国产成人高清亚洲一区91| 亚洲综合色成在线播放| 亚洲免费福利视频| 国产亚洲男人的天堂在线观看| 国产AV无码专区亚洲AV漫画| 亚洲免费在线观看视频| 在线播放免费人成视频网站 | 亚洲成网777777国产精品| 精品在线视频免费| 国产AV无码专区亚洲AV毛网站 |