Class PEFGenerator

java.lang.Object
org.daisy.braille.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).
Author:
Joel HÃ¥kansson
  • Field Details

    • KEY_VOLUMES

      public static 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 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 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 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 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 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 Details

    • PEFGenerator

      public PEFGenerator()
      Creates a new PEFGenerator with the default settings.
    • PEFGenerator

      public PEFGenerator(Map<String,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 Details

    • 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, 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:
      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
      Exception