home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / java / lang / Runtime.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  3.8 KB  |  171 lines

  1. package java.lang;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5. import java.io.InputStream;
  6. import java.io.OutputStream;
  7. import java.util.StringTokenizer;
  8.  
  9. public class Runtime {
  10.    private static Runtime currentRuntime = new Runtime();
  11.  
  12.    public static Runtime getRuntime() {
  13.       return currentRuntime;
  14.    }
  15.  
  16.    private Runtime() {
  17.    }
  18.  
  19.    public void exit(int var1) {
  20.       SecurityManager var2 = System.getSecurityManager();
  21.       if (var2 != null) {
  22.          var2.checkExit(var1);
  23.       }
  24.  
  25.       Shutdown.exit(var1);
  26.    }
  27.  
  28.    public void addShutdownHook(Thread var1) {
  29.       SecurityManager var2 = System.getSecurityManager();
  30.       if (var2 != null) {
  31.          var2.checkPermission(new RuntimePermission("shutdownHooks"));
  32.       }
  33.  
  34.       ApplicationShutdownHooks.add(var1);
  35.    }
  36.  
  37.    public boolean removeShutdownHook(Thread var1) {
  38.       SecurityManager var2 = System.getSecurityManager();
  39.       if (var2 != null) {
  40.          var2.checkPermission(new RuntimePermission("shutdownHooks"));
  41.       }
  42.  
  43.       return ApplicationShutdownHooks.remove(var1);
  44.    }
  45.  
  46.    public void halt(int var1) {
  47.       SecurityManager var2 = System.getSecurityManager();
  48.       if (var2 != null) {
  49.          var2.checkExit(var1);
  50.       }
  51.  
  52.       Shutdown.halt(var1);
  53.    }
  54.  
  55.    /** @deprecated */
  56.    @Deprecated
  57.    public static void runFinalizersOnExit(boolean var0) {
  58.       SecurityManager var1 = System.getSecurityManager();
  59.       if (var1 != null) {
  60.          try {
  61.             var1.checkExit(0);
  62.          } catch (SecurityException var3) {
  63.             throw new SecurityException("runFinalizersOnExit");
  64.          }
  65.       }
  66.  
  67.       Shutdown.setRunFinalizersOnExit(var0);
  68.    }
  69.  
  70.    public Process exec(String var1) throws IOException {
  71.       return this.exec((String)var1, (String[])null, (File)null);
  72.    }
  73.  
  74.    public Process exec(String var1, String[] var2) throws IOException {
  75.       return this.exec((String)var1, var2, (File)null);
  76.    }
  77.  
  78.    public Process exec(String var1, String[] var2, File var3) throws IOException {
  79.       if (var1.length() == 0) {
  80.          throw new IllegalArgumentException("Empty command");
  81.       } else {
  82.          StringTokenizer var4 = new StringTokenizer(var1);
  83.          String[] var5 = new String[var4.countTokens()];
  84.  
  85.          for(int var6 = 0; var4.hasMoreTokens(); ++var6) {
  86.             var5[var6] = var4.nextToken();
  87.          }
  88.  
  89.          return this.exec(var5, var2, var3);
  90.       }
  91.    }
  92.  
  93.    public Process exec(String[] var1) throws IOException {
  94.       return this.exec((String[])var1, (String[])null, (File)null);
  95.    }
  96.  
  97.    public Process exec(String[] var1, String[] var2) throws IOException {
  98.       return this.exec((String[])var1, var2, (File)null);
  99.    }
  100.  
  101.    public Process exec(String[] var1, String[] var2, File var3) throws IOException {
  102.       return (new ProcessBuilder(var1)).environment(var2).directory(var3).start();
  103.    }
  104.  
  105.    public native int availableProcessors();
  106.  
  107.    public native long freeMemory();
  108.  
  109.    public native long totalMemory();
  110.  
  111.    public native long maxMemory();
  112.  
  113.    public native void gc();
  114.  
  115.    private static native void runFinalization0();
  116.  
  117.    public void runFinalization() {
  118.       runFinalization0();
  119.    }
  120.  
  121.    public native void traceInstructions(boolean var1);
  122.  
  123.    public native void traceMethodCalls(boolean var1);
  124.  
  125.    public void load(String var1) {
  126.       this.load0(System.getCallerClass(), var1);
  127.    }
  128.  
  129.    synchronized void load0(Class var1, String var2) {
  130.       SecurityManager var3 = System.getSecurityManager();
  131.       if (var3 != null) {
  132.          var3.checkLink(var2);
  133.       }
  134.  
  135.       if (!(new File(var2)).isAbsolute()) {
  136.          throw new UnsatisfiedLinkError("Expecting an absolute path of the library: " + var2);
  137.       } else {
  138.          ClassLoader.loadLibrary(var1, var2, true);
  139.       }
  140.    }
  141.  
  142.    public void loadLibrary(String var1) {
  143.       this.loadLibrary0(System.getCallerClass(), var1);
  144.    }
  145.  
  146.    synchronized void loadLibrary0(Class var1, String var2) {
  147.       SecurityManager var3 = System.getSecurityManager();
  148.       if (var3 != null) {
  149.          var3.checkLink(var2);
  150.       }
  151.  
  152.       if (var2.indexOf(File.separatorChar) != -1) {
  153.          throw new UnsatisfiedLinkError("Directory separator should not appear in library name: " + var2);
  154.       } else {
  155.          ClassLoader.loadLibrary(var1, var2, false);
  156.       }
  157.    }
  158.  
  159.    /** @deprecated */
  160.    @Deprecated
  161.    public InputStream getLocalizedInputStream(InputStream var1) {
  162.       return var1;
  163.    }
  164.  
  165.    /** @deprecated */
  166.    @Deprecated
  167.    public OutputStream getLocalizedOutputStream(OutputStream var1) {
  168.       return var1;
  169.    }
  170. }
  171.