--- /home/cpdev/src/classpath/java/lang/System.java	2005-07-02 21:03:34.000000000 +0000
+++ java/lang/System.java	2005-06-30 05:34:39.000000000 +0000
@@ -40,8 +40,12 @@
 package java.lang;
 
 import gnu.classpath.SystemProperties;
-import gnu.classpath.VMStackWalker;
 
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.io.PrintStream;
 import java.util.Properties;
@@ -71,8 +75,8 @@
    * other processes or files.  That should all be transparent to you,
    * however.
    */
-  public static final InputStream in = VMSystem.makeStandardInputStream();
-
+  public static final InputStream in
+    = new BufferedInputStream(new FileInputStream(FileDescriptor.in));
   /**
    * The standard output PrintStream.  This is assigned at startup and
    * starts its life perfectly valid. Although it is marked final, you can
@@ -83,8 +87,8 @@
    * output to other processes or files.  That should all be transparent to
    * you, however.
    */
-  public static final PrintStream out = VMSystem.makeStandardOutputStream();
-
+  public static final PrintStream out
+    = new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.out)), true);
   /**
    * The standard output PrintStream.  This is assigned at startup and
    * starts its life perfectly valid. Although it is marked final, you can
@@ -95,7 +99,8 @@
    * output to other processes or files.  That should all be transparent to
    * you, however.
    */
-  public static final PrintStream err = VMSystem.makeStandardErrorStream();
+  public static final PrintStream err
+    = new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.err)), true);
 
   /**
    * This class is uninstantiable.
@@ -118,7 +123,7 @@
     SecurityManager sm = SecurityManager.current; // Be thread-safe.
     if (sm != null)
       sm.checkPermission(new RuntimePermission("setIO"));
-    VMSystem.setIn(in);
+    setIn0(in);
   }
 
   /**
@@ -136,7 +141,7 @@
     if (sm != null)
       sm.checkPermission(new RuntimePermission("setIO"));
     
-    VMSystem.setOut(out);
+    setOut0(out);
   }
 
   /**
@@ -153,7 +158,7 @@
     SecurityManager sm = SecurityManager.current; // Be thread-safe.
     if (sm != null)
       sm.checkPermission(new RuntimePermission("setIO"));
-    VMSystem.setErr(err);
+    setErr0(err);
   }
 
   /**
@@ -200,10 +205,7 @@
    * @return the current time
    * @see java.util.Date
    */
-  public static long currentTimeMillis()
-  {
-    return VMSystem.currentTimeMillis();
-  }
+  public static native long currentTimeMillis();
 
   /**
    * Copy one array onto another from <code>src[srcStart]</code> ...
@@ -228,11 +230,8 @@
    * @throws IndexOutOfBoundsException if len is negative, or if the start or
    *         end copy position in either array is out of bounds
    */
-  public static void arraycopy(Object src, int srcStart,
-                               Object dest, int destStart, int len)
-  {
-    VMSystem.arraycopy(src, srcStart, dest, destStart, len);
-  }
+  public static native void arraycopy(Object src, int srcStart,
+				      Object dest, int destStart, int len);
 
   /**
    * Get a hash code computed by the VM for the Object. This hash code will
@@ -245,10 +244,7 @@
    * @return the VM-dependent hash code for this Object
    * @since 1.1
    */
-  public static int identityHashCode(Object o)
-  {
-    return VMSystem.identityHashCode(o);
-  }
+  public static native int identityHashCode(Object o);
 
   /**
    * Get all the system properties at once. A security check may be performed,
@@ -297,10 +293,12 @@
    * <dt>gnu.classpath.home.url</dt>     <dd> Base URL; used for finding
    *     property files in file system</dd>
    * <dt>gnu.cpu.endian</dt>             <dd>big or little</dd>
+   * <dt>gnu.java.io.encoding_scheme_alias.ISO-8859-?</dt>   <dd>8859_?</dd>
    * <dt>gnu.java.io.encoding_scheme_alias.iso-8859-?</dt>   <dd>8859_?</dd>
    * <dt>gnu.java.io.encoding_scheme_alias.iso8859_?</dt>    <dd>8859_?</dd>
    * <dt>gnu.java.io.encoding_scheme_alias.iso-latin-_?</dt> <dd>8859_?</dd>
    * <dt>gnu.java.io.encoding_scheme_alias.latin?</dt>       <dd>8859_?</dd>
+   * <dt>gnu.java.io.encoding_scheme_alias.UTF-8</dt>        <dd>UTF8</dd>
    * <dt>gnu.java.io.encoding_scheme_alias.utf-8</dt>        <dd>UTF8</dd>
    * </dl>
    *
@@ -410,7 +408,7 @@
     SecurityManager sm = SecurityManager.current; // Be thread-safe.
     if (sm != null)
       sm.checkPermission(new RuntimePermission("getenv." + name));
-    return VMSystem.getenv(name);
+    return getenv0(name);
   }
 
   /**
@@ -460,7 +458,7 @@
    * since it can force initialization on objects which are still in use
    * by live threads, leading to deadlock; therefore this is disabled by
    * default. There may be a security check, <code>checkExit(0)</code>. This
-   * calls <code>Runtime.runFinalizersOnExit()</code>.
+   * calls <code>Runtime.getRuntime().runFinalizersOnExit()</code>.
    *
    * @param finalizeOnExit whether to run finalizers on exit
    * @throws SecurityException if permission is denied
@@ -471,7 +469,7 @@
    */
   public static void runFinalizersOnExit(boolean finalizeOnExit)
   {
-    Runtime.runFinalizersOnExit(finalizeOnExit);
+    Runtime.getRuntime().runFinalizersOnExit(finalizeOnExit);
   }
 
   /**
@@ -490,7 +488,7 @@
    */
   public static void load(String filename)
   {
-    Runtime.getRuntime().load(filename, VMStackWalker.getCallingClassLoader());
+    Runtime.getRuntime().load(filename);
   }
 
   /**
@@ -509,8 +507,7 @@
    */
   public static void loadLibrary(String libname)
   {
-    Runtime.getRuntime().loadLibrary(libname,
-      VMStackWalker.getCallingClassLoader());
+    Runtime.getRuntime().loadLibrary(libname);
   }
 
   /**
@@ -522,7 +519,38 @@
    */
   public static String mapLibraryName(String libname)
   {
-    return VMRuntime.mapLibraryName(libname);
+    // XXX Fix this!!!!
+    return Runtime.nativeGetLibname("", libname);
   }
 
+  /**
+   * Set {@link #in} to a new InputStream.
+   *
+   * @param in the new InputStream
+   * @see #setIn(InputStream)
+   */
+  private static native void setIn0(InputStream in);
+
+  /**
+   * Set {@link #out} to a new PrintStream.
+   *
+   * @param out the new PrintStream
+   * @see #setOut(PrintStream)
+   */
+  private static native void setOut0(PrintStream out);
+
+  /**
+   * Set {@link #err} to a new PrintStream.
+   *
+   * @param err the new PrintStream
+   * @see #setErr(PrintStream)
+   */
+  private static native void setErr0(PrintStream err);
+
+  /**
+   * Gets the value of an environment variable.
+   *
+   * @see #getenv(String)
+   */
+  static native String getenv0(String name);
 } // class System
