org.gjt.btools.utilities
Class ResourceUtils

java.lang.Object
  |
  +--org.gjt.btools.utilities.ResourceUtils

public class ResourceUtils
extends java.lang.Object

Provides utilities for accessing both local and remote resources.


Constructor Summary
ResourceUtils()
           
 
Method Summary
static java.lang.String combineLocations(java.lang.String first, java.lang.String second)
          Combines the two given resource location strings, which may possibly use different path separators.
static java.lang.String pathSeparator(java.lang.String location)
          Determines the path separator used in the given resource location string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceUtils

public ResourceUtils()
Method Detail

combineLocations

public static java.lang.String combineLocations(java.lang.String first,
                                                java.lang.String second)
Combines the two given resource location strings, which may possibly use different path separators. The path separator used in the first string will be the path separator used in the final resource location string.

The two location strings will simply be concatenated, with the exception of some tidying up of path separators.

For instance, if first is http://my.server/dira/ and second is dirb\dirc\file.name, then the resulting string will be http://my.server/dira/dirb/dirc/file.name.

Parameters:
first - the first resource location string; this may or may not end with a trailing path separator.
second - the second resource location string.
Returns:
the combined resource location string.

pathSeparator

public static java.lang.String pathSeparator(java.lang.String location)
Determines the path separator used in the given resource location string. This is only a best guess, using a series of heuristics to try and determine the separator used.

Separators /, \ and :: are supported. If the separator cannot be determined, a default of / is returned.

Returns:
the path separator used in the given location string.


Copyright © 1998-2001, Ben Burton
This software is released under the GNU Public License.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@debian.org).