锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产亚洲人成网站观看,亚洲mv国产精品mv日本mv,亚洲AV综合永久无码精品天堂 http://m.tkk7.com/huhu/category/1634.htmlHuhu'Blogzh-cnTue, 27 Feb 2007 12:25:41 GMTTue, 27 Feb 2007 12:25:41 GMT60Java 涓鏂囦歡鐨勮鍐欐搷浣滀箣姣旇緝http://m.tkk7.com/huhu/archive/2005/06/23/6606.html浼兼按嫻佸勾浼兼按嫻佸勾Thu, 23 Jun 2005 09:46:00 GMThttp://m.tkk7.com/huhu/archive/2005/06/23/6606.htmlhttp://m.tkk7.com/huhu/comments/6606.htmlhttp://m.tkk7.com/huhu/archive/2005/06/23/6606.html#Feedback0http://m.tkk7.com/huhu/comments/commentRss/6606.htmlhttp://m.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无码片一区二区三区| 亚洲资源在线视频| 最新亚洲人成无码网站| 韩国日本好看电影免费看| 亚洲首页国产精品丝袜| 三上悠亚亚洲一区高清| 国产裸体美女永久免费无遮挡| 亚洲色欲久久久久综合网| 久久毛片免费看一区二区三区| 亚洲一级特黄大片无码毛片| 中国一级毛片视频免费看| 在线jyzzjyzz免费视频| 久久久久久亚洲精品中文字幕 | 成人影片麻豆国产影片免费观看| 亚洲深深色噜噜狠狠爱网站| 美国毛片亚洲社区在线观看| 波多野结衣免费视频观看| 亚洲字幕AV一区二区三区四区| 国产成人精品免费久久久久| 亚洲经典在线中文字幕| 免费一级毛片无毒不卡| 亚洲国产精品一区二区九九| 91精品成人免费国产| 亚洲人成人无码网www国产| 理论亚洲区美一区二区三区| 久久久久亚洲AV成人网| 日本免费一区二区三区| 亚洲va久久久噜噜噜久久男同| 中文字幕在线免费| 久久精品国产精品亚洲毛片| 日本一区二区免费看| 亚洲av乱码一区二区三区香蕉| 免费观看无遮挡www的视频| 亚洲av日韩专区在线观看| 国产亚洲精品AA片在线观看不加载| 在线免费观看亚洲| 苍井空亚洲精品AA片在线播放 | 亚洲黄网在线观看| 国产成人精品免费视频大全五级 | 羞羞漫画登录页面免费| 亚洲阿v天堂在线|