opendap.crawler
Class ParsedURL

java.lang.Object
  extended by opendap.crawler.ParsedURL
All Implemented Interfaces:
java.io.Serializable

public class ParsedURL
extends java.lang.Object
implements java.io.Serializable

Given a URL passed to the constructor, parse the URL and provide access to its various parts. This class will break out the machine, path and leaf components of the URL. This also holds a copy of the entire URL's original text, so that references to instances can get both components and the real thing.

Author:
jimg
See Also:
Serialized Form

Constructor Summary
ParsedURL(java.lang.String url)
          A URL is parsed by first removing the protocol and '://' parts, then the machine part.
 
Method Summary
static
<T> T[]
concat_java5(T[] a, T[] b)
          A version of concat that does not require Java 6
static
<T> T[]
concat(T[] first, T[] second)
          Concatenate two arrays of the same type and return the result in an array.
 java.lang.String[] getComponents()
           
 java.lang.String getMachine()
           
 java.lang.String getTheURL()
           
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParsedURL

public ParsedURL(java.lang.String url)
          throws java.lang.Exception
A URL is parsed by first removing the protocol and '://' parts, then the machine part. What remains is the path, where '/' separates the components until the leaf (file) is found. Within the file we consider any non-alphanum to be a separator.

Parameters:
url - The URL to parse.
Throws:
java.lang.Exception
Method Detail

main

public static void main(java.lang.String[] args)

getMachine

public java.lang.String getMachine()

getComponents

public java.lang.String[] getComponents()

getTheURL

public java.lang.String getTheURL()

concat

public static <T> T[] concat(T[] first,
                             T[] second)
Concatenate two arrays of the same type and return the result in an array. Requires Java 6

Type Parameters:
T -
Parameters:
first - The first array
second - The second array
Returns:
The concatenation of the two arrays

concat_java5

public static <T> T[] concat_java5(T[] a,
                                   T[] b)
A version of concat that does not require Java 6

Type Parameters:
T -
Parameters:
a -
b -
Returns:
See Also:
concat