initial checkin
[org.ibex.nanogoat.git] / System.jad
1 // Decompiled by Jad v1.5.7f. Copyright 2000 Pavel Kouznetsov.
2 // Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
3 // Decompiler options: packimports(3) 
4 // Source File Name:   System.java
5
6 package java.lang;
7
8 import java.io.*;
9 import java.util.*;
10
11 // Referenced classes of package java.lang:
12 //            Object, Runtime, RuntimePermission, SecurityManager, 
13 //            String, IllegalArgumentException, Error, StringBuffer
14
15 public final class System
16 {
17
18     private System()
19     {
20     }
21
22     public static void setIn(InputStream in)
23     {
24         SecurityManager sm = Runtime.securityManager;
25         if(sm != null)
26             sm.checkPermission(new RuntimePermission("setIO"));
27         setIn0(in);
28     }
29
30     public static void setOut(PrintStream out)
31     {
32         SecurityManager sm = Runtime.securityManager;
33         if(sm != null)
34             sm.checkPermission(new RuntimePermission("setIO"));
35         setOut0(out);
36     }
37
38     public static void setErr(PrintStream err)
39     {
40         SecurityManager sm = Runtime.securityManager;
41         if(sm != null)
42             sm.checkPermission(new RuntimePermission("setIO"));
43         setErr0(err);
44     }
45
46     public static synchronized void setSecurityManager(SecurityManager sm)
47     {
48         if(Runtime.securityManager != null)
49             Runtime.securityManager.checkPermission(new RuntimePermission("setSecurityManager"));
50         Runtime.securityManager = sm;
51     }
52
53     public static SecurityManager getSecurityManager()
54     {
55         return Runtime.securityManager;
56     }
57
58     public static native long currentTimeMillis();
59
60     public static native void arraycopy(Object obj, int i, Object obj1, int j, int k);
61
62     public static native int identityHashCode(Object obj);
63
64     public static Properties getProperties()
65     {
66         SecurityManager sm = Runtime.securityManager;
67         if(sm != null)
68             sm.checkPropertiesAccess();
69         return properties;
70     }
71
72     public static void setProperties(Properties properties)
73     {
74         SecurityManager sm = Runtime.securityManager;
75         if(sm != null)
76             sm.checkPropertiesAccess();
77         if(properties == null)
78             properties = (Properties)Runtime.defaultProperties.clone();
79         properties = properties;
80     }
81
82     public static String getProperty(String key)
83     {
84         SecurityManager sm = Runtime.securityManager;
85         if(sm != null)
86             sm.checkPropertyAccess(key);
87         else
88         if(key.length() == 0)
89             throw new IllegalArgumentException("key can't be empty");
90         return properties.getProperty(key);
91     }
92
93     public static String getProperty(String key, String def)
94     {
95         SecurityManager sm = Runtime.securityManager;
96         if(sm != null)
97             sm.checkPropertyAccess(key);
98         return properties.getProperty(key, def);
99     }
100
101     public static String setProperty(String key, String value)
102     {
103         SecurityManager sm = Runtime.securityManager;
104         if(sm != null)
105             sm.checkPermission(new PropertyPermission(key, "write"));
106         return (String)properties.setProperty(key, value);
107     }
108
109     public static String getenv(String name)
110     {
111         throw new Error("getenv no longer supported, use properties instead: " + name);
112     }
113
114     public static void exit(int status)
115     {
116         Runtime.getRuntime().exit(status);
117     }
118
119     public static void gc()
120     {
121         Runtime.getRuntime().gc();
122     }
123
124     public static void runFinalization()
125     {
126         Runtime.getRuntime().runFinalization();
127     }
128
129     public static void runFinalizersOnExit(boolean finalizeOnExit)
130     {
131         Runtime.getRuntime();
132     }
133
134     public static void load(String filename)
135     {
136         Runtime.getRuntime().load(filename);
137     }
138
139     public static void loadLibrary(String libname)
140     {
141         Runtime.getRuntime().loadLibrary(libname);
142     }
143
144     public static String mapLibraryName(String libname)
145     {
146         return Runtime.nativeGetLibname("", libname);
147     }
148
149     static native boolean isWordsBigEndian();
150
151     private static native void setIn0(InputStream inputstream);
152
153     private static native void setOut0(PrintStream printstream);
154
155     private static native void setErr0(PrintStream printstream);
156
157     private static Properties properties;
158     public static final InputStream in;
159     public static final PrintStream out;
160     public static final PrintStream err;
161
162     static 
163     {
164         Properties defaultProperties = Runtime.defaultProperties;
165         if(defaultProperties.get("gnu.classpath.home.url") == null)
166             defaultProperties.put("gnu.classpath.home.url", "file://" + defaultProperties.get("gnu.classpath.home") + "/lib");
167         if(defaultProperties.get("gnu.classpath.vm.shortname") == null)
168         {
169             String value = defaultProperties.getProperty("java.vm.name");
170             int index = value.lastIndexOf(32);
171             if(index != -1)
172                 value = value.substring(index + 1);
173             defaultProperties.put("gnu.classpath.vm.shortname", value);
174         }
175         defaultProperties.put("gnu.cpu.endian", isWordsBigEndian() ? "big" : "little");
176         if(defaultProperties.get("java.io.tmpdir") == null)
177             defaultProperties.put("java.io.tmpdir", defaultProperties.get("java.tmpdir"));
178         properties = (Properties)Runtime.defaultProperties.clone();
179         in = new BufferedInputStream(new FileInputStream(FileDescriptor.in));
180         out = new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.out)), true);
181         err = new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.err)), true);
182     }
183 }