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 / System.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  6.3 KB  |  290 lines

  1. package java.lang;
  2.  
  3. import java.io.BufferedInputStream;
  4. import java.io.BufferedOutputStream;
  5. import java.io.Console;
  6. import java.io.FileDescriptor;
  7. import java.io.FileInputStream;
  8. import java.io.FileOutputStream;
  9. import java.io.IOException;
  10. import java.io.InputStream;
  11. import java.io.PrintStream;
  12. import java.nio.channels.Channel;
  13. import java.nio.channels.spi.SelectorProvider;
  14. import java.security.AccessController;
  15. import java.util.Map;
  16. import java.util.Properties;
  17. import java.util.PropertyPermission;
  18. import sun.misc.SharedSecrets;
  19. import sun.misc.VM;
  20. import sun.misc.Version;
  21. import sun.net.InetAddressCachePolicy;
  22. import sun.reflect.Reflection;
  23.  
  24. public final class System {
  25.    // $FF: renamed from: in java.io.InputStream
  26.    public static final InputStream field_0;
  27.    public static final PrintStream out;
  28.    public static final PrintStream err;
  29.    private static volatile SecurityManager security;
  30.    private static volatile Console cons;
  31.    private static Properties props;
  32.  
  33.    private static native void registerNatives();
  34.  
  35.    private System() {
  36.    }
  37.  
  38.    public static void setIn(InputStream var0) {
  39.       checkIO();
  40.       setIn0(var0);
  41.    }
  42.  
  43.    public static void setOut(PrintStream var0) {
  44.       checkIO();
  45.       setOut0(var0);
  46.    }
  47.  
  48.    public static void setErr(PrintStream var0) {
  49.       checkIO();
  50.       setErr0(var0);
  51.    }
  52.  
  53.    public static Console console() {
  54.       if (cons == null) {
  55.          synchronized(System.class) {
  56.             cons = SharedSecrets.getJavaIOAccess().console();
  57.          }
  58.       }
  59.  
  60.       return cons;
  61.    }
  62.  
  63.    public static Channel inheritedChannel() throws IOException {
  64.       return SelectorProvider.provider().inheritedChannel();
  65.    }
  66.  
  67.    private static void checkIO() {
  68.       SecurityManager var0 = getSecurityManager();
  69.       if (var0 != null) {
  70.          var0.checkPermission(new RuntimePermission("setIO"));
  71.       }
  72.  
  73.    }
  74.  
  75.    private static native void setIn0(InputStream var0);
  76.  
  77.    private static native void setOut0(PrintStream var0);
  78.  
  79.    private static native void setErr0(PrintStream var0);
  80.  
  81.    public static void setSecurityManager(SecurityManager var0) {
  82.       try {
  83.          var0.checkPackageAccess("java.lang");
  84.       } catch (Exception var2) {
  85.       }
  86.  
  87.       setSecurityManager0(var0);
  88.    }
  89.  
  90.    private static synchronized void setSecurityManager0(SecurityManager var0) {
  91.       SecurityManager var1 = getSecurityManager();
  92.       if (var1 != null) {
  93.          var1.checkPermission(new RuntimePermission("setSecurityManager"));
  94.       }
  95.  
  96.       if (var0 != null && var0.getClass().getClassLoader() != null) {
  97.          AccessController.doPrivileged(new 1(var0));
  98.       }
  99.  
  100.       security = var0;
  101.       InetAddressCachePolicy.setIfNotSet(-1);
  102.    }
  103.  
  104.    public static SecurityManager getSecurityManager() {
  105.       return security;
  106.    }
  107.  
  108.    public static native long currentTimeMillis();
  109.  
  110.    public static native long nanoTime();
  111.  
  112.    public static native void arraycopy(Object var0, int var1, Object var2, int var3, int var4);
  113.  
  114.    public static native int identityHashCode(Object var0);
  115.  
  116.    private static native Properties initProperties(Properties var0);
  117.  
  118.    public static Properties getProperties() {
  119.       SecurityManager var0 = getSecurityManager();
  120.       if (var0 != null) {
  121.          var0.checkPropertiesAccess();
  122.       }
  123.  
  124.       return props;
  125.    }
  126.  
  127.    public static void setProperties(Properties var0) {
  128.       SecurityManager var1 = getSecurityManager();
  129.       if (var1 != null) {
  130.          var1.checkPropertiesAccess();
  131.       }
  132.  
  133.       if (var0 == null) {
  134.          var0 = new Properties();
  135.          initProperties(var0);
  136.       }
  137.  
  138.       props = var0;
  139.    }
  140.  
  141.    public static String getProperty(String var0) {
  142.       checkKey(var0);
  143.       SecurityManager var1 = getSecurityManager();
  144.       if (var1 != null) {
  145.          var1.checkPropertyAccess(var0);
  146.       }
  147.  
  148.       return props.getProperty(var0);
  149.    }
  150.  
  151.    public static String getProperty(String var0, String var1) {
  152.       checkKey(var0);
  153.       SecurityManager var2 = getSecurityManager();
  154.       if (var2 != null) {
  155.          var2.checkPropertyAccess(var0);
  156.       }
  157.  
  158.       return props.getProperty(var0, var1);
  159.    }
  160.  
  161.    public static String setProperty(String var0, String var1) {
  162.       checkKey(var0);
  163.       SecurityManager var2 = getSecurityManager();
  164.       if (var2 != null) {
  165.          var2.checkPermission(new PropertyPermission(var0, "write"));
  166.       }
  167.  
  168.       return (String)props.setProperty(var0, var1);
  169.    }
  170.  
  171.    public static String clearProperty(String var0) {
  172.       checkKey(var0);
  173.       SecurityManager var1 = getSecurityManager();
  174.       if (var1 != null) {
  175.          var1.checkPermission(new PropertyPermission(var0, "write"));
  176.       }
  177.  
  178.       return (String)props.remove(var0);
  179.    }
  180.  
  181.    private static void checkKey(String var0) {
  182.       if (var0 == null) {
  183.          throw new NullPointerException("key can't be null");
  184.       } else if (var0.equals("")) {
  185.          throw new IllegalArgumentException("key can't be empty");
  186.       }
  187.    }
  188.  
  189.    public static String getenv(String var0) {
  190.       SecurityManager var1 = getSecurityManager();
  191.       if (var1 != null) {
  192.          var1.checkPermission(new RuntimePermission("getenv." + var0));
  193.       }
  194.  
  195.       return ProcessEnvironment.getenv(var0);
  196.    }
  197.  
  198.    public static Map<String, String> getenv() {
  199.       SecurityManager var0 = getSecurityManager();
  200.       if (var0 != null) {
  201.          var0.checkPermission(new RuntimePermission("getenv.*"));
  202.       }
  203.  
  204.       return ProcessEnvironment.getenv();
  205.    }
  206.  
  207.    public static void exit(int var0) {
  208.       Runtime.getRuntime().exit(var0);
  209.    }
  210.  
  211.    // $FF: renamed from: gc () void
  212.    public static void method_0() {
  213.       Runtime.getRuntime().gc();
  214.    }
  215.  
  216.    public static void runFinalization() {
  217.       Runtime.getRuntime().runFinalization();
  218.    }
  219.  
  220.    /** @deprecated */
  221.    @Deprecated
  222.    public static void runFinalizersOnExit(boolean var0) {
  223.       Runtime.getRuntime();
  224.       Runtime.runFinalizersOnExit(var0);
  225.    }
  226.  
  227.    public static void load(String var0) {
  228.       Runtime.getRuntime().load0(getCallerClass(), var0);
  229.    }
  230.  
  231.    public static void loadLibrary(String var0) {
  232.       Runtime.getRuntime().loadLibrary0(getCallerClass(), var0);
  233.    }
  234.  
  235.    public static native String mapLibraryName(String var0);
  236.  
  237.    private static InputStream nullInputStream() throws NullPointerException {
  238.       if (currentTimeMillis() > 0L) {
  239.          return null;
  240.       } else {
  241.          throw new NullPointerException();
  242.       }
  243.    }
  244.  
  245.    private static PrintStream nullPrintStream() throws NullPointerException {
  246.       if (currentTimeMillis() > 0L) {
  247.          return null;
  248.       } else {
  249.          throw new NullPointerException();
  250.       }
  251.    }
  252.  
  253.    private static void initializeSystemClass() {
  254.       props = new Properties();
  255.       initProperties(props);
  256.       Version.init();
  257.       FileInputStream var0 = new FileInputStream(FileDescriptor.in);
  258.       FileOutputStream var1 = new FileOutputStream(FileDescriptor.out);
  259.       FileOutputStream var2 = new FileOutputStream(FileDescriptor.err);
  260.       setIn0(new BufferedInputStream(var0));
  261.       setOut0(new PrintStream(new BufferedOutputStream(var1, 128), true));
  262.       setErr0(new PrintStream(new BufferedOutputStream(var2, 128), true));
  263.       loadLibrary("zip");
  264.       Terminator.setup();
  265.       Shutdown.add(SharedSecrets.getJavaIOAccess().consoleRestoreHook());
  266.       Shutdown.add(ApplicationShutdownHooks.hook());
  267.       Shutdown.add(SharedSecrets.getJavaIODeleteOnExitAccess());
  268.       VM.initializeOSEnvironment();
  269.       VM.maxDirectMemory();
  270.       VM.allowArraySyntax();
  271.       VM.booted();
  272.       Thread var3 = Thread.currentThread();
  273.       var3.getThreadGroup().add(var3);
  274.       SharedSecrets.setJavaLangAccess(new 2());
  275.    }
  276.  
  277.    static Class getCallerClass() {
  278.       return Reflection.getCallerClass(3);
  279.    }
  280.  
  281.    static {
  282.       registerNatives();
  283.       field_0 = nullInputStream();
  284.       out = nullPrintStream();
  285.       err = nullPrintStream();
  286.       security = null;
  287.       cons = null;
  288.    }
  289. }
  290.