jfig.utils
Class Pathname

java.lang.Object
  extended byjfig.utils.Pathname

public class Pathname
extends java.lang.Object


Field Summary
(package private) static boolean debug
           
(package private) static java.lang.String doubleDot
           
(package private) static java.lang.String sep
           
 
Constructor Summary
Pathname()
           
 
Method Summary
static void main(java.lang.String[] argv)
           
static java.lang.String makeRelativePathname(java.lang.String pathname, java.lang.String directory)
          construct a relative path/filename from an absolute pathname and a given directory pathname.
static java.lang.String removeDoubleDots(java.lang.String pathname)
          try to remove the '..' references from a like '/usr/local/java/docs/../readme.txt', to give '/usr/local/java/readme.txt'
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

static boolean debug

sep

static java.lang.String sep

doubleDot

static java.lang.String doubleDot
Constructor Detail

Pathname

public Pathname()
Method Detail

removeDoubleDots

public static java.lang.String removeDoubleDots(java.lang.String pathname)
try to remove the '..' references from a like '/usr/local/java/docs/../readme.txt', to give '/usr/local/java/readme.txt'


makeRelativePathname

public static java.lang.String makeRelativePathname(java.lang.String pathname,
                                                    java.lang.String directory)
construct a relative path/filename from an absolute pathname and a given directory pathname. The resulting relative pathname always uses "/" as the separator char. Use String.replace() to convert this to non-Unix/non-URL conventions, if necessary.

For example, given the inputs "/users/hugo/tmp/images/icon.gif" (absolute filename) "/users/hugo/presentations" (directory) this method returns the relative filename "../images/icon.gif"

Note 1: WHAT SHOULD HAPPEN IF NO COMMON PATH IS FOUND?

Note 2: methods trying to read from the relative pathname need to understand the ".." syntax to mean "parent directory".


main

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