アットウィキロゴ

ふちな

package epub2;
 
import tool.*;
 
public class pro {
 
    String title,author,name;
    String[] story=new String[5000];
    int storynumber;
    String[] data=new String[5000];
    int s,datanumber;
     int[] point=new int[5000];
    int pointnumber;
 
  public static void main(String[] args) {
pro test=new pro();   
  }
 
  pro(){
 
 
      readfile sub3=new readfile();
      sub3.makedata("music.txt","UTF-8");
      data=sub3.data;
      datanumber=sub3.datanumber;
 
story sub4=new story();
sub4.data=data;
sub4.datanumber=datanumber;
sub4.makedata();
story=sub4.story;
storynumber=sub4.storynumber;
 
 
 
      title="abv66";
      author="Rice Coast";
      name="夏の日の想い出・星の伝説";
 
 
 
      epub sub=new epub();
      sub.title=title;
      sub.author=author;
      sub.name=name;
      sub.story=story;
      sub.storynumber=storynumber;
 
      sub.makedata(title+".kepub.epub");
 
 
  }
 
}
 
 
 
 
package epub2;
 
 
public class story {
 
     String title,author,name;
    String[] story=new String[5000];
    int storynumber;
    String[] data=new String[5000];
    int s,datanumber;
     int[] point=new int[5000];
    int pointnumber;
 
 
 
    void makedata(){
 
     int sx;
 
      sx=0;
      for(s=1;s<datanumber+1;s++){
      if(data[s].length()<2)sx=sx+1;
       if(data[s].length()<2)point[sx]=s;
      }
 
      pointnumber=sx;
 
 
       story[1]="";
      for(sx=1;sx<point[1];sx++){ 
          story[1]=story[1]+data[sx];
           }
 
 
      for(s=2;s<pointnumber;s++){
          story[s]=""; 
          for(sx=point[s-1]+1;sx<point[s];sx++){ 
          story[s]=story[s]+data[sx];
           }
          }
 
      s=pointnumber;
 
      story[s]="";
      for(sx=point[s]+1;sx<datanumber;sx++){ 
          story[s]=story[s]+data[sx];
           }
 
     storynumber=pointnumber;
 
 
    }
 
}
 
 
 
package epub2;
 
import com.adobe.dp.epub.io.OCFContainerWriter;
import com.adobe.dp.epub.ncx.TOCEntry;
import com.adobe.dp.epub.opf.NCXResource;
import com.adobe.dp.epub.opf.OPSResource;
import com.adobe.dp.epub.opf.Publication;
import com.adobe.dp.epub.ops.Element;
import com.adobe.dp.epub.ops.OPSDocument;
import java.io.FileOutputStream;
 
class epub{
 
     String title,author;
     String name;
     String[] story=new String[5000];
    int storynumber;
 
 
 
 
void makedata(String file){
 
 
      Publication epub = new Publication();
 
      epub.addDCMetadata("title", title);
      epub.addDCMetadata("creator", author);
      epub.addDCMetadata("language", "ja");
 NCXResource toc = epub.getTOC();
  TOCEntry rootTOCEntry = toc.getRootTOCEntry();
 
      OPSResource main = epub.createOPSResource("OPS/main.html");
      epub.addToSpine(main);
      OPSDocument mainDoc = main.getDocument();
 
      TOCEntry mainTOCEntry = toc.createTOCEntry("Intro", mainDoc
          .getRootXRef());
      rootTOCEntry.add(mainTOCEntry);
 
      Element body = mainDoc.getBody();
 
      Element h1 = mainDoc.createElement("h1");
      h1.add(name);
      body.add(h1);
 
      int s;
 
      Element[] para=new Element[500];
 
      for(s=1;s<storynumber+1;s++){
      para[s] = mainDoc.createElement("p");
      para[s].add(story[s]);
      }
 
       for(s=1;s<storynumber+1;s++){
      body.add(para[s]);
       }
 
      try {
      OCFContainerWriter writer = new OCFContainerWriter(
          new FileOutputStream(file));
      epub.serialize(writer);
 
    } catch (Exception e) {e.printStackTrace();}
 
 
  }
}
 
最終更新:2016年10月11日 15:32