home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / rt.jar / java / lang / System.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-23  |  3.8 KB  |  161 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.util.Properties;
  11.  
  12. public final class System {
  13.    // $FF: renamed from: in java.io.InputStream
  14.    public static final InputStream field_0 = nullInputStream();
  15.    public static final PrintStream out = nullPrintStream();
  16.    public static final PrintStream err = nullPrintStream();
  17.    private static SecurityManager security = null;
  18.    private static Properties props;
  19.  
  20.    private System() {
  21.    }
  22.  
  23.    public static void setIn(InputStream var0) {
  24.       checkIO();
  25.       setIn0(var0);
  26.    }
  27.  
  28.    public static void setOut(PrintStream var0) {
  29.       checkIO();
  30.       setOut0(var0);
  31.    }
  32.  
  33.    public static void setErr(PrintStream var0) {
  34.       checkIO();
  35.       setErr0(var0);
  36.    }
  37.  
  38.    private static void checkIO() {
  39.       if (security != null) {
  40.          security.checkExec("setio");
  41.       }
  42.  
  43.    }
  44.  
  45.    private static native void setIn0(InputStream var0);
  46.  
  47.    private static native void setOut0(PrintStream var0);
  48.  
  49.    private static native void setErr0(PrintStream var0);
  50.  
  51.    public static void setSecurityManager(SecurityManager var0) {
  52.       if (security != null) {
  53.          throw new SecurityException("SecurityManager already set");
  54.       } else {
  55.          security = var0;
  56.       }
  57.    }
  58.  
  59.    public static SecurityManager getSecurityManager() {
  60.       return security;
  61.    }
  62.  
  63.    public static native long currentTimeMillis();
  64.  
  65.    public static native void arraycopy(Object var0, int var1, Object var2, int var3, int var4);
  66.  
  67.    public static native int identityHashCode(Object var0);
  68.  
  69.    private static native Properties initProperties(Properties var0);
  70.  
  71.    public static Properties getProperties() {
  72.       if (security != null) {
  73.          security.checkPropertiesAccess();
  74.       }
  75.  
  76.       return props;
  77.    }
  78.  
  79.    public static void setProperties(Properties var0) {
  80.       if (security != null) {
  81.          security.checkPropertiesAccess();
  82.       }
  83.  
  84.       props = var0;
  85.    }
  86.  
  87.    public static String getProperty(String var0) {
  88.       if (security != null) {
  89.          security.checkPropertyAccess(var0);
  90.       }
  91.  
  92.       return props.getProperty(var0);
  93.    }
  94.  
  95.    public static String getProperty(String var0, String var1) {
  96.       if (security != null) {
  97.          security.checkPropertyAccess(var0);
  98.       }
  99.  
  100.       return props.getProperty(var0, var1);
  101.    }
  102.  
  103.    /** @deprecated */
  104.    public static String getenv(String var0) {
  105.       throw new Error("getenv no longer supported, use properties and -D instead: " + var0);
  106.    }
  107.  
  108.    public static void exit(int var0) {
  109.       Runtime.getRuntime().exit(var0);
  110.    }
  111.  
  112.    // $FF: renamed from: gc () void
  113.    public static void method_0() {
  114.       Runtime.getRuntime().gc();
  115.    }
  116.  
  117.    public static void runFinalization() {
  118.       Runtime.getRuntime().runFinalization();
  119.    }
  120.  
  121.    public static void runFinalizersOnExit(boolean var0) {
  122.       Runtime.getRuntime();
  123.       Runtime.runFinalizersOnExit(var0);
  124.    }
  125.  
  126.    public static void load(String var0) {
  127.       Runtime.getRuntime().load(var0);
  128.    }
  129.  
  130.    public static void loadLibrary(String var0) {
  131.       Runtime.getRuntime().loadLibrary(var0);
  132.    }
  133.  
  134.    private static InputStream nullInputStream() throws NullPointerException {
  135.       if (currentTimeMillis() > 0L) {
  136.          return null;
  137.       } else {
  138.          throw new NullPointerException();
  139.       }
  140.    }
  141.  
  142.    private static PrintStream nullPrintStream() throws NullPointerException {
  143.       if (currentTimeMillis() > 0L) {
  144.          return null;
  145.       } else {
  146.          throw new NullPointerException();
  147.       }
  148.    }
  149.  
  150.    private static void initializeSystemClass() {
  151.       props = new Properties();
  152.       initProperties(props);
  153.       FileInputStream var0 = new FileInputStream(FileDescriptor.in);
  154.       FileOutputStream var1 = new FileOutputStream(FileDescriptor.out);
  155.       FileOutputStream var2 = new FileOutputStream(FileDescriptor.err);
  156.       setIn0(new BufferedInputStream(var0));
  157.       setOut0(new PrintStream(new BufferedOutputStream(var1, 128), true));
  158.       setErr0(new PrintStream(new BufferedOutputStream(var2, 128), true));
  159.    }
  160. }
  161.