com.ibm.are.platform
Class FileTypes

java.lang.Object
  extended by com.ibm.are.platform.FileTypes
All Implemented Interfaces:
FileTypeIdentifier, java.lang.Comparable

public class FileTypes
extends java.lang.Object
implements FileTypeIdentifier, java.lang.Comparable

The FileTypes class implements a base set of file types that are common across all platforms supported by ARE.

Version:
1.0
Author:
IBM

Field Summary
static java.lang.String COPYRIGHT
          Copyright for class bytecode
static FileTypes DIRECTORY
          Directory type
static FileTypes FILE
          File type
protected static FileTypes[] fileTypeSet
          The entire set of known file types, sorted by type name
static FileTypes SYMLINK
          Symbolic link type
static FileTypes UNKNOWN
          Unknown file type
 
Constructor Summary
FileTypes(java.lang.String name)
          Constructs a FileTypes object for the specified file type
 
Method Summary
 int compareTo(java.lang.Object obj)
          Compares two FileTypes objects to see if they are equal.
 boolean equals(java.lang.Object obj)
          Determines if the FileTypes object equals the given object.
 FileTypes fromPath(java.io.File theFile)
          Determines the file type from the given path
 FileTypes fromString(java.lang.String theFile)
          Determines the file type from the given string
 java.lang.String getName()
          Retrieves the name of the file type
 boolean isDirectory()
          Determines if the file type object represents a directory
 boolean isFile()
          Determines if the file type object represents a file
 boolean isSymbolicLink()
          Determines if the file type object represents a symbolic link
 boolean isUnknown()
          Determines if the file type object represents an unknown file type
 java.lang.String toString()
          Returns a string representation of the object
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
Copyright for class bytecode

See Also:
Constant Field Values

DIRECTORY

public static final FileTypes DIRECTORY
Directory type


FILE

public static final FileTypes FILE
File type


SYMLINK

public static final FileTypes SYMLINK
Symbolic link type


UNKNOWN

public static final FileTypes UNKNOWN
Unknown file type


fileTypeSet

protected static FileTypes[] fileTypeSet
The entire set of known file types, sorted by type name

Constructor Detail

FileTypes

public FileTypes(java.lang.String name)
Constructs a FileTypes object for the specified file type

Parameters:
name - The name of the file type
Method Detail

getName

public java.lang.String getName()
Retrieves the name of the file type

Returns:
The name of the file type

isDirectory

public boolean isDirectory()
Determines if the file type object represents a directory

Returns:
true if the file type object represents a directory, false if it does not

isFile

public boolean isFile()
Determines if the file type object represents a file

Returns:
true if the file type object represents a file, false if it does not

isSymbolicLink

public boolean isSymbolicLink()
Determines if the file type object represents a symbolic link

Returns:
true if the file type object represents a symbolic link, false if it does not

isUnknown

public boolean isUnknown()
Determines if the file type object represents an unknown file type

Returns:
true if the file type object represents an unknown, file type, false if it does not

fromString

public FileTypes fromString(java.lang.String theFile)
Determines the file type from the given string

Specified by:
fromString in interface FileTypeIdentifier
Parameters:
theFile - A string representing the file. This string is typically just a file path.
Returns:
The file type

toString

public java.lang.String toString()
Returns a string representation of the object

Overrides:
toString in class java.lang.Object
Returns:
A string representation of the object

equals

public boolean equals(java.lang.Object obj)
Determines if the FileTypes object equals the given object.

Overrides:
equals in class java.lang.Object
Returns:
true if the two objects are equal, false if they are not. Equality is determined by comparing the file type name of the two objects.

compareTo

public int compareTo(java.lang.Object obj)
Compares two FileTypes objects to see if they are equal.

Specified by:
compareTo in interface java.lang.Comparable
Returns:
-1 if the FileTypes object is lexicographically less than the input object

0 if the two objects represent the exact same file type

1 if the FileTypes object is lexicographically greater than the input object


fromPath

public FileTypes fromPath(java.io.File theFile)
Determines the file type from the given path

Specified by:
fromPath in interface FileTypeIdentifier
Parameters:
theFile - The full path and name of the file
Returns:
The file type