File: java.lang.System

package info (click to toggle)
bock 0.20.2.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,228 kB
  • ctags: 1,370
  • sloc: ansic: 7,367; java: 5,553; yacc: 963; lex: 392; makefile: 243; sh: 90; perl: 42
file content (132 lines) | stat: -rw-r--r-- 3,380 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// java.lang.System
// An implementation of the Java Language Specification section 20.18
// Written by Charles Briscoe-Smith; refer to the file LEGAL for details.

package java.lang;

import java.io.InputStream;
import java.io.PrintStream;

import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.BufferedOutputStream;

import java.util.Properties;

public final class System {

	private System() { }

	public static InputStream in=new FileInputStream(FileDescriptor.in);
	public static PrintStream out
		=new PrintStream(new BufferedOutputStream(
		                         new FileOutputStream(
		                                 FileDescriptor.out)),
		                 true);
	public static PrintStream err
		=new PrintStream(new FileOutputStream(FileDescriptor.err),
		                 true);

	private static SecurityManager secMan=null;

	public static SecurityManager getSecurityManager()
	{
		return secMan;
	}

	public static void setSecurityManager(SecurityManager sm)
			throws SecurityException
	{
		if (secMan!=null) throw new SecurityException();
		secMan=sm;
	}

	public static native long currentTimeMillis()
		"struct timeval tv;"
		"gettimeofday(&tv, 0L);"
		"return tv.tv_sec*1000+tv.tv_usec/1000;"
		;

	private static Properties props;

	public static Properties getProperties()
			throws SecurityException
	{
		if (secMan!=null) secMan.checkPropertiesAccess();
		if (props==null) {
			props=new Properties();
			props.put("java.version", "1.0-incomplete");
			props.put("java.vendor", "Charles Briscoe-Smith");
			props.put("java.vendor.url",
			          "http://alethea.ukc.ac.uk/wp?95cpb4");
			props.put("java.home", "none");
			props.put("java.class.version", "none");
			props.put("java.class.path", "none");
			props.put("os.name", "unknown");
			props.put("os.arch", "unknown");
			props.put("os.version", "unknown");
			props.put("file.separator", "/");
			props.put("path.separator", ":");
			props.put("line.separator", "\n");
			props.put("user.name", "unknown");
			props.put("user.home", "unknown");
			props.put("user.dir", "unknown");
		}
		return props;
	}

	public static void setProperties(Properties p) throws SecurityException
	{
		if (secMan!=null) secMan.checkPropertiesAccess();
		props=p;
	}

	public static String getProperty(String n) throws SecurityException
	{
		getProperty(n, null);
	}

	public static String getProperty(String n, String d)
			throws SecurityException
	{
		if (secMan!=null) secMan.checkPropertyAccess(n);
		return getProperties().getProperty(n, d);
	}

	public static void exit(int rv) throws SecurityException
	{
		Runtime.getRuntime().exit(rv);
	}

	public static void gc()
	{
		Runtime.getRuntime().gc();
	}

	public static void runFinalization()
	{
		Runtime.getRuntime().runFinalization();
	}

	public static void load(String file)
			throws SecurityException, UnsatisfiedLinkError
	{
		Runtime.getRuntime().load(file);
	}

	public static void loadLibrary(String file)
			throws SecurityException, UnsatisfiedLinkError
	{
		Runtime.getRuntime().loadLibrary(file);
	}

	public static void arraycopy(Object src, int srcOff,
	                             Object dest, int destOff, int len)
			throws NullPointerException, ArrayStoreException,
			       IndexOutOfBoundsException
	{
		throw new InternalError("arraycopy() not yet implemented");
	}

}