|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Object java.lang.Enum<Persistence> chooser.Persistence
public enum Persistence
Convenience methods providing a quick means of loading and saving keybindings. None preserve
disabled mappings. The formats provided are as follows:
SERIAL_HASH- Serialized hash map of bindings. Ordering is preserved if available.
SERIAL_INPUT- Serialized input map of bindings.
PROPERTIES_PAIR- Persistence provided by java.util.Properties using plain text key/value pairs.
PROPERTIES_XML- Persistence provided by java.util.Properties using its XML format.
Enum Constant Summary | |
---|---|
PROPERTIES_PAIRS
|
|
PROPERTIES_XML
|
|
SERIAL_HASH
|
|
SERIAL_INPUT
|
Method Summary | |
---|---|
static Persistence |
fromString(String str)
Returns the enum representation of a string. |
String |
getOutput(Map<KeyStroke,String> bindings)
Provides the textual output of what this persistence format would save given a set of bindings. |
LinkedHashMap<KeyStroke,String> |
load(InputStream input)
Attempts to load this type of persistent keystroke map from a given stream. |
LinkedHashMap<KeyStroke,String> |
load(String path)
Attempts to load this type of persistent keystroke map from a given path. |
void |
save(OutputStream output,
Map<KeyStroke,String> bindings)
Writes the persistent state of the bindings to an output stream. |
void |
save(String path,
Map<KeyStroke,String> bindings)
Writes the persistent state of the bindings to a file. |
String |
toString()
|
static Persistence |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static Persistence[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final Persistence SERIAL_HASH
public static final Persistence SERIAL_INPUT
public static final Persistence PROPERTIES_PAIRS
public static final Persistence PROPERTIES_XML
Method Detail |
---|
public static Persistence[] values()
for (Persistence c : Persistence.values()) System.out.println(c);
public static Persistence valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is nullpublic static Persistence fromString(String str)
str
- toString representation of this enum
IllegalArgumentException
- if argument is not represented by this enum.public LinkedHashMap<KeyStroke,String> load(String path) throws IOException, ParseException
path
- absolute path to resource to be loaded
IOException
- if unable to load resource
ParseException
- if unable to parse contentpublic LinkedHashMap<KeyStroke,String> load(InputStream input) throws IOException, ParseException
input
- source of keybindings to be parsed
IOException
- if unable to load resource
ParseException
- if unable to parse contentpublic void save(OutputStream output, Map<KeyStroke,String> bindings) throws IOException
output
- stream where persistent state should be writtenbindings
- keybindings to be saved
IOException
- if unable to save bindings
UnsupportedOperationException
- if any keys or values of the binding are nullpublic void save(String path, Map<KeyStroke,String> bindings) throws IOException
path
- absolute path to where bindings should be savedbindings
- keybindings to be saved
IOException
- if unable to save bindings
UnsupportedOperationException
- if any keys or values of the binding are nullpublic String getOutput(Map<KeyStroke,String> bindings)
bindings
- bindings for which to generate saved output
public String toString()
toString
in class Enum<Persistence>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |