|
Servertec Foundation Classes 1.3.3 09/04/2005 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectstec.sfc.Win32.FileSystem
public final class FileSystem
Used to copy and rename files, to get the path of the system's temporary directory, to get the name of a temporary file, to create temporary files, to retrieve an array containing drives paths and to get and set the current directory.
Field Summary | |
---|---|
static java.lang.String |
pathSeparator
The String containing the character used to separate Win32 paths. |
static char |
pathSeparatorChar
The character used to separate Win32 paths. |
static java.lang.String |
separator
The String containing the character used to separate Win32 path elements. |
static char |
separatorChar
The character used to separate Win32 path elements. |
Constructor Summary | |
---|---|
FileSystem()
|
Method Summary | |
---|---|
static void |
copy(java.lang.String source_filename,
java.lang.String destination_filename,
boolean overwrite)
Used to copy the specified file to the given file path. |
static void |
createDirectory(java.lang.String path)
Creates the specified new directory. |
static File |
createTempFile(File directory,
java.lang.String prefix)
Returns a File object for the constructed temporary file. |
static File |
createTempFile(java.lang.String prefix)
Returns a File object for the constructed temporary file in the system's temporary directory. |
static File |
createTempFile(java.lang.String path,
java.lang.String prefix)
Returns a File object for the constructed temporary file. |
static void |
delete(java.lang.String source_filename)
Used to remove the specified file. |
static java.lang.String[] |
drives()
Returns an array of Strings containing all known drive paths. |
static java.lang.String |
getCurrentDirectory()
Returns the current directory. |
static java.lang.String |
getSystemDirectory()
Returns path for the system's Windows system directory. |
static java.lang.String |
getTempFileName(java.lang.String directory,
java.lang.String prefix,
int unique)
Returns path to temporary file. |
static java.lang.String |
getTempPath()
Returns path for the system's temporary directory. |
static java.lang.String |
getWindowsDirectory()
Returns path for the system's Windows directory. |
static void |
move(java.lang.String source_filename,
java.lang.String destination_filename,
int move_mode)
Used to move an existing file or directory. |
static void |
removeDirectory(java.lang.String path)
Deletes the specified directory. |
static void |
rename(java.lang.String source_filename,
java.lang.String destination_filename,
boolean overwrite)
Used to rename the specified file to the given file path. |
static void |
setCurrentDirectory(java.lang.String path)
Used to set the current directory. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char pathSeparatorChar
Win32 platforms use ;, semi-colon.
public static final java.lang.String pathSeparator
Win32 platforms use ;, semi-colon.
public static final char separatorChar
Win32 platforms use \, back-slash.
public static final java.lang.String separator
Win32 platforms use \, back-slash.
Constructor Detail |
---|
public FileSystem()
Method Detail |
---|
public static final java.lang.String[] drives() throws Win32Exception
Win32Exception
- if any error occurs.public static final java.lang.String getCurrentDirectory() throws Win32Exception
Win32Exception
- if any error occurs.public static final void setCurrentDirectory(java.lang.String path) throws Win32Exception
path
- a directory path.
Win32Exception
- if any error occurs.public static final void copy(java.lang.String source_filename, java.lang.String destination_filename, boolean overwrite) throws Win32Exception
source_filename
- the path to the file to copy.destination_filename
- the path to the new file.overwrite
- whether to overwrite any existing file.
Win32Exception
- if the destination file exists and overwrite is false or if any error occurs.public static final void rename(java.lang.String source_filename, java.lang.String destination_filename, boolean overwrite) throws Win32Exception
source_filename
- the path to the file to rename.destination_filename
- the new file path.overwrite
- whether to overwrite any existing file.
Win32Exception
- if the destination file exists and overwrite is false or if any error occurs.public static final void move(java.lang.String source_filename, java.lang.String destination_filename, int move_mode) throws Win32Exception
If move_mode is DELAY_UNTIL_REBOOT then the source file cannot be read-only.
If the move_mode is DELAY_UNTIL_REBOOT and the destination is null then the source file will be deleted.
DELAY_UNTIL_REBOOT cannot be used with COPY.
REPLACE_EXISTING cannot be used if the destination is a directory
If the source file is a directory then the destination must be on the same drive.
If the destination file is on another drive then the move_mode must be set to COPY_ALLOWED.
source_filename
- the path to the file or directory to move.destination_filename
- the new path.move_mode
- specifies how the source will be moved. Defined in FileMoveMode
Win32Exception
- if the destination file exists and REPLACE_EXISTING was not specified or if any error occurs.public static final void delete(java.lang.String source_filename) throws Win32Exception
source_filename
- the path to the file to delete.
Win32Exception
- if the file does not exist or if any error occurs.public static final java.lang.String getTempPath() throws Win32Exception
Win32Exception
- if any error occurs.public static final java.lang.String getWindowsDirectory() throws Win32Exception
Win32Exception
- if any error occurs.public static final java.lang.String getSystemDirectory() throws Win32Exception
Win32Exception
- if any error occurs.public static final java.lang.String getTempFileName(java.lang.String directory, java.lang.String prefix, int unique) throws Win32Exception
directory
- the directory path for the file.prefix
- the three (3) characters used to start the file name.unique
- a unique number to use in the file name.
The number is converted into a four (4) character hexadecimal value.
If 0 is used then the current system time will be used.
Win32Exception
- if any error occurs.public static final File createTempFile(File directory, java.lang.String prefix) throws Win32Exception
Temporarary files are not automatically deleted.
directory
- the directory path for the file.prefix
- the three (3) characters used to start the file name.
Win32Exception
- if any error occurs.public static final File createTempFile(java.lang.String path, java.lang.String prefix) throws Win32Exception
Temporarary files are not automatically deleted.
path
- the directory path for the file.prefix
- the three (3) characters used to start the file name.
Win32Exception
- if any error occurs.public static final File createTempFile(java.lang.String prefix) throws Win32Exception
Temporarary files are not automatically deleted.
prefix
- the three (3) characters used to start the file name.
Win32Exception
- if any error occurs.public static final void createDirectory(java.lang.String path) throws Win32Exception
path
- the mew directory to create.
Win32Exception
- if the specified directory cannot be created or if any error occurs.public static final void removeDirectory(java.lang.String path) throws Win32Exception
path
- the directory to delete.
Win32Exception
- if the specified directory cannot be deleted or if any error occurs.
|
Servertec Foundation Classes 1.3.3 09/04/2005 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2001-2005 Servertec. All rights reserved.