jasp.io
Class FileSystemObject

java.lang.Object
  |
  +--jasp.io.FileSystemObject

public class FileSystemObject
extends java.lang.Object

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

FileSystemObject

public FileSystemObject()
Method Detail

getDrives

public static Drives getDrives()

BuildPath

public static java.lang.String BuildPath(java.lang.String path,
                                         java.lang.String name)
                                  throws java.lang.Exception
Generate a path from an existing path and a name
Parameters:
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.

GetDriveName

public static java.lang.String GetDriveName(java.lang.String Path)
Return drive from a path
Parameters:
Path - The path specification for the component whose drive name is to be returned.
Returns:
returns a string containing the name of the drive for a specified path.

GetParentFolderName

public static java.lang.String GetParentFolderName(java.lang.String path)
                                            throws java.lang.Exception
Return path to the parent folder
Parameters:
path - The path specification for the component whose parent folder name is to be returned.
Returns:
Returns a string containing the name of the parent folder of the last component in a specified path.

GetFileName

public static java.lang.String GetFileName(java.lang.String path)
                                    throws java.lang.Exception
Return the file name from a path
Parameters:
path - The path (absolute or relative) to a specific file.
Returns:
Returns the last component of specified path that is not part of the drive specification.

GetBaseName

public static java.lang.String GetBaseName(java.lang.String path)
                                    throws java.lang.Exception
Return base name from a path
Parameters:
Path - The path specification for the component whose base name is to be returned
Returns:
Returns a string containing the base name of the last component, less any file extension, in a path.

GetExtensionName

public static java.lang.String GetExtensionName(java.lang.String path)
                                         throws java.lang.Exception
Return extension from path
Parameters:
Path - The path specification for the component whose extension name is to be returned.
Returns:
Returns a string containing the extension name for the last component in a path.

GetAbsolutePathName

public static java.lang.String GetAbsolutePathName(java.lang.String path)
                                            throws java.lang.Exception
Return the canonical representation of the path
Parameters:
path - Path specification to change to a complete and unambiguous path.
Returns:
Returns a complete and unambiguous path from a provided path specification.

GetTempName

public static java.lang.String GetTempName()
Deprecated.  

Generate name that can be used to name a temporary file
Returns:
Returns a randomly generated temporary file or folder name that is useful for performing operations that require a temporary file or folder.

DriveExists

public static boolean DriveExists(java.lang.String drivespec)
                           throws java.lang.Exception
Check if a drive or a share exists
Parameters:
drivespec - A drive letter or a complete path specification.
Returns:
Returns True if the specified drive exists; False if it does not.

FileExists

public static boolean FileExists(java.lang.String filespec)
                          throws java.lang.Exception
Check if a file exists
Parameters:
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.
Returns:
Returns True if a specified file exists; False if it does not.

FolderExists

public static boolean FolderExists(java.lang.String folderspec)
                            throws java.lang.Exception
Check if a path exists"
Parameters:
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.
Returns:
Returns True if a specified folder exists; False if it does not.

GetDrive

public static Drive GetDrive(java.lang.String drivespec)
                      throws java.lang.Exception
Get drive or UNC share
Parameters:
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).
Returns:
Returns a Drive object corresponding to the drive in a specified path.

GetFile

public static File GetFile(java.lang.String filespec)
                    throws java.lang.Exception
Get file
Parameters:
The - filespec is the path (absolute or relative) to a specific file.
Returns:
Returns a File object corresponding to the file in a specified path.

GetFolder

public static Folder GetFolder(java.lang.String folderspec)
                        throws java.lang.Exception
Get folder
Parameters:
The - folderspec is the path (absolute or relative) to a specific folder.
Returns:
Returns a Folder object corresponding to the folder in a specified path.

GetSpecialFolder

public static Folder GetSpecialFolder(int specialfolder)
                               throws java.lang.Exception
Deprecated.  

Get location of various system folders
Parameters:
The - name of the special folder to be returned. Can be any of the constants shown in the Settings section.
Returns:
Returns the special folder object specified.

DeleteFile

public static void DeleteFile(java.lang.String filespec)
                       throws java.lang.Exception
Delete a file
Parameters:
filespec - The name of the file to delete. The filespec can contain wildcard characters in the last path component.

DeleteFile

public static void DeleteFile(java.lang.String filespec,
                              boolean force)
                       throws java.lang.Exception
Delete a file
Parameters:
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.

DeleteFolder

public static void DeleteFolder(java.lang.String folderspec)
                         throws java.lang.Exception
Delete a folder
Parameters:
folderspec - The name of the folder to delete. The folderspec can contain wildcard characters in the last path component.

DeleteFolder

public static void DeleteFolder(java.lang.String folderspec,
                                boolean force)
                         throws java.lang.Exception
Delete a folder
Parameters:
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.

MoveFile

public static void MoveFile(java.lang.String source,
                            java.lang.String destination)
                     throws java.lang.Exception
Moves one or more files from one location to another.
Parameters:
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.

MoveFolder

public static void MoveFolder(java.lang.String source,
                              java.lang.String destination)
                       throws java.lang.Exception
Move a folder
Parameters:
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.

CopyFile

public static void CopyFile(java.lang.String source,
                            java.lang.String destination)
                     throws java.lang.Exception
Copy a file
Parameters:
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.

CopyFile

public static void CopyFile(java.lang.String source,
                            java.lang.String destination,
                            boolean overwrite)
                     throws java.lang.Exception
Copy a file
Parameters:
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.

CopyFolder

public static void CopyFolder(java.lang.String source,
                              java.lang.String destination)
                       throws java.lang.Exception
Copy a folder
Parameters:
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.

CopyFolder

public static void CopyFolder(java.lang.String source,
                              java.lang.String destination,
                              boolean overwrite)
                       throws java.lang.Exception
Copy a folder
Parameters:
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.

CreateFolder

public static Folder CreateFolder(java.lang.String foldername)
                           throws java.lang.Exception
Create a folder
Parameters:
foldername - String expression that identifies the folder to create.
Returns:
Returns a folder object

CreateTextFile

public static TextStream CreateTextFile(java.lang.String filename)
                                 throws java.lang.Exception
Create a file as a TextStream
Parameters:
filename - String expression that identifies the file to create.
Returns:
Returns a TextStream object that can be used to read from or write to the file.

CreateTextFile

public static TextStream CreateTextFile(java.lang.String filename,
                                        boolean overwrite)
                                 throws java.lang.Exception
Create a file as a TextStream
Parameters:
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.
Returns:
Returns a TextStream object that can be used to read from or write to the file.

CreateTextFile

public static TextStream CreateTextFile(java.lang.String filename,
                                        boolean overwrite,
                                        boolean unicode)
                                 throws java.lang.Exception
Create a file as a TextStream
Parameters:
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.
Returns:
Returns a TextStream object that can be used to read from or write to the file.

OpenTextFile

public static TextStream OpenTextFile(java.lang.String filename)
                               throws java.lang.Exception
Open a file as a TextStream
Parameters:
filename - String expression that identifies the file to open.
Returns:
Returns a TextStream object that can be used to read from, write to, or append to the file.

OpenTextFile

public static TextStream OpenTextFile(java.lang.String filename,
                                      int iomode)
                               throws java.lang.Exception
Open a file as a TextStream
Parameters:
filename - String expression that identifies the file to open.
iomode - Can be one of three constants: ForReading, ForWriting, or ForAppending.
Returns:
Returns a TextStream object that can be used to read from, write to, or append to the file.

OpenTextFile

public static TextStream OpenTextFile(java.lang.String filename,
                                      int iomode,
                                      boolean create)
                               throws java.lang.Exception
Open a file as a TextStream
Parameters:
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.
Returns:
Returns a TextStream object that can be used to read from, write to, or append to the file.

OpenTextFile

public static TextStream OpenTextFile(java.lang.String filename,
                                      int iomode,
                                      boolean create,
                                      int format)
                               throws java.lang.Exception
Open a file as a TextStream
Parameters:
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.
Returns:
Returns a TextStream object that can be used to read from, write to, or append to the file.