アットウィキロゴ

合併

package join;
 
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
 
 
public class pro {
 
    int s,datanumber;
    String[] data=new String[500000];
    String[] subdata=new String[500000];
 
    public static void main(String[] args) {
       pro te=new pro();
    }
 
    pro(){
 
        readx("data.csv");
 
        for(s=1;s<datanumber+1;s++){
       subdata[s]=data[s];
    }
 
 
          readx("07.csv");
        int sx=datanumber;
 
        for(s=2;s<datanumber+1;s++){
       sx=sx+1;
            subdata[sx]=data[s];
    }
 
 
        readx("08.csv");
 
 
        for(s=2;s<datanumber+1;s++){
       sx=sx+1;
            subdata[sx]=data[s];
 
    }
 
        datanumber=sx;
 
             System.out.println(datanumber);
 
 
             writexml("ren.txt");
 
    }
 
 
      void writexml(String file){ 
 
    int s,sx;
 
try{ 
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file))); 
 
for(s=1;s<datanumber+1;s++){   
pw.println(subdata[s]); 
 
}
 
 
System.out.println("ファイルに書きこみました。"); 
pw.close(); 
} catch(IOException ep){ System.out.println("入出力エラーです。"); } 
 
 
} 
 
 
     void readx(String file){
 
String str;
BufferedReader br;  
int s;
s=0;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));  
while((str = br.readLine()) != null) {  
s=s+1;
data[s]=str;  
}
br.close();
} catch (IOException e) {System.out.println(e);}  
 
datanumber=s;
 
} 
 
 
 
}
 
最終更新:2016年09月15日 11:10