📄 system.java
字号:
* <li>The <code>src</code> argument and <code>dest</code> argument refer * to arrays whose component types are different primitive types. * <li>The <code>src</code> argument refers to an array with a primitive * component type and the <code>dest</code> argument refers to an array * with a reference component type. * <li>The <code>src</code> argument refers to an array with a reference * component type and the <code>dest</code> argument refers to an array * with a primitive component type. * </ul> * <p> * Otherwise, if any of the following is true, an * <code>IndexOutOfBoundsException</code> is * thrown and the destination is not modified: * <ul> * <li>The <code>srcPos</code> argument is negative. * <li>The <code>destPos</code> argument is negative. * <li>The <code>length</code> argument is negative. * <li><code>srcPos+length</code> is greater than * <code>src.length</code>, the length of the source array. * <li><code>destPos+length</code> is greater than * <code>dest.length</code>, the length of the destination array. * </ul> * <p> * Otherwise, if any actual component of the source array from * position <code>srcPos</code> through * <code>srcPos+length-1</code> cannot be converted to the component * type of the destination array by assignment conversion, an * <code>ArrayStoreException</code> is thrown. In this case, let * <b><i>k</i></b> be the smallest nonnegative integer less than * length such that <code>src[srcPos+</code><i>k</i><code>]</code> * cannot be converted to the component type of the destination * array; when the exception is thrown, source array components from * positions <code>srcPos</code> through * <code>srcPos+</code><i>k</i><code>-1</code> * will already have been copied to destination array positions * <code>destPos</code> through * <code>destPos+</code><i>k</I><code>-1</code> and no other * positions of the destination array will have been modified. * (Because of the restrictions already itemized, this * paragraph effectively applies only to the situation where both * arrays have component types that are reference types.) * * @param src the source array. * @param srcPos starting position in the source array. * @param dest the destination array. * @param destPos starting position in the destination data. * @param length the number of array elements to be copied. * @exception IndexOutOfBoundsException if copying would cause * access of data outside array bounds. * @exception ArrayStoreException if an element in the <code>src</code> * array could not be stored into the <code>dest</code> array * because of a type mismatch. * @exception NullPointerException if either <code>src</code> or * <code>dest</code> is <code>null</code>. */ public static native void arraycopy(Object src, int srcPos, Object dest, int destPos, int length); /** * Returns the same hash code for the given object as * would be returned by the default method hashCode(), * whether or not the given object's class overrides * hashCode(). * The hash code for the null reference is zero. * * @param x object for which the hashCode is to be calculated * @return the hashCode * @since JDK1.1 */ public static native int identityHashCode(Object x); /** * System properties. The following properties are guaranteed to be defined: * <dl> * <dt>java.version <dd>Java version number * <dt>java.vendor <dd>Java vendor specific string * <dt>java.vendor.url <dd>Java vendor URL * <dt>java.home <dd>Java installation directory * <dt>java.class.version <dd>Java class version number * <dt>java.class.path <dd>Java classpath * <dt>os.name <dd>Operating System Name * <dt>os.arch <dd>Operating System Architecture * <dt>os.version <dd>Operating System Version * <dt>file.separator <dd>File separator ("/" on Unix) * <dt>path.separator <dd>Path separator (":" on Unix) * <dt>line.separator <dd>Line separator ("\n" on Unix) * <dt>user.name <dd>User account name * <dt>user.home <dd>User home directory * <dt>user.dir <dd>User's current working directory * </dl> */ private static Properties props; private static native Properties initProperties(Properties props); /** * CLDC/MIDP properties. * microedition.platform * microedition.endocing * microedition.configuration * microedition.profiles * microedition.locale */ private static Properties midpProps; private static native Properties initCldcMidpProperties(Properties midpProps); /** * Determines the current system properties. * <p> * First, if there is a security manager, its * <code>checkPropertiesAccess</code> method is called with no * arguments. This may result in a security exception. * <p> * The current set of system properties for use by the * {@link #getProperty(String)} method is returned as a * <code>Properties</code> object. If there is no current set of * system properties, a set of system properties is first created and * initialized. This set of system properties always includes values * for the following keys: * <table summary="Shows property keys and associated values"> * <tr><th>Key</th> * <th>Description of Associated Value</th></tr> * <tr><td><code>java.version</code></td> * <td>Java Runtime Environment version</td></tr> * <tr><td><code>java.vendor</code></td> * <td>Java Runtime Environment vendor</td></tr * <tr><td><code>java.vendor.url</code></td> * <td>Java vendor URL</td></tr> * <tr><td><code>java.home</code></td> * <td>Java installation directory</td></tr> * <tr><td><code>java.vm.specification.version</code></td> * <td>Java Virtual Machine specification version</td></tr> * <tr><td><code>java.vm.specification.vendor</code></td> * <td>Java Virtual Machine specification vendor</td></tr> * <tr><td><code>java.vm.specification.name</code></td> * <td>Java Virtual Machine specification name</td></tr> * <tr><td><code>java.vm.version</code></td> * <td>Java Virtual Machine implementation version</td></tr> * <tr><td><code>java.vm.vendor</code></td> * <td>Java Virtual Machine implementation vendor</td></tr> * <tr><td><code>java.vm.name</code></td> * <td>Java Virtual Machine implementation name</td></tr> * <tr><td><code>java.specification.version</code></td> * <td>Java Runtime Environment specification version</td></tr> * <tr><td><code>java.specification.vendor</code></td> * <td>Java Runtime Environment specification vendor</td></tr> * <tr><td><code>java.specification.name</code></td> * <td>Java Runtime Environment specification name</td></tr> * <tr><td><code>java.class.version</code></td> * <td>Java class format version number</td></tr> * <tr><td><code>java.class.path</code></td> * <td>Java class path</td></tr> * <tr><td><code>java.library.path</code></td> * <td>List of paths to search when loading libraries</td></tr> * <tr><td><code>java.io.tmpdir</code></td> * <td>Default temp file path</td></tr> * <tr><td><code>java.compiler</code></td> * <td>Name of JIT compiler to use</td></tr> * <tr><td><code>java.ext.dirs</code></td> * <td>Path of extension directory or directories</td></tr> * <tr><td><code>os.name</code></td> * <td>Operating system name</td></tr> * <tr><td><code>os.arch</code></td> * <td>Operating system architecture</td></tr> * <tr><td><code>os.version</code></td> * <td>Operating system version</td></tr> * <tr><td><code>file.separator</code></td> * <td>File separator ("/" on UNIX)</td></tr> * <tr><td><code>path.separator</code></td> * <td>Path separator (":" on UNIX)</td></tr> * <tr><td><code>line.separator</code></td> * <td>Line separator ("\n" on UNIX)</td></tr> * <tr><td><code>user.name</code></td> * <td>User's account name</td></tr> * <tr><td><code>user.home</code></td> * <td>User's home directory</td></tr> * <tr><td><code>user.dir</code></td> * <td>User's current working directory</td></tr> * </table> * <p> * Multiple paths in a system property value are separated by the path * separator character of the platform. * <p> * Note that even if the security manager does not permit the * <code>getProperties</code> operation, it may choose to permit the * {@link #getProperty(String)} operation. * * @return the system properties * @exception SecurityException if a security manager exists and its * <code>checkPropertiesAccess</code> method doesn't allow access * to the system properties. * @see #setProperties * @see java.lang.SecurityException * @see java.lang.SecurityManager#checkPropertiesAccess() * @see java.util.Properties */ public static Properties getProperties() { if (security != null) { security.checkPropertiesAccess(); } /* * If there are dynamic properties, resolve them all and * add to the returned properties. */ DynamicProperties.addSnapshot(props); return props; } /** * Sets the system properties to the <code>Properties</code> * argument. * <p> * First, if there is a security manager, its * <code>checkPropertiesAccess</code> method is called with no * arguments. This may result in a security exception. * <p> * The argument becomes the current set of system properties for use * by the {@link #getProperty(String)} method. If the argument is * <code>null</code>, then the current set of system properties is * forgotten. * * @param props the new system properties. * @exception SecurityException if a security manager exists and its * <code>checkPropertiesAccess</code> method doesn't allow access * to the system properties. * @see #getProperties * @see java.util.Properties * @see java.lang.SecurityException * @see java.lang.SecurityManager#checkPropertiesAccess() */ public static void setProperties(Properties props) { if (security != null) { security.checkPropertiesAccess(); } if (props == null) { props = new Properties(); initProperties(props); } System.props = props; } /** * Gets the system property indicated by the specified key. * <p> * First, if there is a security manager, its * <code>checkPropertyAccess</code> method is called with the key as * its argument. This may result in a SecurityException. * <p> * If there is no current set of system properties, a set of system * properties is first created and initialized in the same manner as * for the <code>getProperties</code> method. * * @param key the name of the system property. * @return the string value of the system property, * or <code>null</code> if there is no property with that key. * * @exception SecurityException if a security manager exists and its * <code>checkPropertyAccess</code> method doesn't allow * access to the specified system property. * @exception NullPointerException if <code>key</code> is * <code>null</code>. * @exception IllegalArgumentException if <code>key</code> is empty. * @see #setProperty * @see java.lang.SecurityException * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String) * @see java.lang.System#getProperties() */ public static String getProperty(String key) { if (key == null) { throw new NullPointerException("key can't be null"); } if (key.equals("")) { throw new IllegalArgumentException("key can't be empty"); } if (security != null) { security.checkPropertyAccess(key); } /* Check for the property provider first */ PropertyProvider provider = DynamicProperties.get(key); if (provider != null) { return provider.getValue(key, false); } /* * MIDP Property Support * * Allow MIDP properties to override base properties in a MIDP * context. */ if (sun.misc.CVM.isMIDPContext()) { String prop = midpProps.getProperty(key); if (prop != null) { return prop; } } return props.getProperty(key); } /** * Gets the system property indicated by the specified key. * <p> * First, if there is a security manager, its * <code>checkPropertyAccess</code> method is called with the * <code>key</code> as its argument. * <p> * If there is no current set of system properties, a set of system * properties is first created and initialized in the same manner as * for the <code>getProperties</code> method. * * @param key the name of the system property. * @param def a default value. * @return the string value of the system property, * or the default value if there is no property with that key. * * @exception SecurityException if a security manager exists and its * <code>checkPropertyAccess</code> method doesn't allow * access to the specified system property. * @exception NullPointerException if <code>key</code> is * <code>null</code>. * @exception IllegalArgumentException if <code>key</code> is empty. * @see #setProperty * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String) * @see java.lang.System#getProperties() */ public static String getProperty(String key, String def) { if (key == null) { throw new NullPointerException("key can't be null"); } if (key.equals("")) { throw new IllegalArgumentException("key can't be empty"); } if (security != null) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -