ucar.nc2.util
Class NetworkUtils

java.lang.Object
  extended by ucar.nc2.util.NetworkUtils

public class NetworkUtils
extends java.lang.Object

Networking utilities.

Version:
$Revision:63 $ $Date:2006-07-12 21:50:51Z $
Author:
caron

Constructor Summary
NetworkUtils()
           
 
Method Summary
static java.lang.String canonicalize(java.lang.String location)
           
static void initProtocolHandler()
           
static void main(java.lang.String[] args)
           
static void main2(java.lang.String[] args)
           
static java.lang.String resolve(java.lang.String baseUrl, java.lang.String relativeUrl)
          This augments URI.resolve(), by also dealing with base file: URIs.
static java.lang.String resolveFile(java.lang.String baseDir, java.lang.String filepath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetworkUtils

public NetworkUtils()
Method Detail

initProtocolHandler

public static void initProtocolHandler()

resolve

public static java.lang.String resolve(java.lang.String baseUrl,
                                       java.lang.String relativeUrl)
This augments URI.resolve(), by also dealing with base file: URIs. If baseURL is not a file: scheme, then URI.resolve is called. Otherwise the last "/" is found in the base, and the ref is appended to it.

For file: baseURLS: only reletive URLS not starting with / are supported. This is apparently different from the behavior of URI.resolve(), so may be trouble, but it allows NcML absolute location to be specified without the file: prefix. Example :

 base:     file://my/guide/collections/designfaq.ncml
 ref:      sub/my.nc
 resolved: file://my/guide/collections/sub/my.nc
 

Parameters:
baseUrl - base URL as a Strng
relativeUrl - reletive URL, as a String
Returns:
the resolved URL as a String

canonicalize

public static java.lang.String canonicalize(java.lang.String location)

resolveFile

public static java.lang.String resolveFile(java.lang.String baseDir,
                                           java.lang.String filepath)

main2

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

main

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