5
5
This program is free software; you can redistribute it and/or
6
6
modify it under the terms of the GNU General Public License
7
as published by the Free Software Foundation; either version 2
7
as published by the Free Software Foundation; either version 3
8
8
of the License, or (at your option) any later version.
10
10
This program is distributed in the hope that it will be useful,
61
62
return child.node(suffix);
64
66
public void removeNode() throws BackingStoreException {
65
67
throw new UnsupportedOperationException();
68
71
public String absolutePath() {
69
72
return myParent==null ? "/" : myParent.absolutePath() + "/" + myName;
72
76
public String[] childrenNames() throws BackingStoreException {
73
77
return myChildren.keySet().toArray(new String[0]);
76
81
public void clear() throws BackingStoreException {
80
86
public void flush() throws BackingStoreException {
83
90
public String get(String key, String def) {
84
91
String value = myProps.get(key);
85
92
return value==null ? def : value;
88
96
public boolean getBoolean(String key, boolean def) {
97
String value = get(key, null);
102
return Boolean.parseBoolean(value);
103
} catch (Exception e) {
104
GPLogger.log(new RuntimeException("Failed to parse value=" + value + " as boolean", e));
92
110
public byte[] getByteArray(String key, byte[] def) {
93
111
// TODO Auto-generated method stub
97
116
public double getDouble(String key, double def) {
98
117
// TODO Auto-generated method stub
102
122
public float getFloat(String key, float def) {
103
123
// TODO Auto-generated method stub
107
128
public int getInt(String key, int def) {
108
129
String value = get(key, null);
109
130
if (value == null) {
119
141
public long getLong(String key, long def) {
120
142
// TODO Auto-generated method stub
124
147
public String[] keys() throws BackingStoreException {
125
148
return myProps.keySet().toArray(new String[0]);
128
152
public String name() {
132
157
public boolean nodeExists(String pathName) throws BackingStoreException {
133
158
return node(pathName)!=null;
136
162
public Preferences parent() {
140
167
public void put(String key, String value) {
141
168
myProps.put(key, value);
144
172
public void putBoolean(String key, boolean value) {
145
// TODO Auto-generated method stub
173
myProps.put(key, Boolean.toString(value));
148
177
public void putByteArray(String key, byte[] value) {
149
178
// TODO Auto-generated method stub
152
182
public void putDouble(String key, double value) {
153
183
// TODO Auto-generated method stub
156
187
public void putFloat(String key, float value) {
157
188
// TODO Auto-generated method stub
160
192
public void putInt(String key, int value) {
161
193
put(key, String.valueOf(value));
164
197
public void putLong(String key, long value) {
165
198
// TODO Auto-generated method stub
168
202
public void remove(String key) {
169
203
myProps.remove(key);
172
207
public void sync() throws BackingStoreException {
173
208
throw new UnsupportedOperationException();