package api2;
import tool.*;
import java.io.*;
public class pro {
int s,datanumber;
String[] data=new String[50000];
String[] code=new String[5000];
String[] name=new String[5000];
String[] tab=new String[5000];
int number;
public static void main(String[] args) {
pro t=new pro();
}
pro(){
readfile sub2=new readfile();
sub2.makedata("data.csv","UTF-8");
data=sub2.data;
datanumber=sub2.datanumber;
for(s=2;s<datanumber+1;s++){
String[] x=data[s].split(",");
code[s-1]=x[2];
}
int number=datanumber-1;
int tr;
for(tr=1;tr<number+1;tr++){
String codex=code[tr];
String urlx="http://api.e-stat.go.jp/rest/2.1/app/getStatsData?appId=aeec3b02995623cad42b80c80f73d176b7c77970";
urlx=urlx+"&statsDataId="+codex;
getdata sub=new getdata();
sub.makedata(urlx,"UTF-8");
data=sub.data;
datanumber=sub.datanumber;
writefile sub3=new writefile();
sub3.datanumber=datanumber;
sub3.data=data;
sub3.makedata("data/"+tr+".txt");
}
}
void writexml(String file){
int s,sx;
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
pw.println("n,t,c");
for(s=1;s<number+1;s++){
pw.print(name[s]);
pw.print(",");
pw.print(tab[s]);
pw.print(",");
pw.println(id[s]);
}
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
}
最終更新:2017年03月04日 01:09