Class Prefs

java.lang.Object
de.edgesoft.edgeutils.files.Prefs

public class Prefs
extends java.lang.Object
Preferences.

Legal stuff

Copyright 2010-2020 Ekkart Kleinod ekleinod@edgesoft.de

This file is part of edgeutils.

edgeutils is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

edgeutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with edgeutils. If not, see http://www.gnu.org/licenses/.

Since:
0.12.0
Version:
0.13.0
Author:
Ekkart Kleinod
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static int SIZE_ALERT
    Alert image size.
    static int SIZE_BUTTON
    Button size - normal.
    static int SIZE_BUTTON_SMALL
    Button size - small.
    static int SIZE_FLAG
    Flag size.
  • Constructor Summary

    Constructors 
    Constructor Description
    Prefs()  
  • Method Summary

    Modifier and Type Method Description
    static void exportPrefs​(java.io.OutputStream theStream)
    Exports preferences.
    static java.lang.String get​(java.lang.String theKey)
    Get preference value for text key, default "".
    static java.lang.String get​(java.lang.String theKey, java.lang.String theDefault)
    Get preference value for text key.
    static java.util.prefs.Preferences getPrefs()
    Returns preferences.
    static java.util.Map<java.lang.String,​java.lang.Object> getPrefsMap()
    Returns preferences map.
    static void importPrefs​(java.io.InputStream theStream)
    Imports preferences.
    static void init​(java.lang.Class<? extends java.lang.Object> theProvider)
    Initializes class.
    static void put​(java.lang.String theKey, java.lang.String theValue)
    Set preference value for text key.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • init

      public static void init​(java.lang.Class<? extends java.lang.Object> theProvider)
      Initializes class.
      Parameters:
      theProvider - providing class
    • getPrefs

      public static java.util.prefs.Preferences getPrefs()
      Returns preferences.
      Returns:
      preferences
    • put

      public static void put​(java.lang.String theKey, java.lang.String theValue)
      Set preference value for text key.
      Parameters:
      theKey - text key
      theValue - value
    • get

      public static java.lang.String get​(java.lang.String theKey)
      Get preference value for text key, default "".
      Parameters:
      theKey - text key
      Returns:
      value
    • get

      public static java.lang.String get​(java.lang.String theKey, java.lang.String theDefault)
      Get preference value for text key.
      Parameters:
      theKey - text key
      theDefault - default value
      Returns:
      value
    • exportPrefs

      public static void exportPrefs​(java.io.OutputStream theStream) throws java.io.IOException, java.util.prefs.BackingStoreException
      Exports preferences.
      Parameters:
      theStream - output stream
      Throws:
      java.util.prefs.BackingStoreException
      java.io.IOException
    • importPrefs

      public static void importPrefs​(java.io.InputStream theStream) throws java.io.IOException, java.util.prefs.InvalidPreferencesFormatException, java.util.prefs.BackingStoreException
      Imports preferences.
      Parameters:
      theStream - input stream
      Throws:
      java.io.IOException
      java.util.prefs.InvalidPreferencesFormatException
      java.util.prefs.BackingStoreException
    • getPrefsMap

      public static java.util.Map<java.lang.String,​java.lang.Object> getPrefsMap() throws java.util.prefs.BackingStoreException
      Returns preferences map.
      Returns:
      preferences map
      Throws:
      java.util.prefs.BackingStoreException