org.apache.cocoon.util
Class NetUtils

java.lang.Object
  |
  +--org.apache.cocoon.util.NetUtils

public class NetUtils
extends java.lang.Object

A collection of File, URL and filename utility methods

Version:
CVS $Id: NetUtils.java,v 1.6.2.2 2002/08/06 13:36:48 cziegeler Exp $
Author:
Stefano Mazzocchi

Constructor Summary
NetUtils()
           
 
Method Summary
static java.lang.String absolutize(java.lang.String path, java.lang.String relativeResource)
          Absolutize a relative resource on the given absolute path.
static java.lang.String decodePath(java.lang.String path)
          Decode a path
static java.lang.String deparameterize(java.lang.String uri, java.util.Map parameters)
          Remove parameters from a uri.
static java.lang.String encodePath(java.lang.String path)
          Encode a path as required by the URL specificatin ( RFC 1738).
static java.lang.String getExtension(java.lang.String uri)
          Remove path and file information from a filename returning only its extension component
static java.lang.String getPath(java.lang.String uri)
          Returns the path of the given resource.
static java.lang.String normalize(java.lang.String uri)
          Normalize a uri containing ../ and ./ paths.
static java.lang.String parameterize(java.lang.String uri, java.util.Map parameters)
           
static java.lang.String relativize(java.lang.String path, java.lang.String absoluteResource)
          Relativize an absolute resource on a given absolute path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetUtils

public NetUtils()
Method Detail

decodePath

public static java.lang.String decodePath(java.lang.String path)
Decode a path
Parameters:
path - the path to decode
Returns:
the decoded path

encodePath

public static java.lang.String encodePath(java.lang.String path)
Encode a path as required by the URL specificatin ( RFC 1738). This differs from java.net.URLEncoder.encode() which encodes according to the x-www-form-urlencoded MIME format.
Parameters:
path - the path to encode
Returns:
the encoded path

getPath

public static java.lang.String getPath(java.lang.String uri)
Returns the path of the given resource.
Parameters:
uri - The URI of the resource
Returns:
the resource path

getExtension

public static java.lang.String getExtension(java.lang.String uri)
Remove path and file information from a filename returning only its extension component
Parameters:
uri - The filename
Returns:
The filename extension (with starting dot!)

absolutize

public static java.lang.String absolutize(java.lang.String path,
                                          java.lang.String relativeResource)
Absolutize a relative resource on the given absolute path.
Parameters:
path - The absolute path
relativeResource - The relative resource
Returns:
the absolutized resource

relativize

public static java.lang.String relativize(java.lang.String path,
                                          java.lang.String absoluteResource)
Relativize an absolute resource on a given absolute path.
Parameters:
path - The absolute path
relativeResource - The absolute resource
Returns:
the resource relative to the given path

normalize

public static java.lang.String normalize(java.lang.String uri)
Normalize a uri containing ../ and ./ paths.
Parameters:
uri - The uri path to normalize
Returns:
The normalized uri

deparameterize

public static java.lang.String deparameterize(java.lang.String uri,
                                              java.util.Map parameters)
Remove parameters from a uri.
Parameters:
uri - The uri path to deparameterize.
parameters - The map that collects parameters.
Returns:
The cleaned uri

parameterize

public static java.lang.String parameterize(java.lang.String uri,
                                            java.util.Map parameters)


Copyright � 1999-2002 Apache Software Foundation. All Rights Reserved.