Class PEFFileSplitter

  • All Implemented Interfaces:
    org.xml.sax.ErrorHandler

    public class PEFFileSplitter
    extends java.lang.Object
    implements org.xml.sax.ErrorHandler
    Splits a PEF-file into several single volume files. The main purpose is to interact with software that operates on one volume at a time.
    Author:
    Joel HÃ¥kansson
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String POSTFIX
      Defines the default postfix for generated file names.
      static java.lang.String PREFIX
      Defines the default prefix for generated file names.
    • Constructor Summary

      Constructors 
      Constructor Description
      PEFFileSplitter()
      Creates a new PEFFileSplitter object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void error​(org.xml.sax.SAXParseException exception)  
      void fatalError​(org.xml.sax.SAXParseException exception)  
      boolean split​(java.io.File input, java.io.File directory)
      Splits a PEF-file into several single volume PEF-files.
      boolean split​(java.io.InputStream is, java.io.File directory)
      Splits the PEF-document provided as an input stream into several single volume PEF-files using the default file name pre- and postfix.
      boolean split​(java.io.InputStream is, java.io.File directory, java.lang.String prefix, java.lang.String postfix)
      Splits the PEF-document provided as an input stream into several single volume PEF-files using the supplied file name pre- and postfix.
      void warning​(org.xml.sax.SAXParseException exception)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PREFIX

        public static final java.lang.String PREFIX
        Defines the default prefix for generated file names.
        See Also:
        Constant Field Values
      • POSTFIX

        public static final java.lang.String POSTFIX
        Defines the default postfix for generated file names.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PEFFileSplitter

        public PEFFileSplitter()
        Creates a new PEFFileSplitter object.
    • Method Detail

      • split

        public boolean split​(java.io.File input,
                             java.io.File directory)
        Splits a PEF-file into several single volume PEF-files.
        Parameters:
        input - input PEF-file
        directory - output directory
        Returns:
        returns true if split was successful, false otherwise
        Throws:
        java.lang.IllegalArgumentException - if input is not a file
      • split

        public boolean split​(java.io.InputStream is,
                             java.io.File directory)
        Splits the PEF-document provided as an input stream into several single volume PEF-files using the default file name pre- and postfix.
        Parameters:
        is - the input stream to the PEF-document
        directory - the output directory
        Returns:
        returns true if split was successful, false otherwise
      • split

        public boolean split​(java.io.InputStream is,
                             java.io.File directory,
                             java.lang.String prefix,
                             java.lang.String postfix)
        Splits the PEF-document provided as an input stream into several single volume PEF-files using the supplied file name pre- and postfix.
        Parameters:
        is - the input stream to the PEF-document
        directory - the output directory
        prefix - the prefix to use
        postfix - the postfix to use
        Returns:
        returns true if split was successful, false otherwise
      • error

        public void error​(org.xml.sax.SAXParseException exception)
                   throws org.xml.sax.SAXException
        Specified by:
        error in interface org.xml.sax.ErrorHandler
        Throws:
        org.xml.sax.SAXException
      • fatalError

        public void fatalError​(org.xml.sax.SAXParseException exception)
                        throws org.xml.sax.SAXException
        Specified by:
        fatalError in interface org.xml.sax.ErrorHandler
        Throws:
        org.xml.sax.SAXException
      • warning

        public void warning​(org.xml.sax.SAXParseException exception)
                     throws org.xml.sax.SAXException
        Specified by:
        warning in interface org.xml.sax.ErrorHandler
        Throws:
        org.xml.sax.SAXException