|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.amx.duet.tools.io.FileUtil
A utility class that performs file operations similar to NetLinx file operations.
Field Summary | |
static int |
FILE_ALREADY_CLOSE
|
static int |
FILE_BUFFER_TOO_SMALL
|
static int |
FILE_DIRECTORY_EXISTS
|
static int |
FILE_DIRECTORY_NOT_LOADED
|
static int |
FILE_DISK_ERROR
|
static int |
FILE_DISK_FULL
|
static int |
FILE_END_OF_FILE
|
static int |
FILE_INVALID_DIRECTORY
|
static int |
FILE_INVALID_FILENAME
|
static int |
FILE_INVALID_HANDLE
|
static int |
FILE_INVALID_IOFLAG
|
static int |
FILE_INVALID_PARAMETER
|
static int |
FILE_NAME_EXISTS
|
static int |
FILE_OK
|
static int |
IOFLAG_APPEND
|
static int |
IOFLAG_NEW
|
static int |
IOFLAG_READ
|
Constructor Summary | |
FileUtil()
|
Method Summary | |
static boolean |
deleteDir(java.io.File dir)
Deletes all files and subdirectories under the specified directory. |
static long |
FileClose(long lFileHandle)
Closes a file opened with FileOpen(). |
static long |
FileCopy(java.lang.String sSrcFilePath,
java.lang.String sDstFilePath)
Copies the specified file from the source location to the specified destination or name. |
static long |
FileCreateDir(java.lang.String sDirPath)
Create the specified directory path. |
static long |
FileDelete(java.lang.String sFilePath)
Deletes the specified file(s). |
static long |
FileDir(java.lang.String sDirPath,
ObjectRef rStrBuffer,
ObjectRef rEntry)
Returns a list of files located at the specified path. |
static long |
FileGetDir(ObjectRef rStrDirPath)
Returns the current working directory. |
static long |
FileOpen(java.lang.String sFilePath,
long lIOFlag)
Opens a file for reading or writing. |
static long |
FileRead(long lFileHandle,
ObjectRef rStrBuffer,
long lBufLen)
Reads a block of data from the specified file. |
static long |
FileReadLine(long lFileHandle,
ObjectRef rStrBuffer,
long lBufLen)
Reads a line of data from the specified file. |
static long |
FileRemoveDir(java.lang.String sDirPath)
Removes the specified directory path and all subdirectories below it. |
static long |
FileRename(java.lang.String sFilePath,
java.lang.String sNewFileName)
Renames the specified file. |
static long |
FileSeek(long lFileHandle,
long lPos)
Sets the file pointer to the specified position. |
static long |
FileSize(long lFileHandle)
Retrieves the size of a file on disk. |
static long |
FileSize(java.lang.String sFilePath)
Retrieves the size of a file on disk. |
static long |
FileWrite(long lFileHandle,
java.lang.String sBuffer,
long lBufLen)
Writes a block of data to the specified file. |
static long |
FileWriteLine(long lFileHandle,
java.lang.String sBuffer,
long lLineLen)
Writes a line of data to the specified file. |
static java.lang.String |
getUserDirectory(java.lang.String path)
Determines if the path passed in has the user directory prepended to it. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int FILE_OK
public static final int FILE_INVALID_HANDLE
public static final int FILE_INVALID_FILENAME
public static final int FILE_INVALID_IOFLAG
public static final int FILE_INVALID_DIRECTORY
public static final int FILE_DISK_ERROR
public static final int FILE_INVALID_PARAMETER
public static final int FILE_ALREADY_CLOSE
public static final int FILE_NAME_EXISTS
public static final int FILE_END_OF_FILE
public static final int FILE_BUFFER_TOO_SMALL
public static final int FILE_DISK_FULL
public static final int FILE_DIRECTORY_NOT_LOADED
public static final int FILE_DIRECTORY_EXISTS
public static final int IOFLAG_READ
public static final int IOFLAG_NEW
public static final int IOFLAG_APPEND
Constructor Detail |
public FileUtil()
Method Detail |
public static final long FileClose(long lFileHandle)
lFileHandle
- handle to the file returned by FileOpen().
public static final long FileCopy(java.lang.String sSrcFilePath, java.lang.String sDstFilePath)
sSrcFilePath
- path name of the file to copy (source).sDstFilePath
- path name of the copied file (destination).
public static final long FileCreateDir(java.lang.String sDirPath)
sDirPath
- string containing the directory path to create.
public static final long FileDelete(java.lang.String sFilePath)
sFilePath
- path name of the file to delete. Wildcard characters (* and ?) are
permitted in the path name.
public static final long FileDir(java.lang.String sDirPath, ObjectRef rStrBuffer, ObjectRef rEntry)
Each directory entry will have a
Create rStrBuffer with a valueOf(String) Example:
Create rEntry with a valueOf(String) Example:
sDirPath
- String containing the path to the requested directory.rStrBuffer
- Must be of type String. buffer to hold the directory list.
ObjectRef rStrBuffer = new ObjectRef("") or rStrBuffer.valueOf("")
rEntry
- Must be of type String. requested directory entry..
ObjectRef rEntry = new ObjectRef("") or rEntry.valueOf("")
public static final long FileGetDir(ObjectRef rStrDirPath)
rStrDirPath
- Must be of type String. Buffer to receive the current
working directory.
Create rStrDirPath with a valueOf(String) Example:
ObjectRef rStrDirPath = new ObjectRef("") or rStrDirPath.valueOf("")
public static final long FileOpen(java.lang.String sFilePath, long lIOFlag)
If the file is opened successfully, it must be closed (after all reading or writing is completed) by calling FileClose(). If files are not closed, subsequent file open operations may fail due to the limited number of file handles available.
sFilePath
- String containing the path to the file to be opened.
public static final long FileRead(long lFileHandle, ObjectRef rStrBuffer, long lBufLen)
lFileHandle
- handle to the file returned by FileOpen().rStrBuffer
- Must be of type String. Buffer to hold the data to be read.
Create rStrBuffer with a valueOf(String) Example:
ObjectRef rStrBuffer = new ObjectRef("") or rStrBuffer.valueOf("")
lBufLen
- maximum number of bytes to read.
public static final long FileReadLine(long lFileHandle, ObjectRef rStrBuffer, long lBufLen)
This function reads from the current location of the file pointer up to the next carriage
return or to the end-of-file (EOF), whichever comes first. A complete line will not be read
if the buffer length is exceeded before a carriage return (or EOF) is encountered. The bytes
are read from the file identified by lFileHandle and are stored in rStrBuffer. The
Create rStrBuffer with a valueOf(String) Example:
lFileHandle
- handle to the file returned by FileOpen().rStrBuffer
- Must be of type String. Buffer to hold the data to be read.
ObjectRef rStrBuffer = new ObjectRef("") or rStrBuffer.valueOf("")
lBufLen
- maximum number of bytes to read.
public static final long FileRemoveDir(java.lang.String sDirPath)
This function will remove the specified directory and all subdirectories below that directory. It will also delete all files contained in any of these directories.
sDirPath
- string containing the directory path to remove.
public static final long FileRename(java.lang.String sFilePath, java.lang.String sNewFileName)
sFilePath
- path name of the file to rename.sNewFileName
- new file name. This name must not contain a directory path.
public static final long FileSize(java.lang.String sFilePath)
sFilePath
- path name of the file to get the size of.
public static final long FileSize(long lFileHandle)
lFileHandle
- handle to the file returned by FileOpen().
public static final long FileSeek(long lFileHandle, long lPos)
After FileSeek() is successfully called, subsequent read or write operations begin at the byte number specified by lPos.
lFileHandle
- handle to the file returned by FileOpen().lPos
- The byte position to set the file pointer (0 = beginning of file, -1 = end of file)
public static final long FileWrite(long lFileHandle, java.lang.String sBuffer, long lBufLen)
The data will overwrite or append to the current contents of the file depending on the current position of the file pointer.
lFileHandle
- handle to the file returned by FileOpen().sBuffer
- buffer containing the data to write.lBufLen
- number of bytes to write.
public static final long FileWriteLine(long lFileHandle, java.lang.String sBuffer, long lLineLen)
A
lFileHandle
- handle to the file returned by FileOpen().sBuffer
- buffer containing the data to write.lLineLen
- number of bytes to write.
public static final boolean deleteDir(java.io.File dir)
dir
-
public static final java.lang.String getUserDirectory(java.lang.String path)
path
- String to check for user directory (can be null or empty)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |