Package com.adobe.epubcheck.util

Examples of com.adobe.epubcheck.util.Archive


    if(!parent.exists() || !parent.isDirectory())
      throw new InvalidParameterException(parent.getAbsolutePath());
       
    boolean hadError = false;
    for(File epubDir : parent.listFiles(dirFilter)) {
      Archive epub = new Archive(epubDir.getAbsolutePath(), false);
      epub.createArchive();
      Report report = new DefaultReportImpl(epub.getEpubName());
      EpubCheck check = new EpubCheck(epub.getEpubFile(), report);
      if (check.validate()) {
        System.out.println(Messages.NO_ERRORS__OR_WARNINGS);
        String name = epub.getEpubName();
        name = name.replace(".epub", "-"+now+".epub");
        epub.getEpubFile().renameTo(new File(buildDir,name));
      } else {
        hadError = true;
        System.err.println(Messages.THERE_WERE_ERRORS);
      }
    }
View Full Code Here


    try
    {
      if (expanded)
      {
        Archive epub;

        try
        {
          epub = new Archive(path, true);
        }
        catch (RuntimeException ex)
        {
          System.err.println(Messages.get("there_were_errors"));
          return 1;
        }

        epub.createArchive();
        report.setEpubFileName(epub.getEpubFile().getAbsolutePath());
        EpubCheck check = new EpubCheck(epub.getEpubFile(), report);
        int validationResult = check.doValidate();
        if (validationResult == 0)
        {
          outWriter.println(Messages.get("no_errors__or_warnings"));
          result = 0;
        }
        else if (validationResult == 1)
        {
          System.err.println(Messages.get("there_were_warnings"));
          result = failOnWarnings ? 1 : 0;
        }
        else if (validationResult >= 2)
        {
          System.err.println(Messages.get("there_were_errors"));
          result = 1;
        }

        if (keep)
        {
          if ((report.getErrorCount() > 0) || (report.getFatalErrorCount() > 0))
          {
            //keep if valid or only warnings
            System.err.println(Messages.get("deleting_archive"));
            epub.deleteEpubFile();
          }
        }
        else
        {
          epub.deleteEpubFile();
        }
      }
      else
      {
        if (mode != null)
View Full Code Here

    }
  }
  */
  private void validate() throws Exception
  {
    Archive epub = new Archive(TEMP_DIR.getPath());
    epub.createArchive();
    ValidationReport report = new ValidationReport(TEMP_DIR.getName());
    EpubCheck epubCheck = new EpubCheck(epub.getEpubFile(), report);
    epubCheck.validate();
    assertTrue(report.getErrorCount() < 1);
    assertTrue(report.getWarningCount() < 1);
    epub.deleteEpubFile();
    // outWriter.println(report);
  }
View Full Code Here

TOP

Related Classes of com.adobe.epubcheck.util.Archive

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.