|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.tuneology.avm.Native
This class extends the System and Runtime classes to provide extra functionality.
Inner Class Summary | |
static interface |
Native.LineReader
This class gets called for each line of output generated by the program. |
static interface |
Native.Logger
This class is called for each line of output generated by a shell program. |
Field Summary | |
static java.lang.String |
distName
For linux, contains the name and version of the distribution. |
static boolean |
isLinux
True if the jvm is running on Linux. |
static boolean |
isOSX
True if the jvm is running on OS X. |
static boolean |
isSolaris
True if the jvm is running on Solaris. |
static boolean |
isWindows
True if the jvm is running on some sort of Windows. |
static java.lang.String |
version
Contains the version information for java-avm. |
Method Summary | |
static void |
addEnv(java.lang.String key,
java.lang.String val)
Adds the string to the value of the environment variable. |
static java.lang.Process |
exec(java.util.ArrayList v)
|
static java.lang.Process |
exec(java.lang.String[] cmd)
|
static java.lang.String |
getArgString(java.util.ArrayList cmd)
Returns the list of arguments quoted in a single string, for logging purposes. |
static java.lang.String |
getArgString(java.lang.String[] cmd)
Returns the list of arguments quoted in a single string, for logging purposes. |
static java.util.ArrayList |
getMkfifoCmd()
Returns the mkfifo command. |
static int |
getpid()
|
static java.io.File |
getPreferredTempDirectory()
Returns the directory for storing temp files. |
static java.io.File |
getPrefsDirectory()
Returns the directory for storing preferences files. |
static java.net.URL |
getResource(java.lang.String key)
|
static java.lang.String |
getResourceString(java.lang.String str)
Returns a string from the resource bundle. |
static java.lang.String[] |
getStringArray(java.util.ArrayList v)
Takes a vector of strings and creates an array of strings. |
static java.io.File |
getTrashDirectory()
Return the trash directory. |
static boolean |
isExecutable(java.lang.String path)
Returns true if the pathname specifies an executable program. |
static void |
mkfifo(java.io.File f)
For Unix only: executes the mkfifo command. |
static void |
openBrowserWindow(java.lang.String url)
|
static java.util.ArrayList |
parseUserInput(java.lang.String str)
Parses the user input and returns it in the form of a vector of strings, ready to pass to runCommand. |
static void |
registerApplListener(ApplListener listener)
|
static void |
removeApplListener(ApplListener listener)
|
static int |
runCommand(java.util.ArrayList v,
java.io.File dir,
java.lang.String enc,
Native.LineReader lrdr,
boolean logOutput)
Runs the specified external program. |
static int |
runCommand(java.lang.String[] cmd,
java.io.File dir,
java.lang.String enc,
Native.LineReader lrdr,
boolean logOutput)
Runs the specified external program. |
static int |
runCommand(java.lang.String cmd,
java.io.File dir,
java.lang.String enc,
Native.LineReader lrdr,
boolean logOutput)
Runs the specified external program. |
static void |
setLibraryPath(java.lang.String libPath)
Adds this directory to the directories searched for libraries by subprocesses. |
static void |
setLogger(Native.Logger l)
All process I/O is logged to this interface. |
static void |
setMkfifoCmd(java.lang.String s)
Sets the shell command used for mkfifo. |
static void |
touch()
|
static java.lang.Class |
tryPlugin(java.lang.String className,
java.net.URL[] urls)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final boolean isWindows
public static final boolean isLinux
public static final boolean isSolaris
public static final boolean isOSX
public static final java.lang.String distName
public static final java.lang.String version
Method Detail |
public static java.lang.String getArgString(java.lang.String[] cmd)
cmd
- the argument array.public static java.lang.String getArgString(java.util.ArrayList cmd)
cmd
- the String arguments.public static java.util.ArrayList parseUserInput(java.lang.String str)
str
- The string to be parsed.public static int getpid()
public static java.lang.Process exec(java.util.ArrayList v) throws java.io.IOException
java.io.IOException
- public static java.lang.Process exec(java.lang.String[] cmd) throws java.io.IOException
java.io.IOException
- public static int runCommand(java.lang.String cmd, java.io.File dir, java.lang.String enc, Native.LineReader lrdr, boolean logOutput) throws java.lang.Exception
cmd
- the shell command to rundir
- the directory in which to run it, or null for the current directory.enc
- the character encoding to use in reading the process output, or null for the default.lrdr
- the line reader used to parse the user input (optional).logOutput
- true if the process's output is to be logged, false if its output is not to be logged.java.lang.Exception
- if an error occurspublic static int runCommand(java.util.ArrayList v, java.io.File dir, java.lang.String enc, Native.LineReader lrdr, boolean logOutput) throws java.lang.Exception
v
- The shell command to run, as a vector of strings.dir
- the directory in which to run it, or null for the current directory.enc
- the character encoding to use in reading the process output, or null for the default.lrdr
- the line reader used to parse the user input (optional).logOutput
- true if the process's output is to be logged, false if its output is not to be logged.java.lang.Exception
- if an error occurspublic static int runCommand(java.lang.String[] cmd, java.io.File dir, java.lang.String enc, Native.LineReader lrdr, boolean logOutput) throws java.lang.Exception
cmd
- The shell command to run, as an array of strings.dir
- the directory in which to run it, or null for the current directory.enc
- the character encoding to use in reading the process output, or null for the default.lrdr
- the line reader used to parse the user input (optional).logOutput
- true if the process's output is to be logged, false if its output is not to be logged.java.lang.Exception
- if an error occurspublic static java.lang.String[] getStringArray(java.util.ArrayList v)
v
- A vector containing strings.public static void mkfifo(java.io.File f) throws java.lang.Exception
f
- the file pointing to the fifo to be created.java.lang.Exception
- If there was an error executing the mkfifo command.public static boolean isExecutable(java.lang.String path)
path
- A pathname.public static void setMkfifoCmd(java.lang.String s) throws java.io.IOException
s
- the mkfifo command.public static void setLogger(Native.Logger l)
l
- the logger object.public static java.lang.String getResourceString(java.lang.String str)
str
- the identifier for the string.public static java.net.URL getResource(java.lang.String key)
public static java.util.ArrayList getMkfifoCmd()
public static java.io.File getPreferredTempDirectory() throws java.io.FileNotFoundException
java.io.FileNotFoundException
- public static java.io.File getPrefsDirectory() throws java.io.FileNotFoundException
java.io.FileNotFoundException
- public static java.io.File getTrashDirectory() throws java.io.FileNotFoundException
java.io.FileNotFoundException
- public static void setLibraryPath(java.lang.String libPath)
libPath
- public static void addEnv(java.lang.String key, java.lang.String val)
key
- val
- public static void openBrowserWindow(java.lang.String url) throws java.io.IOException, java.lang.UnsupportedOperationException
url
- java.io.IOException
- public static void registerApplListener(ApplListener listener)
listener
- public static void removeApplListener(ApplListener listener)
listener
- public static void touch()
public static java.lang.Class tryPlugin(java.lang.String className, java.net.URL[] urls) throws java.lang.Throwable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |