simple.util
Class URLProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<java.lang.Object,java.lang.Object>
          extended by java.util.Properties
              extended by simple.util.URLProperties
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>

public class URLProperties
extends java.util.Properties

The URLProperties object is used as a convienience class that is used to create a Properties object from a URL. This will automatically load the Java properties file once instantiated. This is used so that the creation and use of a java.util.Properties file is much cleaner.

Author:
Niall Gallagher
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
URLProperties(java.lang.String source)
          Constructor for the URLProperties object.
URLProperties(java.net.URL source)
          Constructor for the URLProperties object.
 
Method Summary
 void load(java.io.InputStream source)
          This overloads the Properties.load so that XML properties can be loaded as well as standard properties.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
 
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

URLProperties

public URLProperties(java.lang.String source)
              throws java.io.IOException
Constructor for the URLProperties object. The constructor will use the specified URL as the contents of its properties. The URL source must point to a valid Java properties file, using a URL scheme such as HTTP or FTP. For example "http://host/data.properties" will use HTTP.

Parameters:
source - this is the URL that contains the properties
Throws:
java.io.IOException - if the properties can not be loaded

URLProperties

public URLProperties(java.net.URL source)
              throws java.io.IOException
Constructor for the URLProperties object. The constructor will use the specified URL as the contents of its properties. The URL source must point to a valid Java properties file, using a URL scheme such as HTTP or FTP. For example "http://host/data.properties" will use HTTP.

Parameters:
source - this is the URL that contains the properties
Throws:
java.io.IOException - if the properties can not be loaded
Method Detail

load

public void load(java.io.InputStream source)
          throws java.io.IOException
This overloads the Properties.load so that XML properties can be loaded as well as standard properties. Once this method is invoked the stream is examined to see if the properties format is in XML. If the file is a valid XML file then the properties are loaded int he XML format. Otherwise they are loaded using the traditional format.

Overrides:
load in class java.util.Properties
Parameters:
source - the stream that contains the properties
Throws:
java.io.IOException