Class FirefoxPreferencesParser

  • All Implemented Interfaces:
    PreferencesParser

    public final class FirefoxPreferencesParser
    extends java.lang.Object
    implements PreferencesParser

    A parser for Firefox's preferences file. It can 'parse' Firefox's preferences file and expose the preferences in a simple to use format.

    Sample usage:
    
     FirefoxPreferencesParser p = new FirefoxPreferencesParser(prefsFile);
     p.parse();
     Map<String,String> prefs = p.getPreferences();
     System.out.println("blink allowed: " + prefs.get("browser.blink_allowed"));
     
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static Logger LOG  
      (package private) java.util.Map<java.lang.String,​java.lang.String> prefs  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​java.lang.String> getPreferences()
      Get the firefox preferences as a map (key,value pair).
      void parse()
      Parse the preferences file
      • Methods inherited from class java.lang.Object

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

      • LOG

        private static final Logger LOG
      • prefs

        java.util.Map<java.lang.String,​java.lang.String> prefs
    • Constructor Detail

      • FirefoxPreferencesParser

        public FirefoxPreferencesParser()
    • Method Detail

      • parse

        public void parse()
                   throws java.io.IOException
        Parse the preferences file
        Specified by:
        parse in interface PreferencesParser
        Throws:
        java.io.IOException - if an exception occurs while reading the preferences file.
      • getPreferences

        public java.util.Map<java.lang.String,​java.lang.String> getPreferences()
        Get the firefox preferences as a map (key,value pair). Note that all values (including integers and booleans) are stored as a string, so conversion to an appropriate type may be required.
        Specified by:
        getPreferences in interface PreferencesParser
        Returns:
        a map containing firefox' preferences