|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.util.Dictionary<K,V>
java.util.Hashtable<java.lang.Object,java.lang.Object>
java.util.Properties
edu.toronto.psi.vincent.util.EasyProperties
public class EasyProperties
Wrapper for the Properties class to make reading data from and writing data to a properties file easier. In particular, numbers and arrays can be parsed from and written to a properties file.
Copyright (C) 2005 Vincent Cheung (vincent@psi.toronto.edu, http://www.psi.toronto.edu/~vincent/) This program 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 2 of the License, or (at your option) any later version. This program 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.
| Field Summary |
|---|
| Fields inherited from class java.util.Properties |
|---|
defaults |
| Constructor Summary | |
|---|---|
EasyProperties()
Creates an empty property list with no default values. |
|
EasyProperties(java.util.Properties defaults)
Creates an empty property list with the specified defaults. |
|
EasyProperties(java.lang.String filename)
Creates a property list from the specified properties file. |
|
| Method Summary | |
|---|---|
double[][] |
get2DDoubleArrayProperty(java.lang.String key)
Returns the property as a two-dimensional double array. |
double[][] |
get2DDoubleArrayProperty(java.lang.String key,
double[][] defaultValue)
Returns the property as a two-dimensional double array. |
int[][] |
get2DIntArrayProperty(java.lang.String key)
Returns the property as a two-dimensional integer array. |
int[][] |
get2DIntArrayProperty(java.lang.String key,
int[][] defaultValue)
Returns the property as a two-dimensional integer array. |
double[][][] |
get3DDoubleArrayProperty(java.lang.String key)
Returns the property as a three-dimensional double array. |
double[][][] |
get3DDoubleArrayProperty(java.lang.String key,
double[][][] defaultValue)
Returns the property as a three-dimensional double array. |
int[][][] |
get3DIntArrayProperty(java.lang.String key)
Returns the property as a three-dimensional integer array. |
int[][][] |
get3DIntArrayProperty(java.lang.String key,
int[][][] defaultValue)
Returns the property as a three-dimensional integer array. |
boolean |
getBooleanProperty(java.lang.String key)
Returns the property as a boolean (property is true if != "0" or == "true"). |
boolean |
getBooleanProperty(java.lang.String key,
boolean defaultValue)
Returns the property as a boolean (property is true if != "0" or == "true"). |
double[] |
getDoubleArrayProperty(java.lang.String key)
Returns the property as a double array. |
double[] |
getDoubleArrayProperty(java.lang.String key,
double[] defaultValue)
Returns the property as a double array. |
double |
getDoubleProperty(java.lang.String key)
Returns the property as a double. |
double |
getDoubleProperty(java.lang.String key,
double defaultValue)
Returns the property as a double. |
int[] |
getIntArrayProperty(java.lang.String key)
Returns the property as an integer array. |
int[] |
getIntArrayProperty(java.lang.String key,
int[] defaultValue)
Returns the property as an integer array. |
int |
getIntProperty(java.lang.String key)
Returns the property as an integer. |
int |
getIntProperty(java.lang.String key,
int defaultValue)
Returns the property as an integer. |
java.lang.String[] |
getStringArrayProperty(java.lang.String key)
Returns the property as a string array. |
java.lang.String[] |
getStringArrayProperty(java.lang.String key,
java.lang.String[] defaultValue)
Returns the property as a string array. |
void |
list()
Prints this property list to the default output stream (System.out). |
void |
load(java.lang.String filename)
Load the properties file. |
double[][] |
parse2DDoubleArray(java.lang.String s)
Parses a comma delimited string to a two-dimensional double array. |
int[][] |
parse2DIntArray(java.lang.String s)
Parses a comma delimited string to a two-dimensional integer array. |
double[][][] |
parse3DDoubleArray(java.lang.String s)
Parses a comma delimited string to a three-dimensional double array. |
int[][][] |
parse3DIntArray(java.lang.String s)
Parses a comma delimited string to a three-dimensional integer array. |
double[] |
parseDoubleArray(java.lang.String s)
Parses a comma delimited string to a double array. |
int[] |
parseIntArray(java.lang.String s)
Parses a comma delimited string to an integer array. |
java.lang.String[] |
parseStringArray(java.lang.String s)
Parses a ", " delimited string to a string array. |
java.lang.Object |
setProperty(java.lang.String key,
boolean value)
Calls the Hashtable method put. |
java.lang.Object |
setProperty(java.lang.String key,
double value)
Calls the Hashtable method put. |
java.lang.Object |
setProperty(java.lang.String key,
double[] value)
Calls the Hashtable method put. |
java.lang.Object |
setProperty(java.lang.String key,
double[][] value)
Calls the Hashtable method put. |
java.lang.Object |
setProperty(java.lang.String key,
double[][][] value)
Calls the Hashtable method put. |
java.lang.Object |
setProperty(java.lang.String key,
int value)
Calls the Hashtable method put. |
java.lang.Object |
setProperty(java.lang.String key,
int[] value)
Calls the Hashtable method put. |
java.lang.Object |
setProperty(java.lang.String key,
int[][] value)
Calls the Hashtable method put. |
java.lang.Object |
setProperty(java.lang.String key,
int[][][] value)
Calls the Hashtable method put. |
java.lang.Object |
setProperty(java.lang.String key,
java.lang.String[] value)
Calls the Hashtable method put. |
void |
store(java.lang.String filename,
java.lang.String header)
Writes this property list (key and element pairs) in this Properties table to a file in a format suitable for loading into a Properties table using the load method. |
| Methods inherited from class java.util.Properties |
|---|
getProperty, getProperty, list, list, load, loadFromXML, propertyNames, save, setProperty, store, storeToXML, storeToXML |
| Methods inherited from class java.util.Hashtable |
|---|
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public EasyProperties()
public EasyProperties(java.util.Properties defaults)
defaults - the defaults.public EasyProperties(java.lang.String filename)
filename - the name of the properties file.| Method Detail |
|---|
public void load(java.lang.String filename)
filename - the name of the properties file.
public void store(java.lang.String filename,
java.lang.String header)
filename - the name of the properties file.header - a description of the property list.public void list()
public boolean getBooleanProperty(java.lang.String key)
key - the property key.
public boolean getBooleanProperty(java.lang.String key,
boolean defaultValue)
key - the property key.defaultValue - the default value.
public int getIntProperty(java.lang.String key)
key - the property key.
public int getIntProperty(java.lang.String key,
int defaultValue)
key - the property key.defaultValue - the default value.
public double getDoubleProperty(java.lang.String key)
key - the property key.
public double getDoubleProperty(java.lang.String key,
double defaultValue)
key - the property key.defaultValue - the default value.
public int[] getIntArrayProperty(java.lang.String key)
key - the property key.
public int[] getIntArrayProperty(java.lang.String key,
int[] defaultValue)
key - the property key.defaultValue - the default value.
public int[] parseIntArray(java.lang.String s)
s - the comma delimited string.
public int[][] get2DIntArrayProperty(java.lang.String key)
key - the property key.
public int[][] get2DIntArrayProperty(java.lang.String key,
int[][] defaultValue)
key - the property key.defaultValue - the default value.
public int[][] parse2DIntArray(java.lang.String s)
s - the comma delimited string.
public int[][][] get3DIntArrayProperty(java.lang.String key)
key - the property key.
public int[][][] get3DIntArrayProperty(java.lang.String key,
int[][][] defaultValue)
key - the property key.defaultValue - the default value.
public int[][][] parse3DIntArray(java.lang.String s)
s - the comma delimited string.
public double[] getDoubleArrayProperty(java.lang.String key)
key - the property key.
public double[] getDoubleArrayProperty(java.lang.String key,
double[] defaultValue)
key - the property key.defaultValue - the default value.
public double[] parseDoubleArray(java.lang.String s)
s - the comma delimited string.
public double[][] get2DDoubleArrayProperty(java.lang.String key)
key - the property key.
public double[][] get2DDoubleArrayProperty(java.lang.String key,
double[][] defaultValue)
key - the property key.defaultValue - the default value.
public double[][] parse2DDoubleArray(java.lang.String s)
s - the comma delimited string.
public double[][][] get3DDoubleArrayProperty(java.lang.String key)
key - the property key.
public double[][][] get3DDoubleArrayProperty(java.lang.String key,
double[][][] defaultValue)
key - the property key.defaultValue - the default value.
public double[][][] parse3DDoubleArray(java.lang.String s)
s - the comma delimited string.
public java.lang.String[] getStringArrayProperty(java.lang.String key)
key - the property key.
public java.lang.String[] getStringArrayProperty(java.lang.String key,
java.lang.String[] defaultValue)
key - the property key.defaultValue - the default value.
public java.lang.String[] parseStringArray(java.lang.String s)
s - the ", " delimited string.
public java.lang.Object setProperty(java.lang.String key,
boolean value)
key - the key to be placed into this property list.value - the value corresponding to key.
public java.lang.Object setProperty(java.lang.String key,
int value)
key - the key to be placed into this property list.value - the value corresponding to key.
public java.lang.Object setProperty(java.lang.String key,
double value)
key - the key to be placed into this property list.value - the value corresponding to key.
public java.lang.Object setProperty(java.lang.String key,
int[] value)
key - the key to be placed into this property list.value - the value corresponding to key.
public java.lang.Object setProperty(java.lang.String key,
int[][] value)
key - the key to be placed into this property list.value - the value corresponding to key.
public java.lang.Object setProperty(java.lang.String key,
int[][][] value)
key - the key to be placed into this property list.value - the value corresponding to key.
public java.lang.Object setProperty(java.lang.String key,
double[] value)
key - the key to be placed into this property list.value - the value corresponding to key.
public java.lang.Object setProperty(java.lang.String key,
double[][] value)
key - the key to be placed into this property list.value - the value corresponding to key.
public java.lang.Object setProperty(java.lang.String key,
double[][][] value)
key - the key to be placed into this property list.value - the value corresponding to key.
public java.lang.Object setProperty(java.lang.String key,
java.lang.String[] value)
key - the key to be placed into this property list.value - the value corresponding to key.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||