|
|
@ -64,6 +64,8 @@ public class serverObjects extends HashMap<String, String> implements Cloneable
|
|
|
|
|
|
|
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
private boolean localized = true;
|
|
|
|
private boolean localized = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final static char BOM = '\uFEFF'; // ByteOrderMark character that may appear at beginnings of Strings (Browser may append that)
|
|
|
|
|
|
|
|
|
|
|
|
public serverObjects() {
|
|
|
|
public serverObjects() {
|
|
|
|
super();
|
|
|
|
super();
|
|
|
@ -76,6 +78,12 @@ public class serverObjects extends HashMap<String, String> implements Cloneable
|
|
|
|
public serverObjects(final Map<String, String> input) {
|
|
|
|
public serverObjects(final Map<String, String> input) {
|
|
|
|
super(input);
|
|
|
|
super(input);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final String removeBOM(String s) {
|
|
|
|
|
|
|
|
if (s == null || s.length() == 0) return s;
|
|
|
|
|
|
|
|
if (s.charAt(0) == BOM) return s.substring(1);
|
|
|
|
|
|
|
|
return s;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Add a key-value pair of Objects to the map.
|
|
|
|
* Add a key-value pair of Objects to the map.
|
|
|
@ -253,13 +261,13 @@ public class serverObjects extends HashMap<String, String> implements Cloneable
|
|
|
|
|
|
|
|
|
|
|
|
// string variant
|
|
|
|
// string variant
|
|
|
|
public String get(final String key, final String dflt) {
|
|
|
|
public String get(final String key, final String dflt) {
|
|
|
|
final Object result = super.get(key);
|
|
|
|
final String result = removeBOM(super.get(key));
|
|
|
|
if (result == null) return dflt;
|
|
|
|
if (result == null) return dflt;
|
|
|
|
return (String) result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int getInt(final String key, final int dflt) {
|
|
|
|
public int getInt(final String key, final int dflt) {
|
|
|
|
final String s = super.get(key);
|
|
|
|
final String s = removeBOM(super.get(key));
|
|
|
|
if (s == null) return dflt;
|
|
|
|
if (s == null) return dflt;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return Integer.parseInt(s);
|
|
|
|
return Integer.parseInt(s);
|
|
|
@ -269,7 +277,7 @@ public class serverObjects extends HashMap<String, String> implements Cloneable
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public long getLong(final String key, final long dflt) {
|
|
|
|
public long getLong(final String key, final long dflt) {
|
|
|
|
final String s = super.get(key);
|
|
|
|
final String s = removeBOM(super.get(key));
|
|
|
|
if (s == null) return dflt;
|
|
|
|
if (s == null) return dflt;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return Long.parseLong(s);
|
|
|
|
return Long.parseLong(s);
|
|
|
@ -279,7 +287,7 @@ public class serverObjects extends HashMap<String, String> implements Cloneable
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public double getDouble(final String key, final double dflt) {
|
|
|
|
public double getDouble(final String key, final double dflt) {
|
|
|
|
final String s = super.get(key);
|
|
|
|
final String s = removeBOM(super.get(key));
|
|
|
|
if (s == null) return dflt;
|
|
|
|
if (s == null) return dflt;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return Double.parseDouble(s);
|
|
|
|
return Double.parseDouble(s);
|
|
|
|