Class MacOSPreferencesUtil

java.lang.Object
org.jhotdraw8.os.macos.MacOSPreferencesUtil

public class MacOSPreferencesUtil extends Object
Provides read methods for some well known macOS preferences files.
  • Field Details

    • GLOBAL_PREFERENCES

      public static final File GLOBAL_PREFERENCES
      Path to global preferences.
    • FINDER_PREFERENCES

      public static final File FINDER_PREFERENCES
      Path to finder preferences.
  • Constructor Details

    • MacOSPreferencesUtil

      public MacOSPreferencesUtil()
      Creates a new instance.
  • Method Details

    • getString

      public static @Nullable String getString(File file, String key)
    • getString

      public static String getString(File file, String key, String defaultValue)
    • isStringEqualTo

      public static boolean isStringEqualTo(File file, String key, String defaultValue, String compareWithThisValue)
    • get

      public static @Nullable Object get(File file, String key)
      Gets a preferences value
      Parameters:
      file - the preferences file
      key - the key may contain tabulator separated entries to directly access a value in a sub-dictionary
      Returns:
      the value associated with the key
    • flatten

      public static Map<String,Object> flatten(Map<String,Object> map)
    • get

      public static @Nullable Object get(Map<String,Object> map, String key)
    • getKeySet

      public static Set<String> getKeySet(File file)
      Returns all known keys for the specified preferences file.
      Returns:
    • clearAllCaches

      public static void clearAllCaches()
      Clears all caches.
    • clearCache

      public static void clearCache(File f)
      Clears the cache for the specified preference file.
    • get

      public static Object get(File file, String key, Object defaultValue)
      Get a value from a Mac OS X preferences file.
      Parameters:
      file - The preferences file.
      key - Hierarchical keys are separated by \t characters.
      defaultValue - This value is returned when the key does not exist.
      Returns:
      Returns the preferences value.
    • isMacOs

      public static boolean isMacOs()
    • readPreferences

      public static void readPreferences(File file, Map<String,Object> cache)