lhmc.files
Class UrlUtils

java.lang.Object
  extended by lhmc.files.UrlUtils

public class UrlUtils
extends java.lang.Object

UrlUtils helps the url files that can contain a File or a SmbFile.

Version:
0.01 Jun 2007
Author:
Cristina Roura Claver

Constructor Summary
UrlUtils()
          Constructs the UrlUtils class.
UrlUtils(int filesystemLocation)
          Constructs the UrlUtils class specifying the filesystem location.
UrlUtils(java.net.URL url)
          Constructs the UrlUtils and searches wich filesystem location has the URL.
 
Method Summary
 java.net.URL createURL(java.lang.String path)
          Creates an URL file from a file path
 java.lang.String getAbsolutePath(java.net.URL url)
          Returns the absolute pathname string of this abstract pathname.
 java.io.File getFile(java.net.URL url)
          Extracts the File of a URL.
 java.net.URL[] getFilteredUrls(java.net.URL rootFile, java.io.FileFilter customFileFilter)
          Returns an array of url files and directories that satisfy the specified filter.
 int getLocation()
          Gets the location attribute (remote or local).
 int getLocation(java.net.URL url)
          Gets the location (remote or local) of the file.
 java.lang.String getPath(java.net.URL url)
          Converts the url file abstract pathname into a pathname string.
 SmbFile getSmbFile(java.net.URL url)
          Extracts the SmbFile of a URL.
 java.lang.String getUrlName(java.net.URL url)
          Gets the name of the file.
 java.net.URL getURLParent(java.net.URL url)
          Returns the pathname string of this abstract pathname's parent, or null if this pathname does not name a parent directory.
 boolean isUrlDirectory(java.net.URL url)
          Tests whether the file is a directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrlUtils

public UrlUtils()
Constructs the UrlUtils class.


UrlUtils

public UrlUtils(int filesystemLocation)
Constructs the UrlUtils class specifying the filesystem location.

Parameters:
filesystemLocation - the filesystem location.

UrlUtils

public UrlUtils(java.net.URL url)
Constructs the UrlUtils and searches wich filesystem location has the URL.

Parameters:
url - the url file.
Method Detail

getUrlName

public java.lang.String getUrlName(java.net.URL url)
Gets the name of the file.

Parameters:
url - the url file.
Returns:
the name of the file.

getLocation

public int getLocation(java.net.URL url)
Gets the location (remote or local) of the file.

Parameters:
url - the url file.
Returns:
the location.

getLocation

public int getLocation()
Gets the location attribute (remote or local).

Returns:
the location.

isUrlDirectory

public boolean isUrlDirectory(java.net.URL url)
Tests whether the file is a directory.

Returns:
true if it is a directory.

getSmbFile

public SmbFile getSmbFile(java.net.URL url)
Extracts the SmbFile of a URL.

Parameters:
url - the url file.
Returns:
the SmbFile.

getFile

public java.io.File getFile(java.net.URL url)
Extracts the File of a URL.

Parameters:
url - the url file.
Returns:
the File.

getURLParent

public java.net.URL getURLParent(java.net.URL url)
Returns the pathname string of this abstract pathname's parent, or null if this pathname does not name a parent directory.

Parameters:
url - the url file.
Returns:
the parent url file.

getAbsolutePath

public java.lang.String getAbsolutePath(java.net.URL url)
Returns the absolute pathname string of this abstract pathname.

Parameters:
url - the url file.
Returns:
the absolute path name string.

getPath

public java.lang.String getPath(java.net.URL url)
Converts the url file abstract pathname into a pathname string.

Parameters:
url - the url file.
Returns:
The string form of this abstract pathname.

getFilteredUrls

public java.net.URL[] getFilteredUrls(java.net.URL rootFile,
                                      java.io.FileFilter customFileFilter)
Returns an array of url files and directories that satisfy the specified filter.

Parameters:
rootFile - the url directory to list.
customFileFilter - the file filter.
Returns:
an array of url files.

createURL

public java.net.URL createURL(java.lang.String path)
Creates an URL file from a file path

Parameters:
path - the file path.
Returns:
an url file.