code: protected final boolean isInside(File file, File dir) throws IOException
      {
          return file.getCanonicalPath().startsWith(dir.getCanonicalPath());
      }
docs: Checks whether a file is contained within a given directory (or a sub
  directory) or not.
  
  @param file the file to check.
  @param dir the directory to check.
  @return <code>true</code> if file is below directory, <code>false</code>
  otherwise.
  @throws IOException if the canonical path of file or dir cannot be
  determined.