home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / java / lang / System.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  4.6 KB  |  224 lines

  1. package java.lang;
  2.  
  3. import java.io.BufferedInputStream;
  4. import java.io.BufferedOutputStream;
  5. import java.io.FileDescriptor;
  6. import java.io.FileInputStream;
  7. import java.io.FileOutputStream;
  8. import java.io.InputStream;
  9. import java.io.PrintStream;
  10. import java.security.AccessController;
  11. import java.util.Properties;
  12. import java.util.PropertyPermission;
  13. import sun.misc.Version;
  14. import sun.net.InetAddressCachePolicy;
  15.  
  16. public final class System {
  17.    // $FF: renamed from: in java.io.InputStream
  18.    public static final InputStream field_0;
  19.    public static final PrintStream out;
  20.    public static final PrintStream err;
  21.    private static SecurityManager security;
  22.    private static Properties props;
  23.  
  24.    private static native void registerNatives();
  25.  
  26.    private System() {
  27.    }
  28.  
  29.    public static void setIn(InputStream var0) {
  30.       checkIO();
  31.       setIn0(var0);
  32.    }
  33.  
  34.    public static void setOut(PrintStream var0) {
  35.       checkIO();
  36.       setOut0(var0);
  37.    }
  38.  
  39.    public static void setErr(PrintStream var0) {
  40.       checkIO();
  41.       setErr0(var0);
  42.    }
  43.  
  44.    private static void checkIO() {
  45.       if (security != null) {
  46.          security.checkPermission(new RuntimePermission("setIO"));
  47.       }
  48.  
  49.    }
  50.  
  51.    private static native void setIn0(InputStream var0);
  52.  
  53.    private static native void setOut0(PrintStream var0);
  54.  
  55.    private static native void setErr0(PrintStream var0);
  56.  
  57.    public static void setSecurityManager(SecurityManager var0) {
  58.       try {
  59.          var0.checkPackageAccess("java.lang");
  60.       } catch (Exception var2) {
  61.       }
  62.  
  63.       setSecurityManager0(var0);
  64.    }
  65.  
  66.    private static synchronized void setSecurityManager0(SecurityManager var0) {
  67.       if (security != null) {
  68.          security.checkPermission(new RuntimePermission("setSecurityManager"));
  69.       }
  70.  
  71.       if (var0 != null && var0.getClass().getClassLoader() != null) {
  72.          AccessController.doPrivileged(new 1(var0));
  73.       }
  74.  
  75.       security = var0;
  76.       InetAddressCachePolicy.setIfNotSet(-1);
  77.    }
  78.  
  79.    public static SecurityManager getSecurityManager() {
  80.       return security;
  81.    }
  82.  
  83.    public static native long currentTimeMillis();
  84.  
  85.    public static native void arraycopy(Object var0, int var1, Object var2, int var3, int var4);
  86.  
  87.    public static native int identityHashCode(Object var0);
  88.  
  89.    private static native Properties initProperties(Properties var0);
  90.  
  91.    public static Properties getProperties() {
  92.       if (security != null) {
  93.          security.checkPropertiesAccess();
  94.       }
  95.  
  96.       return props;
  97.    }
  98.  
  99.    public static void setProperties(Properties var0) {
  100.       if (security != null) {
  101.          security.checkPropertiesAccess();
  102.       }
  103.  
  104.       if (var0 == null) {
  105.          var0 = new Properties();
  106.          initProperties(var0);
  107.       }
  108.  
  109.       props = var0;
  110.    }
  111.  
  112.    public static String getProperty(String var0) {
  113.       if (var0 == null) {
  114.          throw new NullPointerException("key can't be null");
  115.       } else if (var0.equals("")) {
  116.          throw new IllegalArgumentException("key can't be empty");
  117.       } else {
  118.          if (security != null) {
  119.             security.checkPropertyAccess(var0);
  120.          }
  121.  
  122.          return props.getProperty(var0);
  123.       }
  124.    }
  125.  
  126.    public static String getProperty(String var0, String var1) {
  127.       if (var0 == null) {
  128.          throw new NullPointerException("key can't be null");
  129.       } else if (var0.equals("")) {
  130.          throw new IllegalArgumentException("key can't be empty");
  131.       } else {
  132.          if (security != null) {
  133.             security.checkPropertyAccess(var0);
  134.          }
  135.  
  136.          return props.getProperty(var0, var1);
  137.       }
  138.    }
  139.  
  140.    public static String setProperty(String var0, String var1) {
  141.       if (var0 == null) {
  142.          throw new NullPointerException("key can't be null");
  143.       } else if (var0.equals("")) {
  144.          throw new IllegalArgumentException("key can't be empty");
  145.       } else {
  146.          if (security != null) {
  147.             security.checkPermission(new PropertyPermission(var0, "write"));
  148.          }
  149.  
  150.          return (String)props.setProperty(var0, var1);
  151.       }
  152.    }
  153.  
  154.    public static String getenv(String var0) {
  155.       throw new Error("getenv no longer supported, use properties and -D instead: " + var0);
  156.    }
  157.  
  158.    public static void exit(int var0) {
  159.       Runtime.getRuntime().exit(var0);
  160.    }
  161.  
  162.    // $FF: renamed from: gc () void
  163.    public static void method_0() {
  164.       Runtime.getRuntime().gc();
  165.    }
  166.  
  167.    public static void runFinalization() {
  168.       Runtime.getRuntime().runFinalization();
  169.    }
  170.  
  171.    public static void runFinalizersOnExit(boolean var0) {
  172.       Runtime.getRuntime();
  173.       Runtime.runFinalizersOnExit(var0);
  174.    }
  175.  
  176.    public static void load(String var0) {
  177.       Runtime.getRuntime().load0(getCallerClass(), var0);
  178.    }
  179.  
  180.    public static void loadLibrary(String var0) {
  181.       Runtime.getRuntime().loadLibrary0(getCallerClass(), var0);
  182.    }
  183.  
  184.    public static native String mapLibraryName(String var0);
  185.  
  186.    private static InputStream nullInputStream() throws NullPointerException {
  187.       if (currentTimeMillis() > 0L) {
  188.          return null;
  189.       } else {
  190.          throw new NullPointerException();
  191.       }
  192.    }
  193.  
  194.    private static PrintStream nullPrintStream() throws NullPointerException {
  195.       if (currentTimeMillis() > 0L) {
  196.          return null;
  197.       } else {
  198.          throw new NullPointerException();
  199.       }
  200.    }
  201.  
  202.    private static void initializeSystemClass() {
  203.       props = new Properties();
  204.       initProperties(props);
  205.       Version.init();
  206.       FileInputStream var0 = new FileInputStream(FileDescriptor.in);
  207.       FileOutputStream var1 = new FileOutputStream(FileDescriptor.out);
  208.       FileOutputStream var2 = new FileOutputStream(FileDescriptor.err);
  209.       setIn0(new BufferedInputStream(var0));
  210.       setOut0(new PrintStream(new BufferedOutputStream(var1, 128), true));
  211.       setErr0(new PrintStream(new BufferedOutputStream(var2, 128), true));
  212.    }
  213.  
  214.    static native Class getCallerClass();
  215.  
  216.    static {
  217.       registerNatives();
  218.       field_0 = nullInputStream();
  219.       out = nullPrintStream();
  220.       err = nullPrintStream();
  221.       security = null;
  222.    }
  223. }
  224.