示例#1
0
 protected InputStream getInputStream() throws Exception {
   if (data != null) {
     return FileUtils.createInputStream(data);
   }
   if (inputStream != null) {
     data = FileUtils.createByteArray(inputStream, true);
     return FileUtils.createInputStream(data);
   }
   if (inputFile != null) {
     inputStream = new BufferedInputStream(new FileInputStream(inputFile));
     data = FileUtils.createByteArray(inputStream, true);
     return FileUtils.createInputStream(data);
   }
   return inputStream;
 }
示例#2
0
 @Override
 public Book readBook() throws Exception {
   if (book == null) {
     if (data == null) {
       data = FileUtils.createByteArray(getInputStream(), true);
     }
     book = new Book();
     book.setTitle(bookTitle);
     book = this.parseBookFromXml(book, getInputStream());
   }
   return book;
 }
示例#3
0
 public HtmlBookReader(File file) {
   this.bookTitle = FileUtils.getFileNameWithoutExt(file);
   this.inputFile = file;
 }