com.ideanest.util
Class Files

java.lang.Object
  |
  +--com.ideanest.util.Files

public final class Files
extends java.lang.Object


Method Summary
static java.lang.String filenameToURI(java.lang.String str)
          Fixes a platform dependent filename to standard URI form.
static java.net.URL fileToURL(java.io.File file)
           
static boolean isParent(java.io.File parent, java.io.File child)
          Check whether the child file is eventually contained within the parent file.
static java.lang.String URIToFilename(java.lang.String str)
          Fixes a platform dependent filename to standard URI form.
static java.io.File URLToFile(java.net.URL url)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

filenameToURI

public static java.lang.String filenameToURI(java.lang.String str)
Fixes a platform dependent filename to standard URI form.

Parameters:
str - The string to fix.
Returns:
Returns the fixed URI string.

fileToURL

public static java.net.URL fileToURL(java.io.File file)
                              throws java.net.MalformedURLException,
                                     java.io.IOException
java.net.MalformedURLException
java.io.IOException

isParent

public static boolean isParent(java.io.File parent,
                               java.io.File child)
                        throws java.io.IOException
Check whether the child file is eventually contained within the parent file. The algorithm uses the canonical version of the path for both files.

Parameters:
parent - the candidate parent file, which should be a directory
child - the candidate child, which can be a directory or a file
Returns:
whether child is in fact contained within parent
Throws:
java.io.IOException - if something fails and the answer is inconclusive

URIToFilename

public static java.lang.String URIToFilename(java.lang.String str)
Fixes a platform dependent filename to standard URI form.

Parameters:
str - The string to fix.
Returns:
Returns the fixed URI string.

URLToFile

public static java.io.File URLToFile(java.net.URL url)
                              throws java.net.MalformedURLException
java.net.MalformedURLException