head 1.1; branch 1.1.1; access ; symbols DEVEL:1.1.1.1 HEAD:1.1.1; locks ; strict; comment @# @; 1.1 date 2001.03.16.18.13.13; author jallali; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2001.03.16.18.13.13; author jallali; state Exp; branches ; next ; desc @@ 1.1 log @Initial revision @ text @

Overview | Package | Class | Tree | Deprecated | Index | Help
| EJCL Xtreme for PalmOS
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## java.io
Class File

    java.lang.Object
      |
      +--java.io.File

public class File
extends Object
implements Serializable

File is a class which represents a file name or directory. The file may be absolute relative to the root directory of the file system or relative to the current directory in which the program is running.

This class provides methods for querying/changing information about the file and also directory listing capabilities if the File represents a directory.

When manipulating file paths, the static fields of this class may be used to determine the platform specific separators.

See Also:
  `Serializable`, `java.lang.Comparable`, Serialized Form

Field Summary
`static String` | `pathSeparator` System dependant path separator String.
`static char` | `pathSeparatorChar` System dependant path separator character.
`static String` | `separator` System dependant file separator String.
`static char` | `separatorChar` System dependant file separator character.

Constructor Summary
`File(File dir, String name)` Constructs a new File using the specified directory and name.
`File(String path)` Constructs a new File using the specified path.
`File(String dirPath, String name)` Constructs a new File using the specified directory and name placing a path separator between the two.

Method Summary
`boolean` | `delete()` Deletes the file specified by this File.
`boolean` | `equals(Object obj)` Compares the argument `obj` to the receiver, and answers `true` if they represent the same object using a path specific comparison.
`boolean` | `exists()` Answers a boolean indicating whether or not this File can be found on the underlying file system.
`String` | `getAbsolutePath()` Answers the absolute file path of this File.
`String` | `getCanonicalPath()` Answers the absolute file path of this File with all references resolved.
`String` | `getName()` Answers the filename (not directory) of this File.
`String` | `getParent()` Answers the pathname of the parent of this File.
`String` | `getPath()` Answers the file path of this File.
`int` | `hashCode()` Answers an integer hash code for the receiver.
`boolean` | `isAbsolute()` Answers if this File is an absolute pathname.
`boolean` | `isDirectory()` Answers if this File represents a directory on the underlying file system.
`boolean` | `isFile()` Answers if this File represents a file on the underlying file system.
`long` | `lastModified()` Answers the time this File was last modified.
`long` | `length()` Answers the length of this File in bytes.
`String[]` | `list()` Answers an array of Strings representing the file names in the directory represented by this File.
`boolean` | `mkdir()` Creates the directory named by the trailing filename of this File.
`boolean` | `renameTo(File dest)` Renames this File to the name represented by the File `dest`.

Methods inherited from class java.lang.Object
`clone, getClass, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### separatorChar

    public static final char separatorChar

  System dependant file separator character.

### separator

    public static final String separator

  System dependant file separator String. The initial value of this field is the System property "file.separator".

### pathSeparatorChar

    public static final char pathSeparatorChar

  System dependant path separator character.

### pathSeparator

    public static final String pathSeparator

  System dependant path separator String. The initial value of this field is the System property "path.separator".

Constructor Detail

### File

    public File(File dir,
                String name)

  Constructs a new File using the specified directory and name.
  Parameters:
    `dir` - the directory for the file name
    `name` - the file name to be contained in the dir

### File

    public File(String path)

  Constructs a new File using the specified path.
  Parameters:
    `path` - the path to be used for the file

### File

    public File(String dirPath,
                String name)

  Constructs a new File using the specified directory and name placing a path separator between the two.
  Parameters:
    `dirPath` - the directory for the file name
    `name` - the file name to be contained in the dir

Method Detail

### delete

    public boolean delete()

  Deletes the file specified by this File. Directories must be empty before they will be deleted. There is only one directory on the palm, and that is '/'. It cannot be deleted.
  Returns:
    `true` if this File was deleted, `false` otherwise.
  See Also:
    `java.lang.SecurityManager#checkDelete()`

### equals

    public boolean equals(Object obj)

  Compares the argument `obj` to the receiver, and answers `true` if they represent the same object using a path specific comparison.
  Overrides:
    equals in class Object
  Parameters:
    `obj` - the Object to compare with this Object
  Returns:
    `true` if the object is the same as this object, `false` otherwise.

### exists

    public boolean exists()

  Answers a boolean indicating whether or not this File can be found on the underlying file system.
  Returns:
    `true` if this File exists, `false` otherwise.
  See Also:
    `getPath()`, `java.lang.SecurityManager#checkRead()`

### getAbsolutePath

    public String getAbsolutePath()

  Answers the absolute file path of this File.
  Returns:
    the absolute file path
  See Also:
    `java.lang.SecurityManager#checkPropertyAccess()`

### getCanonicalPath

    public String getCanonicalPath()
                            throws IOException

  Answers the absolute file path of this File with all references resolved. An absolute file path is one which begins at the root of the file system. The canonical path is one in which all references have been resolved. For the cases of '..' and '.' where the file system supports parent and working directory respectively, these should be removed and replaced with a direct directory reference. If the File does not exist, getCanonicalPath() may not resolve any references and simply return an absolute path name or throw an IOException.
  Returns:
    the canonical file path
  Throws:
    IOException -
  See Also:
    `java.lang.SecurityManager#checkPropertyAccess()`

### getName

    public String getName()

  Answers the filename (not directory) of this File.
  Returns:
    the filename or empty string

### getParent

    public String getParent()

  Answers the pathname of the parent of this File. This is the path upto but not including the last name. `null` is returned when there is no parent.
  Returns:
    the parent name or `null`

### getPath

    public String getPath()

  Answers the file path of this File.
  Returns:
    the file path

### hashCode

    public int hashCode()

  Answers an integer hash code for the receiver. Any two objects which answer `true` when passed to `equals` must answer the same value for this method.
  Overrides:
    hashCode in class Object
  Returns:
    the receiver's hash
  See Also:
    `equals`

### isAbsolute

    public boolean isAbsolute()

  Answers if this File is an absolute pathname. Whether a pathname is absolute is platform specific. On UNIX it is if the path starts with the character '/', on Windows it is absolute if either it starts with '\', '/', '\\' (to represent a file server), or a letter followed by a colon.
  Returns:
    `true` if this File is absolute, `false` otherwise.
  See Also:
    `getPath()`

### isDirectory

    public boolean isDirectory()

  Answers if this File represents a directory on the underlying file system.
  Returns:
    `true` if this File is a directory, `false` otherwise.
  See Also:
    `getPath()`, `java.lang.SecurityManager#checkRead()`

### isFile

    public boolean isFile()

  Answers if this File represents a file on the underlying file system.
  Returns:
    `true` if this File is a file, `false` otherwise.
  See Also:
    `getPath()`, `java.lang.SecurityManager#checkRead()`

### lastModified

    public long lastModified()

  Answers the time this File was last modified.
  Returns:
    the time this File was last modified.
  See Also:
    `getPath()`, `java.lang.SecurityManager#checkRead()`

### length

    public long length()

  Answers the length of this File in bytes.
  Returns:
    the number of bytes in the file.
  See Also:
    `getPath()`, `java.lang.SecurityManager#checkRead()`

### list

    public String[] list()

  Answers an array of Strings representing the file names in the directory represented by this File. If this File is not a directory the result is `null`.

  The entries `.` and `..` representing current directory and parent directory are not returned as part of the list.

  Returns:
    an array of Strings or `null`.
  See Also:
    `getPath()`, `isDirectory()`, `java.lang.SecurityManager#checkRead()`

### mkdir

    public boolean mkdir()

  Creates the directory named by the trailing filename of this File. Not all directories required to create this File are created.
  Returns:
    `true` if the directory was created, `false` otherwise.
  See Also:
    `getPath()`, `java.lang.SecurityManager#checkWrite()`

### renameTo

    public boolean renameTo(File dest)

  Renames this File to the name represented by the File `dest`. This works for both normal files and directories.
  Parameters:
    `dest` - the File containing the new name.
  Returns:
    `true` if the File was renamed, `false` otherwise.
  See Also:
    `getPath()`, `java.lang.SecurityManager#checkRead()`, `java.lang.SecurityManager#checkWrite()`

Overview | Package | Class | Tree | Deprecated | Index | Help
| EJCL Xtreme for PalmOS
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

@ 1.1.1.1 log @import initial @ text @@