|
¡¡
|
Chapter 9 - The
FILE Statements
|
9.1 The syntax of the FILE statements:
1. Backup all subdirectories and files in the system
data directory to the specifical directory.
Syntax: FILE BACKUP PathName
Return: Integer
Explain: Return
Integer(0)
if executed successfully; throw a error message if failed.
2. Restore all subdirectories and files in the specifical directory to the system
data directory.
Syntax: FILE RESTORE PathName
Return: Integer
Explain: Return
Integer(0)
if executed successfully;throw a error message if failed.
3. Get all subdirectories in a directory.
Syntax: FILE GETCATALOGS
Return: String
Explain: Use
the delimiter '\n'
between one catalogname and another catalogname; throw
a error message if failed.
4. Get all files in a directory.
Syntax: FILE GETFILES
Return: String
Explain: Use
the delimiter '\n'
between one filename and another filename; throw a
error message if failed.
5. Read the binary file.
Syntax: FILE READBINARY
FileName
Return:
java.io.InputStream
Explain: Return
java.io.InputStream
if executed successfully; throw a error message if failed.
6. Create and write the binary file.
Syntax: FILE WRITEBINARY FileName
Return:
java.io.OutputStream
Explain: Return java.io.OutputStream
if executed successfully; throw a error message if failed.
7. Check whether a file exists.
Syntax: FILE EXIST FileName
Return: Boolean
Explain: Return
Boolean(true) if executed successfully; else return Boolean(false).
8. Rename a file.
Syntax: FILE RENAME
SourceFileName,DestFileName
Return: Boolean
Explain: Return
Boolean(true) if executed successfully; else return Boolean(false).
9. Check whether the time when the source file is updated is later than the time
when the destination file is updated.
Syntax: FILE
ISUPDATE SourceFileName,DestFileName
Return: Boolean
Explain: Return
Boolean(true) if the time updating the source file is later than the
destination file;else return Boolean(false).
.
10. Delete a directory or a file.
Syntax: FILE DELETE FileName
Return: Boolean
Explain: Return
Boolean(true)
if executed successfully; else return Boolean(false).
9.2 The execution of the FILE statements
The interface method of the FILE statements: execute(String
cmd).
The method returns Object
object;you
can convert the object into a corresponding object as follows: Integer,String,InputStream,OutputStream,Boolean,then
continue other manipulations.
Return
|
¡¡ |