Save This Page
Home » openjdk-7 » java » lang » [javadoc | source]
java.lang
final class: VMSystem [javadoc | source]
java.lang.Object
   java.lang.VMSystem
VMSystem is a package-private helper class for System that the VM must implement.
Method from java.lang.VMSystem Summary:
arraycopy,   currentTimeMillis,   environ,   getenv,   identityHashCode,   makeStandardErrorStream,   makeStandardInputStream,   makeStandardOutputStream,   nanoTime,   setErr,   setIn,   setOut
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.lang.VMSystem Detail:
 static native  void arraycopy(Object src,
    int srcStart,
    Object dest,
    int destStart,
    int len)
    Copy one array onto another from src[srcStart] ... src[srcStart+len-1] to dest[destStart] ... dest[destStart+len-1]. First, the arguments are validated: neither array may be null, they must be of compatible types, and the start and length must fit within both arrays. Then the copying starts, and proceeds through increasing slots. If src and dest are the same array, this will appear to copy the data to a temporary location first. An ArrayStoreException in the middle of copying will leave earlier elements copied, but later elements unchanged.
 public static native long currentTimeMillis()
    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).
 static native List environ()
    Returns a list of 'name=value' pairs representing the current environment variables.
 static native String getenv(String name)
    Gets the value of an environment variable. Always returning null is a valid (but not very useful) implementation.
 static native int identityHashCode(Object o)
    Get a hash code computed by the VM for the Object. This hash code will be the same as Object's hashCode() method. It is usually some convolution of the pointer to the Object internal to the VM. It follows standard hash code rules, in that it will remain the same for a given Object for the lifetime of that Object.
 static PrintStream makeStandardErrorStream() 
    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 InputStream makeStandardInputStream() 
    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 PrintStream makeStandardOutputStream() 
    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.
 public static long nanoTime() 

    Returns the current value of a nanosecond-precise system timer. The value of the timer is an offset relative to some arbitrary fixed time, which may be in the future (making the value negative). This method is useful for timing events where nanosecond precision is required. This is achieved by calling this method before and after the event, and taking the difference betweent the two times:

    long startTime = System.nanoTime();
    ... event code ...
    long endTime = System.nanoTime();
    long duration = endTime - startTime;

    Note that the value is only nanosecond-precise, and not accurate; there is no guarantee that the difference between two values is really a nanosecond. Also, the value is prone to overflow if the offset exceeds 2^63.

 static native  void setErr(PrintStream err)
 static native  void setIn(InputStream in)
 static native  void setOut(PrintStream out)