IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
System.cs
Go to the documentation of this file.
1using System;
2using System.Diagnostics;
4
5using IKVM.Runtime;
8
10{
11
15 static class System
16 {
17
18#if FIRST_PASS == false
19
20 static SystemAccessor systemAccessor;
21 static PropertiesAccessor propertiesAccessor;
22
23 static SystemAccessor SystemAccessor => JVM.Internal.BaseAccessors.Get(ref systemAccessor);
24
25 static PropertiesAccessor PropertiesAccessor => JVM.Internal.BaseAccessors.Get(ref propertiesAccessor);
26
27#endif
28
29 const long january_1st_1970 = 62135596800000L;
30
34 public static void registerNatives()
35 {
36
37 }
38
43 public static void setIn0(object @in)
44 {
45#if FIRST_PASS
46 throw new NotImplementedException();
47#else
48 SystemAccessor.SetIn(@in);
49#endif
50 }
51
55 public static void setOut0(object @out)
56 {
57#if FIRST_PASS
58 throw new NotImplementedException();
59#else
60 SystemAccessor.SetOut(@out);
61#endif
62 }
63
67 public static void setErr0(object err)
68 {
69#if FIRST_PASS
70 throw new NotImplementedException();
71#else
72 SystemAccessor.SetErr(err);
73#endif
74 }
75
80 public static long currentTimeMillis()
81 {
82 return DateTime.UtcNow.Ticks / 10000L - january_1st_1970;
83 }
84
89 public static long nanoTime()
90 {
91 const long NANOS_PER_SEC = 1000000000;
92
93 var time = (double)Stopwatch.GetTimestamp();
94 var freq = (double)Stopwatch.Frequency;
95 return (long)(time / freq * NANOS_PER_SEC);
96 }
97
109 public static void arraycopy(object src, int srcPos, object dest, int destPos, int length)
110 {
111 ByteCodeHelper.arraycopy(src, srcPos, dest, destPos, length);
112 }
113
122 public static int identityHashCode(object x)
123 {
124 return RuntimeHelpers.GetHashCode(x);
125 }
126
132 public static string mapLibraryName(string libname)
133 {
134#if FIRST_PASS
135 throw new NotImplementedException();
136#else
137 if (libname == null)
138 throw new global::java.lang.NullPointerException();
139
141 return libname + ".dll";
142 else if (RuntimeUtil.IsOSX)
143 return "lib" + libname + ".dylib";
144 else
145 return "lib" + libname + ".so";
146#endif
147 }
148
149
150 }
151
152}
static void setErr0(object err)
Implements the native method 'setErr0'.
Definition System.cs:67
static void setOut0(object @out)
Implements the native method 'setOut0'.
Definition System.cs:55
static string mapLibraryName(string libname)
Implements the native method 'mapLibraryName'.
Definition System.cs:132
static long currentTimeMillis()
Implements the native method 'currentTimeMillis'.
Definition System.cs:80
static void setIn0(object @in)
Implements the native method 'setIn0'.
Definition System.cs:43
static int identityHashCode(object x)
Implements the native method 'identityHashCode'.
Definition System.cs:122
static long nanoTime()
Implements the native method 'nanoTime'.
Definition System.cs:89
static void registerNatives()
Implements the native method 'registerNatives'.
Definition System.cs:34
static void arraycopy(object src, int srcPos, object dest, int destPos, int length)
Implements the native method 'arraycopy'.
Definition System.cs:109
static void arraycopy(object src, int srcStart, object dest, int destStart, int len)
Main state of the running JVM.
Maintains various information about the current runtime environment.
static bool IsOSX
Returns true if the current platform is Mac OS X.
static bool IsWindows
Returns true if the current platform is Windows.