package slide;
import java.io.*;
public class pro {
int s,datanumber;
String[] data=new String[60000];
int tr;
public static void main(String[] args) {
pro te=new pro();
}
pro(){
for(tr=1;tr<82;tr++){
readx("data/"+tr+".txt");
writehtml("gdata/"+tr+".html");
}
}
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;
}
void writehtml(String file){
int s,sx;
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
pw.println("<html>");
pw.println("<head>");
pw.println("<meta charset=\"UTF-8\">");
pw.println("</head>");
pw.println("<body>");
for(s=1;s<datanumber+1;s++){
pw.print("<h1>");
pw.print(data[s]);
pw.println("</h1>");
}
pw.println("<a href=\""+(tr-1)+".html\">前</a>");
pw.println("<a href=\""+(tr+1)+".html\">次</a>");
pw.println("</body>");
pw.println("</html>");
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
}
最終更新:2016年05月29日 15:13