Package org.daisy.braille.pef
Class PEFGenerator
- java.lang.Object
-
- org.daisy.braille.pef.PEFGenerator
-
public class PEFGenerator extends java.lang.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).- Author:
- Joel HÃ¥kansson
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
KEY_COLS
Key used in the settings map passed to the constructor.static java.lang.String
KEY_DUPLEX
Key used in the settings map passed to the constructor.static java.lang.String
KEY_EIGHT_DOT
Key used in the settings map passed to the constructor.static java.lang.String
KEY_PPV
Key used in the settings map passed to the constructor.static java.lang.String
KEY_ROWS
Key used in the settings map passed to the constructor.static java.lang.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(java.util.Map<java.lang.String,java.lang.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(java.io.File output)
Generates a new PEF-file and writes it to the supplied pathvoid
generateTestPages(java.io.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 java.lang.String
getDefaultValue(java.lang.String key)
Gets the default value for a specified key.static java.util.Set<java.lang.String>
getOptionalArgumentKeys()
Gets a list of all keys which has default values
-
-
-
Field Detail
-
KEY_VOLUMES
public static java.lang.String KEY_VOLUMES
Key used in the settings map passed to the constructor. Its value defines the number of volumes in the generated file
-
KEY_PPV
public static java.lang.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
-
KEY_EIGHT_DOT
public static java.lang.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)
-
KEY_ROWS
public static java.lang.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
-
KEY_COLS
public static java.lang.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
-
KEY_DUPLEX
public static java.lang.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.
-
-
Constructor Detail
-
PEFGenerator
public PEFGenerator()
Creates a new PEFGenerator with the default settings.
-
PEFGenerator
public PEFGenerator(java.util.Map<java.lang.String,java.lang.String> p)
Creates a new PEF generator with the supplied optional settings. See the enums of this class for a list of possible keys and their values.- Parameters:
p
- a map containing optional settings
-
-
Method Detail
-
getOptionalArgumentKeys
public static java.util.Set<java.lang.String> getOptionalArgumentKeys()
Gets a list of all keys which has default values- Returns:
- returns a list of keys
-
getDefaultValue
public static java.lang.String getDefaultValue(java.lang.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(java.io.File output) throws java.io.FileNotFoundException
Generates a new PEF-file and writes it to the supplied path- Parameters:
output
- the output file- Throws:
java.io.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(java.io.File output) throws java.io.FileNotFoundException, java.lang.Exception
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:
java.io.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 filejava.lang.Exception
-
-