com.exponto.jstock.util
Class Util

java.lang.Object
  extended bycom.exponto.jstock.util.Util

public class Util
extends java.lang.Object

Author:
kaare

Constructor Summary
Util()
           
 
Method Summary
static void downloadURL(java.net.URL url, java.io.File file)
          Downloads the content of an URL and saves it to a file.
static java.net.URL URLCreator(java.lang.String rawURL, java.util.Map substituteMap)
          Creates a URL from a string and a hashmap with a substition table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

URLCreator

public static java.net.URL URLCreator(java.lang.String rawURL,
                                      java.util.Map substituteMap)
Creates a URL from a string and a hashmap with a substition table. '<' is used as start substitution and '>' for end substitution. Whatever is between is used as key in the hashmap and replaced with what is returned.

Parameters:
rawURL - a URL that may includes fields that shall be replaced
substituteMap - a replacement HashMap
Returns:
a presumably clean URL

downloadURL

public static void downloadURL(java.net.URL url,
                               java.io.File file)
Downloads the content of an URL and saves it to a file. It's up to the calling class to ensure that the file exits or can be created. If the file exits the previous content is overwritten. The method is quite long, but mostly due to exception handling.

Parameters:
url - the URL to download
file - to save to


Copyright © 2004 Kaare Ranum