diff options
author | John Leuner <jewel@pixie.co.za> | 2002-12-18 14:09:45 +0000 |
---|---|---|
committer | John Leuner <jewel@pixie.co.za> | 2002-12-18 14:09:45 +0000 |
commit | 18abd56d4024c7db24126eb2664e7378592c967a (patch) | |
tree | d7c1c2a9c8a79d2b41ba7c9428fb9b06ff16ac1b /vm | |
parent | d732ada79b7f1531e613146658f61a069191720a (diff) | |
download | classpath-18abd56d4024c7db24126eb2664e7378592c967a.tar.gz |
* java/lang/System.java: delegated native calls to VMSystem
added three new calls VMSystem.makeStandardxxxStream
* vm/reference/java/lang/VMSystem.java: added 3 methods for default
implementation of makeStandardxxxStream
* native/jni/java-lang/Makefile.am (libjavalang_la_SOURCES): changed System to VMSystem
* native/jni/java-lang/java_lang_VMSystem.c: Added this file (copied from System.c)
* native/jni/java-lang/java_lang_System.c: Deleted this file
* include/java_lang_VMSystem.h: Added this file
* include/java_lang_System.h: Deleted this file
Diffstat (limited to 'vm')
-rw-r--r-- | vm/reference/java/lang/VMSystem.java | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/vm/reference/java/lang/VMSystem.java b/vm/reference/java/lang/VMSystem.java index dd5d33301..858ebb111 100644 --- a/vm/reference/java/lang/VMSystem.java +++ b/vm/reference/java/lang/VMSystem.java @@ -39,6 +39,8 @@ package java.lang; import java.util.Properties; +import java.io.*; + /** * VMSystem is a package-private helper class for System that the * VM must implement. @@ -86,6 +88,13 @@ final class VMSystem static native int identityHashCode(Object o); /** + * Detect big-endian systems. + * + * @return true if the system is big-endian. + */ + static native boolean isWordsBigEndian(); + + /** * Convert a library name to its platform-specific variant. * * @param libname the library name, as used in <code>loadLibrary</code> @@ -93,4 +102,74 @@ final class VMSystem * @XXX Add this method static native String mapLibraryName(String libname); */ + + /** + * Set {@link #in} to a new InputStream. + * + * @param in the new InputStream + * @see #setIn(InputStream) + */ + static native void setIn(InputStream in); + + /** + * Set {@link #out} to a new PrintStream. + * + * @param out the new PrintStream + * @see #setOut(PrintStream) + */ + static native void setOut(PrintStream out); + + /** + * Set {@link #err} to a new PrintStream. + * + * @param err the new PrintStream + * @see #setErr(PrintStream) + */ + static native void setErr(PrintStream err); + + /** + * Get the current time, measured in the number of milliseconds from the + * beginning of Jan. 1, 1970. This is gathered from the system clock, with + * any attendant incorrectness (it may be timezone dependent). + * + * @return the current time + * @see java.util.Date + */ + public static native long currentTimeMillis(); + + /** + * Helper method which creates the standard input stream. + * VM implementors may choose to construct these streams differently. + * This method can also return null if the stream is created somewhere + * else in the VM startup sequence. + */ + + static InputStream makeStandardInputStream() + { + return new BufferedInputStream(new FileInputStream(FileDescriptor.in)); + } + + /** + * Helper method which creates the standard output stream. + * VM implementors may choose to construct these streams differently. + * This method can also return null if the stream is created somewhere + * else in the VM startup sequence. + */ + + static PrintStream makeStandardOutputStream() + { + return new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.out)), true); + } + /** + * Helper method which creates the standard error stream. + * VM implementors may choose to construct these streams differently. + * This method can also return null if the stream is created somewhere + * else in the VM startup sequence. + */ + + static PrintStream makeStandardErrorStream() + { + return new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.err)), true); + } + } |