1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| import java.io.*;
public class ReadFile {
public static void main(String[] args){
String chaine="";
String fichier ="C:/Documents and Settings/... /fichier_dat/***.dta";
//lecture du fichier
try{
InputStream ips=new FileInputStream(fichier);
InputStreamReader ipsr=new InputStreamReader(ips);
BufferedReader br=new BufferedReader(ipsr);
String ligne;
while ((ligne=br.readLine())!=null){
System.out.println(ligne);
chaine+=ligne+"\n";
}
br.close();
}
catch (Exception e){
System.out.println(e.toString());
} |