patterntesting.runtime.io
Class FileHelper

Package class diagram package FileHelper
java.lang.Object
  extended by patterntesting.runtime.io.FileHelper

public final class FileHelper
extends Object

The Class FileHelper.

Since:
11.09.2008
Version:
$Revision: 1.8 $
Author:
oliver

Method Summary
static File createTmpdir()
          Creates a directory in the temp directory.
static File createTmpdir(String prefix, String suffix)
          Creates a directory in the temp directory.
static boolean equals(File f1, File f2)
          Comparing two files is not so easy as it seems to be.
static File getHomeDir()
          Gets the home dir.
static File getTmpdir()
          Gets the tmpdir.
static File getTmpdir(File file)
          Gets the tmpdir.
static File getTmpdir(String filename)
          Gets the tmpdir.
static File normalize(File file)
          Normalizes a file, analogous to FilenameUtils.normalize(String).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTmpdir

public static File getTmpdir()
Gets the tmpdir.

Returns:
the tmpdir

getTmpdir

public static File getTmpdir(File file)
Gets the tmpdir.

Parameters:
file - the file
Returns:
the tmpdir

getTmpdir

public static File getTmpdir(String filename)
Gets the tmpdir.

Parameters:
filename - the filename
Returns:
the tmpdir

createTmpdir

public static File createTmpdir()
                         throws IOException
Creates a directory in the temp directory.

Returns:
the directory
Throws:
IOException - Signals that an I/O exception has occurred.

createTmpdir

public static File createTmpdir(String prefix,
                                String suffix)
                         throws IOException
Creates a directory in the temp directory.

Parameters:
prefix - the prefix
suffix - the suffix
Returns:
the directory
Throws:
IOException - Signals that an I/O exception has occurred.

getHomeDir

public static File getHomeDir()
Gets the home dir.

Returns:
the home dir

normalize

public static File normalize(File file)
Normalizes a file, analogous to FilenameUtils.normalize(String). But before we normalize it we try to ask to OS for the canonical path for it.

Parameters:
file - the file
Returns:
the file

equals

public static boolean equals(File f1,
                             File f2)
Comparing two files is not so easy as it seems to be. On unix systems or Mac OS-X you can see the same file via two different mount points or as two different hard links. If you are on *nix you can use the inode to compare but how to get the inode?

Parameters:
f1 - file 1
f2 - file 2
Returns:
true, if successful
Since:
1.1


Copyright © 2002–2014 PatternTesting Team. All rights reserved.