|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jasp.io.FileSystemObject
Contains methods and properties that allow you to create, delete, gain information about, and generally manipulate drives, folders, and files. Many of the methods associated with this object duplicate those in other FSO objects; they are provided for convenience
Constructor Summary | |
FileSystemObject()
|
Method Summary | |
static java.lang.String |
BuildPath(java.lang.String path,
java.lang.String name)
Generate a path from an existing path and a name |
static void |
CopyFile(java.lang.String source,
java.lang.String destination)
Copy a file |
static void |
CopyFile(java.lang.String source,
java.lang.String destination,
boolean overwrite)
Copy a file |
static void |
CopyFolder(java.lang.String source,
java.lang.String destination)
Copy a folder |
static void |
CopyFolder(java.lang.String source,
java.lang.String destination,
boolean overwrite)
Copy a folder |
static Folder |
CreateFolder(java.lang.String foldername)
Create a folder |
static TextStream |
CreateTextFile(java.lang.String filename)
Create a file as a TextStream |
static TextStream |
CreateTextFile(java.lang.String filename,
boolean overwrite)
Create a file as a TextStream |
static TextStream |
CreateTextFile(java.lang.String filename,
boolean overwrite,
boolean unicode)
Create a file as a TextStream |
static void |
DeleteFile(java.lang.String filespec)
Delete a file |
static void |
DeleteFile(java.lang.String filespec,
boolean force)
Delete a file |
static void |
DeleteFolder(java.lang.String folderspec)
Delete a folder |
static void |
DeleteFolder(java.lang.String folderspec,
boolean force)
Delete a folder |
static boolean |
DriveExists(java.lang.String drivespec)
Check if a drive or a share exists |
static boolean |
FileExists(java.lang.String filespec)
Check if a file exists |
static boolean |
FolderExists(java.lang.String folderspec)
Check if a path exists" |
static java.lang.String |
GetAbsolutePathName(java.lang.String path)
Return the canonical representation of the path |
static java.lang.String |
GetBaseName(java.lang.String path)
Return base name from a path |
static Drive |
GetDrive(java.lang.String drivespec)
Get drive or UNC share |
static java.lang.String |
GetDriveName(java.lang.String Path)
Return drive from a path |
static Drives |
getDrives()
|
static java.lang.String |
GetExtensionName(java.lang.String path)
Return extension from path |
static File |
GetFile(java.lang.String filespec)
Get file |
static java.lang.String |
GetFileName(java.lang.String path)
Return the file name from a path |
static Folder |
GetFolder(java.lang.String folderspec)
Get folder |
static java.lang.String |
GetParentFolderName(java.lang.String path)
Return path to the parent folder |
static Folder |
GetSpecialFolder(int specialfolder)
Deprecated. |
static java.lang.String |
GetTempName()
Deprecated. |
static void |
MoveFile(java.lang.String source,
java.lang.String destination)
Moves one or more files from one location to another. |
static void |
MoveFolder(java.lang.String source,
java.lang.String destination)
Move a folder |
static TextStream |
OpenTextFile(java.lang.String filename)
Open a file as a TextStream |
static TextStream |
OpenTextFile(java.lang.String filename,
int iomode)
Open a file as a TextStream |
static TextStream |
OpenTextFile(java.lang.String filename,
int iomode,
boolean create)
Open a file as a TextStream |
static TextStream |
OpenTextFile(java.lang.String filename,
int iomode,
boolean create,
int format)
Open a file as a TextStream |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FileSystemObject()
Method Detail |
public static Drives getDrives()
public static java.lang.String BuildPath(java.lang.String path, java.lang.String name) throws java.lang.Exception
path
- Existing path to which name is appended.
Path can be absolute or relative and
need not specify an existing folder.name
- Name being appended to the existing path.public static java.lang.String GetDriveName(java.lang.String Path)
Path
- The path specification for the component whose
drive name is to be returned.public static java.lang.String GetParentFolderName(java.lang.String path) throws java.lang.Exception
path
- The path specification for the component whose
parent folder name is to be returned.public static java.lang.String GetFileName(java.lang.String path) throws java.lang.Exception
path
- The path (absolute or relative) to a specific file.public static java.lang.String GetBaseName(java.lang.String path) throws java.lang.Exception
Path
- The path specification for the component whose
base name is to be returnedpublic static java.lang.String GetExtensionName(java.lang.String path) throws java.lang.Exception
Path
- The path specification for the component whose
extension name is to be returned.public static java.lang.String GetAbsolutePathName(java.lang.String path) throws java.lang.Exception
path
- Path specification to change to a complete
and unambiguous path.public static java.lang.String GetTempName()
public static boolean DriveExists(java.lang.String drivespec) throws java.lang.Exception
drivespec
- A drive letter or a complete path specification.public static boolean FileExists(java.lang.String filespec) throws java.lang.Exception
filespec
- The name of the file whose existence is to be
determined. A complete path specification (either
absolute or relative) must be provided if the file
isn't expected to exist in the current folder.public static boolean FolderExists(java.lang.String folderspec) throws java.lang.Exception
folderspec
- The name of the folder whose existence is to
be determined. A complete path specification (either
absolute or relative) must be provided if the folder
isn't expected to exist in the current folder.public static Drive GetDrive(java.lang.String drivespec) throws java.lang.Exception
The
- drivespec argument can be a drive letter (c), a drive
letter with a colon appended (c:), a drive letter with a
colon and path separator appended (c:\), or any network
share specification (\\computer2\share1).public static File GetFile(java.lang.String filespec) throws java.lang.Exception
The
- filespec is the path (absolute or relative) to a specific
file.public static Folder GetFolder(java.lang.String folderspec) throws java.lang.Exception
The
- folderspec is the path (absolute or relative) to a
specific folder.public static Folder GetSpecialFolder(int specialfolder) throws java.lang.Exception
The
- name of the special folder to be returned. Can be
any of the constants shown in the Settings section.public static void DeleteFile(java.lang.String filespec) throws java.lang.Exception
filespec
- The name of the file to delete. The filespec can
contain wildcard characters in the last path component.public static void DeleteFile(java.lang.String filespec, boolean force) throws java.lang.Exception
filespec
- The name of the file to delete. The filespec can
contain wildcard characters in the last path component.force
- Boolean value that is true if files with the
read-only attribute set are to be deleted; false
(default) if they are not.public static void DeleteFolder(java.lang.String folderspec) throws java.lang.Exception
folderspec
- The name of the folder to delete. The folderspec
can contain wildcard characters in the last path component.public static void DeleteFolder(java.lang.String folderspec, boolean force) throws java.lang.Exception
folderspec
- The name of the folder to delete. The folderspec
can contain wildcard characters in the last path component.force
- Boolean value that is true if folders with the
read-only attribute set are to be deleted; false
(default) if they are not.public static void MoveFile(java.lang.String source, java.lang.String destination) throws java.lang.Exception
source
- The path to the file or files to be moved. The
source argument string can contain wildcard characters
in the last path component only.destination
- The path where the file or files are to be
moved. The destination argument can't contain wildcard
characters.public static void MoveFolder(java.lang.String source, java.lang.String destination) throws java.lang.Exception
source
- The path to the folder or folders to be moved.
The source argument string can contain wildcard
characters in the last path component only.destination
- The path where the folder or folders are
to be moved. The destination argument can't contain
wildcard characters.public static void CopyFile(java.lang.String source, java.lang.String destination) throws java.lang.Exception
source
- Character string file specification, which can
include wildcard characters, for one or more files to
be copied.destination
- Character string destination where the file
or files from source are to be copied. Wildcard
characters are not allowed.public static void CopyFile(java.lang.String source, java.lang.String destination, boolean overwrite) throws java.lang.Exception
source
- Character string file specification, which can
include wildcard characters, for one or more files to
be copied.destination
- Character string destination where the file
or files from source are to be copied. Wildcard
characters are not allowed.overwrite
- Boolean value that indicates if existing files
are to be overwritten. If true, files are overwritten;
if false, they are not. The default is true.
Note that CopyFile will fail if destination has the
read-only attribute set, regardless of the value of
overwrite.public static void CopyFolder(java.lang.String source, java.lang.String destination) throws java.lang.Exception
source
- Character string folder specification, which can
include wildcard characters, for one or more folders to
be copied.destination
- Character string destination where the folder
and subfolders from source are to be copied. Wildcard
characters are not allowed.public static void CopyFolder(java.lang.String source, java.lang.String destination, boolean overwrite) throws java.lang.Exception
source
- Character string folder specification, which can
include wildcard characters, for one or more folders to
be copied.destination
- Character string destination where the folder
and subfolders from source are to be copied. Wildcard
characters are not allowed.overwrite
- Boolean value that indicates if existing folders
are to be overwritten. If true, files are overwritten; if
false, they are not. The default is true.public static Folder CreateFolder(java.lang.String foldername) throws java.lang.Exception
foldername
- String expression that identifies the
folder to create.public static TextStream CreateTextFile(java.lang.String filename) throws java.lang.Exception
filename
- String expression that identifies the file to
create.public static TextStream CreateTextFile(java.lang.String filename, boolean overwrite) throws java.lang.Exception
filename
- String expression that identifies the file to
create.overwrite
- Boolean value that indicates whether you can
overwrite an existing file. The value is true if the
file can be overwritten, false if it can't be overwritten.
If omitted, existing files are not overwritten.public static TextStream CreateTextFile(java.lang.String filename, boolean overwrite, boolean unicode) throws java.lang.Exception
filename
- String expression that identifies the file to
create.overwrite
- Boolean value that indicates whether you can
overwrite an existing file. The value is true if the
file can be overwritten, false if it can't be overwritten.
If omitted, existing files are not overwritten.unicode
- Boolean value that indicates whether the file is
created as a Unicode or ASCII file. The value is true if
the file is created as a Unicode file, false if it's
created as an ASCII file. If omitted, an ASCII file is
assumed.public static TextStream OpenTextFile(java.lang.String filename) throws java.lang.Exception
filename
- String expression that identifies the file to open.public static TextStream OpenTextFile(java.lang.String filename, int iomode) throws java.lang.Exception
filename
- String expression that identifies the file to open.iomode
- Can be one of three constants: ForReading, ForWriting,
or ForAppending.public static TextStream OpenTextFile(java.lang.String filename, int iomode, boolean create) throws java.lang.Exception
filename
- String expression that identifies the file to open.iomode
- Can be one of three constants: ForReading, ForWriting,
or ForAppending.create
- Boolean value that indicates whether a new file can be
created if the specified filename doesn't exist. The value is
True if a new file is created, False if it isn't created. If
omitted, a new file isn't created.public static TextStream OpenTextFile(java.lang.String filename, int iomode, boolean create, int format) throws java.lang.Exception
filename
- String expression that identifies the file to open.iomode
- Can be one of three constants: ForReading, ForWriting,
or ForAppending.create
- Boolean value that indicates whether a new file can be
created if the specified filename doesn't exist. The value is
True if a new file is created, False if it isn't created. If
omitted, a new file isn't created.format
- One of three Tristate values used to indicate the format
of the opened file. If omitted, the file is opened as ASCII.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |