public class Rapi extends Object
Modifier and Type | Field and Description |
---|---|
static int |
FOLDER_BITBUCKET |
static int |
FOLDER_CONTROLS |
static int |
FOLDER_DESKTOP |
static int |
FOLDER_DESKTOPDIRECTORY |
static int |
FOLDER_DRIVES |
static int |
FOLDER_FAVORITES |
static int |
FOLDER_FONTS |
static int |
FOLDER_NETHOOD |
static int |
FOLDER_NETWORK |
static int |
FOLDER_PERSONAL |
static int |
FOLDER_PRINTERS |
static int |
FOLDER_PROGRAMS |
static int |
FOLDER_RECENT |
static int |
FOLDER_SENDTO |
static int |
FOLDER_STARTMENU |
static int |
FOLDER_STARTUP |
static int |
FOLDER_TEMPLATES |
static int |
FOLDER_WINDOWS |
Constructor and Description |
---|
Rapi() |
Modifier and Type | Method and Description |
---|---|
static void |
close()
Close the connection.
|
static void |
connect(int timeoutMillis)
Attempt to connect to a device.
|
static void |
createShortcut(String target,
String arguments,
String shortcutPath)
Create a shortcut to a target.
|
static void |
execute(String path,
String parameters)
Send an execute command to the remote device.
|
static FileSpecs |
getFileSpecs(String fileName,
FileSpecs destination)
Get the FileSpecs for an individual file.
|
static void |
getFileSpecs(Vector fileNames,
Vector specs)
Get the FileSpecs for a list of file names.
|
static String |
getSpecialFolder(int folder) |
static SystemInfo |
getSystemInfo()
Return the SystemInfo for the connected system.
|
static void |
initializeLibrary() |
static int |
listAllFiles(String directoryPath,
String mask,
Vector specs,
boolean includeFiles,
boolean includeDirectories,
boolean dontIncludeHidden)
List all files in a directory that match the mask.
|
static boolean |
tryConnect(int timeoutInMillis)
A simplified method that initializes the library and makes a connection
if possible.
|
public static final int FOLDER_WINDOWS
public static final int FOLDER_DESKTOP
public static final int FOLDER_PROGRAMS
public static final int FOLDER_CONTROLS
public static final int FOLDER_PRINTERS
public static final int FOLDER_PERSONAL
public static final int FOLDER_FAVORITES
public static final int FOLDER_STARTUP
public static final int FOLDER_RECENT
public static final int FOLDER_SENDTO
public static final int FOLDER_BITBUCKET
public static final int FOLDER_STARTMENU
public static final int FOLDER_DESKTOPDIRECTORY
public static final int FOLDER_DRIVES
public static final int FOLDER_NETWORK
public static final int FOLDER_NETHOOD
public static final int FOLDER_FONTS
public static final int FOLDER_TEMPLATES
public static void connect(int timeoutMillis) throws RapiException
timeoutMillis
- the maximum time to wait for a successful connection.RapiException
- if the connection failed.public static void close() throws RapiException
RapiException
public static void getFileSpecs(Vector fileNames, Vector specs) throws RapiException
fileNames
- a Vector holding a list of file names.specs
- a destination Vector that will be made to hold one FileSpecs for
each item in fileNames. If specs
already contains FileSpecs objects they are reused starting from the first one.
The size of the vector is never made less, only bigger so that it is always at
least as big as the fileNames Vector. If any item within this size is not a FileSpecs
Object it is discarded and a new FileSpecs object is created and used instead.RapiException
public static int listAllFiles(String directoryPath, String mask, Vector specs, boolean includeFiles, boolean includeDirectories, boolean dontIncludeHidden) throws RapiException
directoryPath
- the full path of the directory to list.mask
- the mask for the function to use. If this is null then *.* will be used.specs
- a destination Vector that will be made to hold one FileSpecs for
each entry found.
If specs already contains FileSpecs objects they are reused starting from the first one.
The size of the vector is never made less, only bigger so that it is always at
least as big as the number of files found. If any item within this size is not a FileSpecs
Object it is discarded and a new FileSpecs object is created and used instead.
The name field of each FileSpecs holds ONLY the name within the directory, not the full path.
includeFiles
- true to include regular (non-directory) files.includeDirectories
- true to include directories.dontIncludeHidden
- true to exclude hidden files.RapiException
- on a RAPI error.public static void execute(String path, String parameters) throws RapiException
path
- the path of the executable on the remote device.parameters
- parameters for executing the command.RapiException
- on error.public static void initializeLibrary() throws RapiException
RapiException
public static boolean tryConnect(int timeoutInMillis)
timeoutInMillis
- a timeout for the connection attempt in milliseconds.public static SystemInfo getSystemInfo() throws RapiException
RapiException
public static FileSpecs getFileSpecs(String fileName, FileSpecs destination) throws RapiException
fileName
- the full path for the file on the device.destination
- a destination FileSpecs or null to create and return a new one.RapiException
- on a RAPI error.public static String getSpecialFolder(int folder) throws RapiException
RapiException
public static void createShortcut(String target, String arguments, String shortcutPath) throws RapiException
target
- the target executable.arguments
- the arguments for the executable.shortcutPath
- the full path for the shortcut. WindowsCE uses
a .lnk extension for a shortcut. If you do not provide an extension
for the shortcutPath then .lnk is added to it. If a '.' exists in
the path, then .lnk is NOT added.RapiException
- if there was a RAPI error.