Package org.daisy.braille.utils.pef
Class PEFGenerator
- java.lang.Object
-
- org.daisy.braille.utils.pef.PEFGenerator
-
public class PEFGenerator extends Object
Provides a way to generate PEF-files for testing purposes. The files can be configured to contain a specified number of volumes, pages, rows and columns. The duplex property can also be set. The file is filed with random content in the specified braille range (6- or 8-dot).
-
-
Field Summary
Fields Modifier and Type Field Description static String
KEY_COLS
Key used in the settings map passed to the constructor.static String
KEY_DUPLEX
Key used in the settings map passed to the constructor.static String
KEY_EIGHT_DOT
Key used in the settings map passed to the constructor.static String
KEY_PPV
Key used in the settings map passed to the constructor.static String
KEY_ROWS
Key used in the settings map passed to the constructor.static String
KEY_SPV
Key used in the settings map passed to the constructor.static String
KEY_VOLUMES
Key used in the settings map passed to the constructor.
-
Constructor Summary
Constructors Constructor Description PEFGenerator()
Creates a new PEFGenerator with the default settings.PEFGenerator(Map<String,String> p)
Creates a new PEF generator with the supplied optional settings.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
generateTestBook(File output)
Generates a new PEF-file and writes it to the supplied path.void
generateTestPages(File output)
Generates a PEF-file with a few test pages to check the embosser setup (the arguments KEY_VOLUMES and KEY_PPV are ignored).static String
getDefaultValue(String key)
Gets the default value for a specified key.static Set<String>
getOptionalArgumentKeys()
Gets a list of all keys which has default values.
-
-
-
Field Detail
-
KEY_VOLUMES
public static final String KEY_VOLUMES
Key used in the settings map passed to the constructor. Its value defines the number of volumes in the generated file.- See Also:
- Constant Field Values
-
KEY_SPV
public static final String KEY_SPV
Key used in the settings map passed to the constructor. Its value defines the number of sections in the generated file.- See Also:
- Constant Field Values
-
KEY_PPV
public static final String KEY_PPV
Key used in the settings map passed to the constructor. Its value defines the number of pages per volume in the generated file.- See Also:
- Constant Field Values
-
KEY_EIGHT_DOT
public static final String KEY_EIGHT_DOT
Key used in the settings map passed to the constructor. Its value defines if eight dot should be used (true/false).- See Also:
- Constant Field Values
-
KEY_ROWS
public static final String KEY_ROWS
Key used in the settings map passed to the constructor. Its value defines the maximum number of rows on a page in the generated file.- See Also:
- Constant Field Values
-
KEY_COLS
public static final String KEY_COLS
Key used in the settings map passed to the constructor. Its value defines the maximum number of columns on a page in the generated file.- See Also:
- Constant Field Values
-
KEY_DUPLEX
public static final String KEY_DUPLEX
Key used in the settings map passed to the constructor. Its value defines the value of the duplex property (true/false). Note that the value of this property does not affect the number of pages generated in each volume.- See Also:
- Constant Field Values
-
-
Method Detail
-
getOptionalArgumentKeys
public static Set<String> getOptionalArgumentKeys()
Gets a list of all keys which has default values.- Returns:
- returns a list of keys
-
getDefaultValue
public static String getDefaultValue(String key)
Gets the default value for a specified key.- Parameters:
key
- The key to get the default value for- Returns:
- returns the value for the key, or null if the key is not found
-
generateTestBook
public void generateTestBook(File output) throws FileNotFoundException
Generates a new PEF-file and writes it to the supplied path.- Parameters:
output
- the output file- Throws:
FileNotFoundException
- If the given file object does not denote an existing, writable regular file and a new regular file of that name cannot be created, or if some other error occurs while opening or creating the file
-
generateTestPages
public void generateTestPages(File output) throws FileNotFoundException
Generates a PEF-file with a few test pages to check the embosser setup (the arguments KEY_VOLUMES and KEY_PPV are ignored).- Parameters:
output
- the output file- Throws:
FileNotFoundException
- If the given file object does not denote an existing, writable regular file and a new regular file of that name cannot be created, or if some other error occurs while opening or creating the file
-
-