Package org.daisy.braille.utils.pef
Class PEFFileSplitter
- java.lang.Object
-
- org.daisy.braille.utils.pef.PEFFileSplitter
-
- All Implemented Interfaces:
ErrorHandler
public class PEFFileSplitter extends Object implements 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.
-
-
Constructor Summary
Constructors Constructor Description PEFFileSplitter(Predicate<URL> validator)Creates a new PEFFileSplitter object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiderror(SAXParseException exception)voidfatalError(SAXParseException exception)booleansplit(File input, File directory)Splits a PEF-file into several single volume PEF-files.booleansplit(InputStream is, 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.booleansplit(InputStream is, File directory, String prefix, 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.voidwarning(SAXParseException exception)
-
-
-
Field Detail
-
PREFIX
public static final String PREFIX
Defines the default prefix for generated file names.- See Also:
- Constant Field Values
-
POSTFIX
public static final String POSTFIX
Defines the default postfix for generated file names.- See Also:
- Constant Field Values
-
-
Method Detail
-
split
public boolean split(File input, File directory)
Splits a PEF-file into several single volume PEF-files.- Parameters:
input- input PEF-filedirectory- output directory- Returns:
- returns true if split was successful, false otherwise
- Throws:
IllegalArgumentException- if input is not a file
-
split
public boolean split(InputStream is, 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-documentdirectory- the output directory- Returns:
- returns true if split was successful, false otherwise
-
split
public boolean split(InputStream is, File directory, String prefix, 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-documentdirectory- the output directoryprefix- the prefix to usepostfix- the postfix to use- Returns:
- returns true if split was successful, false otherwise
-
error
public void error(SAXParseException exception) throws SAXException
- Specified by:
errorin interfaceErrorHandler- Throws:
SAXException
-
fatalError
public void fatalError(SAXParseException exception) throws SAXException
- Specified by:
fatalErrorin interfaceErrorHandler- Throws:
SAXException
-
warning
public void warning(SAXParseException exception) throws SAXException
- Specified by:
warningin interfaceErrorHandler- Throws:
SAXException
-
-