Package totalcross.io.sync
Class RemoteFile
- java.lang.Object
-
- totalcross.io.sync.RemoteFile
-
public final class RemoteFile extends java.lang.ObjectAllows you to access a file on the device from the desktop during the conduit synchronization.
It may only be used on files stored using a file system, therefore, it cannot be used to handle files on the PalmOS internal memory. But you may use it to handle files on the device's built-in memory or an inserted external card.
-
-
Constructor Summary
Constructors Constructor Description RemoteFile()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancopyFromRemote(java.lang.String srcFile, java.lang.String dstFile)Copies a file from the remote device to the desktop.static booleancopyToRemote(java.lang.String srcFile, java.lang.String dstFile)Copies a file from the desktop to the remote device, creating the target folder if necessary.static booleandelete(java.lang.String fileOrFolder)Deletes a remote file or an empty folder.static intexec(java.lang.String command, java.lang.String args, int launchCode, boolean wait)Remotely executes the specified command on the connected device.static java.lang.String[]listFiles(java.lang.String folder)Lists the files contained in a folder.
The strings returned are the names of the files and directories contained within this folder.
-
-
-
Method Detail
-
listFiles
public static java.lang.String[] listFiles(java.lang.String folder)
Lists the files contained in a folder.
The strings returned are the names of the files and directories contained within this folder. This method returns null if the folder can't be read or if the operation fails. Path names ends with /, so it is easy to distinguish them from a file.
On Palm OS, passing an empty string will return all installed cards. The flash memory slot will be namedbuiltin(which is usually slot 1). Then, to copy to/from a slot, you must use slot:/full_path_to_file (E.G.: 1:/dbs/myapp/MyPDBFile.pdb).
-
copyToRemote
public static boolean copyToRemote(java.lang.String srcFile, java.lang.String dstFile)Copies a file from the desktop to the remote device, creating the target folder if necessary.- Parameters:
srcFile- The file on the desktop.dstFile- The target file on the remote device. Note: this CANNOT be a folder name, but the target file name instead.- Returns:
- true if the operation succeeds.
-
copyFromRemote
public static boolean copyFromRemote(java.lang.String srcFile, java.lang.String dstFile)Copies a file from the remote device to the desktop.- Parameters:
srcFile- The file on the remote device.dstFile- The target file on the desktop. Note: this CANNOT be a folder name, but the target file name instead.- Returns:
- true if the operation succeeds.
-
delete
public static boolean delete(java.lang.String fileOrFolder)
Deletes a remote file or an empty folder.- Returns:
- true if the operation succeeds.
-
exec
public static int exec(java.lang.String command, java.lang.String args, int launchCode, boolean wait)Remotely executes the specified command on the connected device. Works only on WinCE devices.
The arguments launchCode and wait are not used and their value is ignored. However, they may be used in the future so the usage of default values is recommended.- Parameters:
command- the command to executeargs- command argumentslaunchCode- ignored, use 0.wait- ignored, use false.- Returns:
- 0 if successful, otherwise a system specific error code is returned.
- Since:
- TotalCross 1.22
-
-