org.datamanager.simpleton
Class WebConnection

java.lang.Object
  |
  +--org.datamanager.simpleton.WebConnection

public class WebConnection
extends Object


Field Summary
static String URL_DELIMITERS
           
 
Method Summary
static WebConnection getConnection()
           
 String getContents(URL url)
          This method takes a URL and will return a String that is its contents.
protected  InputStream getInputStream(URL url)
          This method will take a URL and get an InputStream from it.
protected  String getString(InputStream inputStream)
          Take an InputStream and read its contents into a String.
 Vector getURLs(InputStream stream)
          This method takes an InputStream, and parses out all the URLs located within that InputStream.
 Vector getURLs(String string)
          Find all isolated URLs in the given string and return them in a Vector
protected  boolean isURL(String string)
          Determine whether the given string looks like a url.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URL_DELIMITERS

public static final String URL_DELIMITERS
See Also:
Constant Field Values
Method Detail

getConnection

public static WebConnection getConnection()

getContents

public String getContents(URL url)
                   throws IOException
This method takes a URL and will return a String that is its contents.

Parameters:
url - The URL object to get the contents of.
Returns:
The contents of the URL.
IOException

getInputStream

protected InputStream getInputStream(URL url)
                              throws IOException
This method will take a URL and get an InputStream from it.

Parameters:
url - The URL from which to get the InputStream.
Returns:
InputStream An InputStream from the given URL.
IOException

getString

protected String getString(InputStream inputStream)
                    throws IOException
Take an InputStream and read its contents into a String.

Parameters:
inputStream - The Stream from which to get the String.
Returns:
String A String representation of the InputStream.
IOException

getURLs

public Vector getURLs(String string)
               throws MalformedURLException
Find all isolated URLs in the given string and return them in a Vector

MalformedURLException

getURLs

public Vector getURLs(InputStream stream)
This method takes an InputStream, and parses out all the URLs located within that InputStream.

Parameters:
stream - An InputStream out of which to parse URLs.
Returns:
Vector A Vector of URL objects from the InputStream.

isURL

protected boolean isURL(String string)
Determine whether the given string looks like a url.

Parameters:
string - A String that might be a url.
Returns:
boolean True if the String is a url, false otherwise.


See the Helium Website