TUM CCSM Commons

edu.tum.cs.commons.filesystem
Class CanonicalFile

java.lang.Object
  extended by java.io.File
      extended by edu.tum.cs.commons.filesystem.CanonicalFile
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<java.io.File>

public class CanonicalFile
extends java.io.File

This class represents files that are guaranteed to be canonical. For this class methods getPath(), getAbsolutePath() and getCanonicalPath() all return the same (canonical) path.

Version:
$Rev: 26268 $
Author:
deissenb, $Author: juergens $
See Also:
Serialized Form
Rating:
GREEN Hash: F36AFC8726FA8659B2B0CA3F4501A4E3

Field Summary
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
CanonicalFile(java.io.File file)
          Create new canonical file from existing file.
CanonicalFile(java.io.File parent, java.lang.String child)
          Create new canonical file.
CanonicalFile(java.lang.String pathname)
          Create new canonical file.
CanonicalFile(java.lang.String parent, java.lang.String child)
          Create new canonical file.
CanonicalFile(java.net.URI uri)
          Create new canonical file.
 
Method Summary
 CanonicalFile getAbsoluteFile()
          Deprecated. 
 java.lang.String getAbsolutePath()
          Deprecated. 
 CanonicalFile getCanonicalFile()
          Returns the canonical file itself.
 java.lang.String getCanonicalPath()
          This method is overridden to save effort for call to File.getCanonicalPath().
 java.lang.String getExtension()
          Returns the extension of the file.
 CanonicalFile getParentFile()
          Same as File.getParentFile() but returns a canonical file.
 java.lang.String getPath()
          Deprecated. 
 boolean isReadableFile()
          Checks if this file is a file an can be read.
 CanonicalFile[] listFiles()
          Same as File.listFiles() but returns canonical files.
 CanonicalFile[] listFiles(java.io.FileFilter filter)
          Same as File.listFiles(FileFilter) but returns canonical files.
 CanonicalFile[] listFiles(java.io.FilenameFilter filter)
          Same as File.listFiles(FilenameFilter) but returns canonical files.
 
Methods inherited from class java.io.File
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getFreeSpace, getName, getParent, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toString, toURI, toURL
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CanonicalFile

public CanonicalFile(java.io.File file)
              throws java.io.IOException
Create new canonical file from existing file.

Throws:
java.io.IOException

CanonicalFile

public CanonicalFile(java.lang.String pathname)
              throws java.io.IOException
Create new canonical file.

Throws:
java.io.IOException
See Also:
File.File(String)

CanonicalFile

public CanonicalFile(java.io.File parent,
                     java.lang.String child)
              throws java.io.IOException
Create new canonical file.

Throws:
java.io.IOException
See Also:
File.File(File, String)

CanonicalFile

public CanonicalFile(java.lang.String parent,
                     java.lang.String child)
              throws java.io.IOException
Create new canonical file.

Throws:
java.io.IOException
See Also:
File.File(String, String)

CanonicalFile

public CanonicalFile(java.net.URI uri)
              throws java.io.IOException
Create new canonical file.

Throws:
java.io.IOException
See Also:
File.File(URI)
Method Detail

getAbsoluteFile

@Deprecated
public CanonicalFile getAbsoluteFile()
Deprecated. 

Returns the canonical file itself. Use getCanonicalFile() for consistency reasons.

Overrides:
getAbsoluteFile in class java.io.File

getCanonicalFile

public CanonicalFile getCanonicalFile()
Returns the canonical file itself.

Overrides:
getCanonicalFile in class java.io.File

listFiles

public CanonicalFile[] listFiles()
Same as File.listFiles() but returns canonical files. If for some strange reason the files below a canonical file cannot be canonized, this may throw an AssertionError.

Overrides:
listFiles in class java.io.File

listFiles

public CanonicalFile[] listFiles(java.io.FileFilter filter)
Same as File.listFiles(FileFilter) but returns canonical files. If for some strange reason the files below a canonical file cannot be canonized, this may throw an AssertionError.

Overrides:
listFiles in class java.io.File

listFiles

public CanonicalFile[] listFiles(java.io.FilenameFilter filter)
Same as File.listFiles(FilenameFilter) but returns canonical files. If for some strange reason the files below a canonical file cannot be canonized, this may throw an AssertionError.

Overrides:
listFiles in class java.io.File

getParentFile

public CanonicalFile getParentFile()
Same as File.getParentFile() but returns a canonical file. If for some strange reason the parent file of a canonical file cannot be canonized, this may throw an AssertionError.

Overrides:
getParentFile in class java.io.File

isReadableFile

public boolean isReadableFile()
Checks if this file is a file an can be read.


getCanonicalPath

public java.lang.String getCanonicalPath()
This method is overridden to save effort for call to File.getCanonicalPath().

Overrides:
getCanonicalPath in class java.io.File

getAbsolutePath

@Deprecated
public java.lang.String getAbsolutePath()
Deprecated. 

This method is overridden to save effort for call to File.getAbsolutePath(). Use getCanonicalPath() for consistency reasons.

Overrides:
getAbsolutePath in class java.io.File

getPath

@Deprecated
public java.lang.String getPath()
Deprecated. 

Use getCanonicalPath() for consistency reasons.

Overrides:
getPath in class java.io.File

getExtension

public java.lang.String getExtension()
Returns the extension of the file.

Returns:
File extension, i.e. "java" for "FileSystemUtils.java", or null, if the file has no extension (i.e. if a filename contains no '.'), returns the empty string if the '.' is the filename's last character.

TUM CCSM Commons

TUM CCSM Commons - 2.7