You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EpubReader epubReader = new EpubReader();
String filePath="src/example/test.epub";
File file=new File(filePath);
InputStream input = null ;
input = new FileInputStream(file);
Book book=epubReader.readEpub(input,"UTF-8");
Spine spine = book.getSpine();
List<SpineReference> spineReferences = spine.getSpineReferences();
int i = 0;
if (spineReferences != null && spineReferences.size() > 0) {
System.out.println("Converting...");
for (i = 0; i < spineReferences.size(); i++) {
dealResource(i,spineReferences.get(i).getResource());//change some text in every Resource
}
System.out.println("Convert End,Total chapters:"+i);
}else{
System.out.println("EpubBook is null");
System.exit(0);
}
EpubWriter epubWriter = new EpubWriter();
epubWriter.write(book, new FileOutputStream("src/example/test-t2s.epub"));
but when I run it,it throw a exception:
Convert End,Total chapters:751
Exception in thread "main" java.lang.NullPointerException
at nl.siegmann.epublib.epub.PackageDocumentWriter.write(PackageDocumentWriter.java:36)
at nl.siegmann.epublib.epub.EpubWriter.writePackageDocument(EpubWriter.java:112)
at nl.siegmann.epublib.epub.EpubWriter.write(EpubWriter.java:53)
at com.blue.core.convertMain.readbook(convertMain.java:75)
at com.blue.core.convertMain.main(convertMain.java:49)
I don't know what happend.The test-t2s.epub is created,but it's broken.I use winRAR to open the epub files,and I find the content.opt only 0KB.WinRAR also warning me the content.opt is broken.
I want to know how to deal this problem.
My project depends this jar:
xmlpull-1.1.3.4d_b4_min.jar,epublib-core-3.1.3.jar,slf4j-api-1.7.2.jar,kxml2-2.3.0 and so on.I find these in Maven.com
The text was updated successfully, but these errors were encountered:
this is my code:
but when I run it,it throw a exception:
I don't know what happend.The test-t2s.epub is created,but it's broken.I use winRAR to open the epub files,and I find the content.opt only 0KB.WinRAR also warning me the content.opt is broken.
I want to know how to deal this problem.
My project depends this jar:
xmlpull-1.1.3.4d_b4_min.jar,epublib-core-3.1.3.jar,slf4j-api-1.7.2.jar,kxml2-2.3.0 and so on.I find these in Maven.com
The text was updated successfully, but these errors were encountered: