home *** CD-ROM | disk | FTP | other *** search
- package java.lang;
-
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.OutputStream;
- import java.util.StringTokenizer;
-
- public class Runtime {
- private static Runtime currentRuntime = new Runtime();
- private String[] paths;
-
- public static Runtime getRuntime() {
- return currentRuntime;
- }
-
- private Runtime() {
- }
-
- private native void exitInternal(int var1);
-
- public void exit(int status) {
- SecurityManager.checksExit(status);
- this.exitInternal(status);
- }
-
- private native Process execInternal(String[] var1, String[] var2) throws IOException;
-
- public Process exec(String command) throws IOException {
- return this.exec((String)command, (String[])null);
- }
-
- public Process exec(String command, String[] envp) throws IOException {
- int count = 0;
- StringTokenizer st = new StringTokenizer(command);
- count = st.countTokens();
- String[] cmdarray = new String[count];
- st = new StringTokenizer(command);
-
- for(int var7 = 0; st.hasMoreTokens(); cmdarray[var7++] = st.nextToken()) {
- }
-
- SecurityManager.checksExec(cmdarray[0]);
- return this.execInternal(cmdarray, envp);
- }
-
- public Process exec(String[] cmdarray) throws IOException {
- return this.exec((String[])cmdarray, (String[])null);
- }
-
- public Process exec(String[] cmdarray, String[] envp) throws IOException {
- SecurityManager.checksExec(cmdarray[0]);
- return this.execInternal(cmdarray, envp);
- }
-
- public native long freeMemory();
-
- public native long totalMemory();
-
- public native void gc();
-
- public native void runFinalization();
-
- public native void traceInstructions(boolean var1);
-
- public native void traceMethodCalls(boolean var1);
-
- private synchronized native String initializeLinkerInternal();
-
- private native String buildLibName(String var1, String var2);
-
- private native boolean loadFileInternal(String var1);
-
- private void initializeLinker() {
- String ldpath = this.initializeLinkerInternal();
- char c = System.getProperty("path.separator").charAt(0);
- int ldlen = ldpath.length();
- int i = ldpath.indexOf(c);
-
- int n;
- for(n = 0; i >= 0; i = ldpath.indexOf(c, i + 1)) {
- ++n;
- }
-
- this.paths = new String[n + 1];
- i = 0;
- n = 0;
-
- for(int j = ldpath.indexOf(c); j >= 0; j = ldpath.indexOf(c, i)) {
- if (j - i > 0) {
- this.paths[n++] = ldpath.substring(i, j);
- }
-
- i = j + 1;
- }
-
- this.paths[n] = ldpath.substring(i, ldlen);
- }
-
- public synchronized void load(String filename) {
- SecurityManager.checksLink(filename, 1);
- if (!this.loadFileInternal(filename)) {
- throw new UnsatisfiedLinkError(filename);
- }
- }
-
- public synchronized void loadLibrary(String libname) {
- SecurityManager.checksLink(libname, 1);
- if (this.paths == null) {
- this.initializeLinker();
- }
-
- for(int i = 0; i < this.paths.length; ++i) {
- String tempname = this.buildLibName(this.paths[i], libname);
- if (this.loadFileInternal(tempname)) {
- return;
- }
- }
-
- throw new UnsatisfiedLinkError("no " + libname + " in shared library path");
- }
-
- public InputStream getLocalizedInputStream(InputStream in) {
- return in;
- }
-
- public OutputStream getLocalizedOutputStream(OutputStream out) {
- return out;
- }
- }
-