com.jgoodies.jdiskreport.domain
Class FileUtils

java.lang.Object
  extended by com.jgoodies.jdiskreport.domain.FileUtils

public final class FileUtils
extends Object

Provides only static convenience behavior for Files.

Version:
$Revision: 1.4 $
Author:
Karsten Lentzsch

Method Summary
static String getCanonicalPath(File file)
          Looks up and returns the canonical path for the given file.
static boolean isLink(File file, String itsCanonicalPath)
          Checks and answers whether the file seems to be a link.
static int linkLength(File file)
          Guesses and returns the length of a link using the length of the file's canonical path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isLink

public static boolean isLink(File file,
                             String itsCanonicalPath)
Checks and answers whether the file seems to be a link. If the operating system support links, compare the absolute path with the canonical path.

This methods gets the file's canonical path, just because this can save a lot of time. Building the canonical path can be a heavy operation on some operating systems.

Parameters:
file - the file to check
itsCanonicalPath - the file's canonical path
Returns:
true if the file seems to be a link

linkLength

public static int linkLength(File file)
Guesses and returns the length of a link using the length of the file's canonical path.

Parameters:
file - the file that represents the link
Returns:
the guessed link length in bytes

getCanonicalPath

public static String getCanonicalPath(File file)
Looks up and returns the canonical path for the given file. IOExceptions are silently catched and in such a case the absolute path is returned.

Parameters:
file - the file to build the canonical path for
Returns:
the canonical path for the given file


Copyright © 2000-2008 JGoodies Karsten Lentzsch. All Rights Reserved.