Runtime.java revision 4103
2362N/A * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Every Java application has a single instance of class 0N/A * <code>Runtime</code> that allows the application to interface with 0N/A * the environment in which the application is running. The current 0N/A * runtime can be obtained from the <code>getRuntime</code> method. 0N/A * An application cannot create its own instance of this class. 0N/A * @author unascribed 0N/A * @see java.lang.Runtime#getRuntime() 0N/A * Returns the runtime object associated with the current Java application. 0N/A * Most of the methods of class <code>Runtime</code> are instance 0N/A * methods and must be invoked with respect to the current runtime object. 0N/A * @return the <code>Runtime</code> object associated with the current 0N/A /** Don't let anyone else instantiate this class */ 0N/A * Terminates the currently running Java virtual machine by initiating its 0N/A * shutdown sequence. This method never returns normally. The argument 0N/A * serves as a status code; by convention, a nonzero status code indicates 0N/A * abnormal termination. 0N/A * <p> The virtual machine's shutdown sequence consists of two phases. In 0N/A * the first phase all registered {@link #addShutdownHook shutdown hooks}, 0N/A * if any, are started in some unspecified order and allowed to run 0N/A * concurrently until they finish. In the second phase all uninvoked 0N/A * finalizers are run if {@link #runFinalizersOnExit finalization-on-exit} 0N/A * has been enabled. Once this is done the virtual machine {@link #halt 0N/A * <p> If this method is invoked after the virtual machine has begun its 0N/A * shutdown sequence then if shutdown hooks are being run this method will 0N/A * block indefinitely. If shutdown hooks have already been run and on-exit 0N/A * finalization has been enabled then this method halts the virtual machine 0N/A * with the given status code if the status is nonzero; otherwise, it 0N/A * blocks indefinitely. 0N/A * <p> The <tt>{@link System#exit(int) System.exit}</tt> method is the 0N/A * conventional and convenient means of invoking this method. <p> 0N/A * Termination status. By convention, a nonzero status code 0N/A * indicates abnormal termination. 0N/A * @throws SecurityException 0N/A * If a security manager is present and its <tt>{@link 0N/A * SecurityManager#checkExit checkExit}</tt> method does not permit 0N/A * exiting with the specified status 0N/A * @see java.lang.SecurityException 0N/A * @see java.lang.SecurityManager#checkExit(int) 0N/A * @see #addShutdownHook 0N/A * @see #removeShutdownHook 0N/A * @see #runFinalizersOnExit 0N/A * Registers a new virtual-machine shutdown hook. 0N/A * <p> The Java virtual machine <i>shuts down</i> in response to two kinds 0N/A * <p> <li> The program <i>exits</i> normally, when the last non-daemon 0N/A * thread exits or when the <tt>{@link #exit exit}</tt> (equivalently, 0N/A * <tt>{@link System#exit(int) System.exit}</tt>) method is invoked, or 0N/A * <p> <li> The virtual machine is <i>terminated</i> in response to a 0N/A * user interrupt, such as typing <tt>^C</tt>, or a system-wide event, 0N/A * such as user logoff or system shutdown. 0N/A * <p> A <i>shutdown hook</i> is simply an initialized but unstarted 0N/A * thread. When the virtual machine begins its shutdown sequence it will 0N/A * start all registered shutdown hooks in some unspecified order and let 0N/A * them run concurrently. When all the hooks have finished it will then 0N/A * run all uninvoked finalizers if finalization-on-exit has been enabled. 0N/A * Finally, the virtual machine will halt. Note that daemon threads will 0N/A * continue to run during the shutdown sequence, as will non-daemon threads 0N/A * if shutdown was initiated by invoking the <tt>{@link #exit exit}</tt> 0N/A * <p> Once the shutdown sequence has begun it can be stopped only by 0N/A * invoking the <tt>{@link #halt halt}</tt> method, which forcibly 0N/A * terminates the virtual machine. 0N/A * <p> Once the shutdown sequence has begun it is impossible to register a 0N/A * new shutdown hook or de-register a previously-registered hook. 0N/A * Attempting either of these operations will cause an 0N/A * <tt>{@link IllegalStateException}</tt> to be thrown. 0N/A * <p> Shutdown hooks run at a delicate time in the life cycle of a virtual 0N/A * machine and should therefore be coded defensively. They should, in 0N/A * particular, be written to be thread-safe and to avoid deadlocks insofar 0N/A * as possible. They should also not rely blindly upon services that may 0N/A * have registered their own shutdown hooks and therefore may themselves in 0N/A * the process of shutting down. Attempts to use other thread-based 0N/A * services such as the AWT event-dispatch thread, for example, may lead to 0N/A * <p> Shutdown hooks should also finish their work quickly. When a 0N/A * program invokes <tt>{@link #exit exit}</tt> the expectation is 0N/A * that the virtual machine will promptly shut down and exit. When the 0N/A * virtual machine is terminated due to user logoff or system shutdown the 0N/A * underlying operating system may only allow a fixed amount of time in 0N/A * which to shut down and exit. It is therefore inadvisable to attempt any 0N/A * user interaction or to perform a long-running computation in a shutdown 0N/A * <p> Uncaught exceptions are handled in shutdown hooks just as in any 0N/A * other thread, by invoking the <tt>{@link ThreadGroup#uncaughtException 0N/A * uncaughtException}</tt> method of the thread's <tt>{@link 0N/A * ThreadGroup}</tt> object. The default implementation of this method 0N/A * prints the exception's stack trace to <tt>{@link System#err}</tt> and 0N/A * terminates the thread; it does not cause the virtual machine to exit or 0N/A * <p> In rare circumstances the virtual machine may <i>abort</i>, that is, 0N/A * stop running without shutting down cleanly. This occurs when the 0N/A * virtual machine is terminated externally, for example with the 0N/A * <tt>SIGKILL</tt> signal on Unix or the <tt>TerminateProcess</tt> call on 0N/A * Microsoft Windows. The virtual machine may also abort if a native 0N/A * method goes awry by, for example, corrupting internal data structures or 0N/A * attempting to access nonexistent memory. If the virtual machine aborts 0N/A * then no guarantee can be made about whether or not any shutdown hooks 0N/A * An initialized but unstarted <tt>{@link Thread}</tt> object 0N/A * @throws IllegalArgumentException 0N/A * If the specified hook has already been registered, 0N/A * or if it can be determined that the hook is already running or 0N/A * has already been run 0N/A * @throws IllegalStateException 0N/A * If the virtual machine is already in the process 0N/A * @throws SecurityException 0N/A * If a security manager is present and it denies 0N/A * <tt>{@link RuntimePermission}("shutdownHooks")</tt> 0N/A * @see #removeShutdownHook 0N/A * De-registers a previously-registered virtual-machine shutdown hook. <p> 0N/A * @param hook the hook to remove 0N/A * @return <tt>true</tt> if the specified hook had previously been 0N/A * registered and was successfully de-registered, <tt>false</tt> 0N/A * @throws IllegalStateException 0N/A * If the virtual machine is already in the process of shutting 0N/A * @throws SecurityException 0N/A * If a security manager is present and it denies 0N/A * <tt>{@link RuntimePermission}("shutdownHooks")</tt> 0N/A * @see #addShutdownHook 0N/A * Forcibly terminates the currently running Java virtual machine. This 0N/A * method never returns normally. 0N/A * <p> This method should be used with extreme caution. Unlike the 0N/A * <tt>{@link #exit exit}</tt> method, this method does not cause shutdown 0N/A * hooks to be started and does not run uninvoked finalizers if 0N/A * finalization-on-exit has been enabled. If the shutdown sequence has 0N/A * already been initiated then this method does not wait for any running 0N/A * shutdown hooks or finalizers to finish their work. <p> 0N/A * Termination status. By convention, a nonzero status code 0N/A * indicates abnormal termination. If the <tt>{@link Runtime#exit 0N/A * exit}</tt> (equivalently, <tt>{@link System#exit(int) 0N/A * System.exit}</tt>) method has already been invoked then this 0N/A * status code will override the status code passed to that method. 0N/A * @throws SecurityException 0N/A * If a security manager is present and its <tt>{@link 0N/A * SecurityManager#checkExit checkExit}</tt> method does not permit 0N/A * an exit with the specified status 0N/A * @see #addShutdownHook 0N/A * @see #removeShutdownHook 0N/A * Enable or disable finalization on exit; doing so specifies that the 0N/A * finalizers of all objects that have finalizers that have not yet been 0N/A * automatically invoked are to be run before the Java runtime exits. 0N/A * By default, finalization on exit is disabled. 0N/A * <p>If there is a security manager, 0N/A * its <code>checkExit</code> method is first called 0N/A * with 0 as its argument to ensure the exit is allowed. 0N/A * This could result in a SecurityException. 0N/A * @param value true to enable finalization on exit, false to disable 0N/A * @deprecated This method is inherently unsafe. It may result in 0N/A * finalizers being called on live objects while other threads are 0N/A * concurrently manipulating those objects, resulting in erratic 0N/A * behavior or deadlock. 0N/A * @throws SecurityException 0N/A * if a security manager exists and its <code>checkExit</code> 0N/A * method doesn't allow the exit. 0N/A * @see java.lang.Runtime#exit(int) 0N/A * @see java.lang.Runtime#gc() 0N/A * @see java.lang.SecurityManager#checkExit(int) 0N/A * Executes the specified string command in a separate process. 0N/A * <p>This is a convenience method. An invocation of the form 0N/A * <tt>exec(command)</tt> 0N/A * behaves in exactly the same way as the invocation 0N/A * <tt>{@link #exec(String, String[], File) exec}(command, null, null)</tt>. 0N/A * @param command a specified system command. 0N/A * @return A new {@link Process} object for managing the subprocess 0N/A * @throws SecurityException 0N/A * If a security manager exists and its 0N/A * {@link SecurityManager#checkExec checkExec} 0N/A * method doesn't allow creation of the subprocess 0N/A * @throws IOException 0N/A * If an I/O error occurs 0N/A * @throws NullPointerException 0N/A * If <code>command</code> is <code>null</code> 0N/A * @throws IllegalArgumentException 0N/A * If <code>command</code> is empty 0N/A * @see #exec(String[], String[], File) 0N/A * @see ProcessBuilder 0N/A * Executes the specified string command in a separate process with the 0N/A * specified environment. 0N/A * <p>This is a convenience method. An invocation of the form 0N/A * <tt>exec(command, envp)</tt> 0N/A * behaves in exactly the same way as the invocation 0N/A * <tt>{@link #exec(String, String[], File) exec}(command, envp, null)</tt>. 0N/A * @param command a specified system command. 0N/A * @param envp array of strings, each element of which 0N/A * has environment variable settings in the format 0N/A * <i>name</i>=<i>value</i>, or 0N/A * <tt>null</tt> if the subprocess should inherit 0N/A * the environment of the current process. 0N/A * @return A new {@link Process} object for managing the subprocess 0N/A * @throws SecurityException 0N/A * If a security manager exists and its 0N/A * {@link SecurityManager#checkExec checkExec} 0N/A * method doesn't allow creation of the subprocess 0N/A * @throws IOException 0N/A * If an I/O error occurs 0N/A * @throws NullPointerException 0N/A * If <code>command</code> is <code>null</code>, 0N/A * or one of the elements of <code>envp</code> is <code>null</code> 0N/A * @throws IllegalArgumentException 0N/A * If <code>command</code> is empty 0N/A * @see #exec(String[], String[], File) 0N/A * @see ProcessBuilder 0N/A * Executes the specified string command in a separate process with the 0N/A * specified environment and working directory. 0N/A * <p>This is a convenience method. An invocation of the form 0N/A * <tt>exec(command, envp, dir)</tt> 0N/A * behaves in exactly the same way as the invocation 0N/A * <tt>{@link #exec(String[], String[], File) exec}(cmdarray, envp, dir)</tt>, 0N/A * where <code>cmdarray</code> is an array of all the tokens in 0N/A * <code>command</code>. 0N/A * <p>More precisely, the <code>command</code> string is broken 0N/A * into tokens using a {@link StringTokenizer} created by the call 0N/A * <code>new {@link StringTokenizer}(command)</code> with no 0N/A * further modification of the character categories. The tokens 0N/A * produced by the tokenizer are then placed in the new string 0N/A * array <code>cmdarray</code>, in the same order. 0N/A * @param command a specified system command. 0N/A * @param envp array of strings, each element of which 0N/A * has environment variable settings in the format 0N/A * <i>name</i>=<i>value</i>, or 0N/A * <tt>null</tt> if the subprocess should inherit 0N/A * the environment of the current process. 0N/A * @param dir the working directory of the subprocess, or 0N/A * <tt>null</tt> if the subprocess should inherit 0N/A * the working directory of the current process. 0N/A * @return A new {@link Process} object for managing the subprocess 0N/A * @throws SecurityException 0N/A * If a security manager exists and its 0N/A * {@link SecurityManager#checkExec checkExec} 0N/A * method doesn't allow creation of the subprocess 0N/A * @throws IOException 0N/A * If an I/O error occurs 0N/A * @throws NullPointerException 0N/A * If <code>command</code> is <code>null</code>, 0N/A * or one of the elements of <code>envp</code> is <code>null</code> 0N/A * @throws IllegalArgumentException 0N/A * If <code>command</code> is empty 0N/A * @see ProcessBuilder 0N/A * Executes the specified command and arguments in a separate process. 0N/A * <p>This is a convenience method. An invocation of the form 0N/A * <tt>exec(cmdarray)</tt> 0N/A * behaves in exactly the same way as the invocation 0N/A * <tt>{@link #exec(String[], String[], File) exec}(cmdarray, null, null)</tt>. 0N/A * @param cmdarray array containing the command to call and 0N/A * @return A new {@link Process} object for managing the subprocess 0N/A * @throws SecurityException 0N/A * If a security manager exists and its 0N/A * {@link SecurityManager#checkExec checkExec} 0N/A * method doesn't allow creation of the subprocess 0N/A * @throws IOException 0N/A * If an I/O error occurs 0N/A * @throws NullPointerException 0N/A * If <code>cmdarray</code> is <code>null</code>, 0N/A * or one of the elements of <code>cmdarray</code> is <code>null</code> 0N/A * @throws IndexOutOfBoundsException 0N/A * If <code>cmdarray</code> is an empty array 0N/A * (has length <code>0</code>) 0N/A * @see ProcessBuilder 0N/A * Executes the specified command and arguments in a separate process 0N/A * with the specified environment. 0N/A * <p>This is a convenience method. An invocation of the form 0N/A * <tt>exec(cmdarray, envp)</tt> 0N/A * behaves in exactly the same way as the invocation 0N/A * <tt>{@link #exec(String[], String[], File) exec}(cmdarray, envp, null)</tt>. 0N/A * @param cmdarray array containing the command to call and 0N/A * @param envp array of strings, each element of which 0N/A * has environment variable settings in the format 0N/A * <i>name</i>=<i>value</i>, or 0N/A * <tt>null</tt> if the subprocess should inherit 0N/A * the environment of the current process. 0N/A * @return A new {@link Process} object for managing the subprocess 0N/A * @throws SecurityException 0N/A * If a security manager exists and its 0N/A * {@link SecurityManager#checkExec checkExec} 0N/A * method doesn't allow creation of the subprocess 0N/A * @throws IOException 0N/A * If an I/O error occurs 0N/A * @throws NullPointerException 0N/A * If <code>cmdarray</code> is <code>null</code>, 0N/A * or one of the elements of <code>cmdarray</code> is <code>null</code>, 0N/A * or one of the elements of <code>envp</code> is <code>null</code> 0N/A * @throws IndexOutOfBoundsException 0N/A * If <code>cmdarray</code> is an empty array 0N/A * (has length <code>0</code>) 0N/A * @see ProcessBuilder 0N/A * Executes the specified command and arguments in a separate process with 0N/A * the specified environment and working directory. 0N/A * <p>Given an array of strings <code>cmdarray</code>, representing the 0N/A * tokens of a command line, and an array of strings <code>envp</code>, 0N/A * representing "environment" variable settings, this method creates 0N/A * a new process in which to execute the specified command. 0N/A * <p>This method checks that <code>cmdarray</code> is a valid operating 0N/A * system command. Which commands are valid is system-dependent, 0N/A * but at the very least the command must be a non-empty list of 0N/A * <p>If <tt>envp</tt> is <tt>null</tt>, the subprocess inherits the 0N/A * environment settings of the current process. 4103N/A * <p>A minimal set of system dependent environment variables may 4103N/A * be required to start a process on some operating systems. 4103N/A * As a result, the subprocess may inherit additional environment variable 4103N/A * settings beyond those in the specified environment. 0N/A * <p>{@link ProcessBuilder#start()} is now the preferred way to 0N/A * start a process with a modified environment. 0N/A * <p>The working directory of the new subprocess is specified by <tt>dir</tt>. 0N/A * If <tt>dir</tt> is <tt>null</tt>, the subprocess inherits the 0N/A * current working directory of the current process. 0N/A * <p>If a security manager exists, its 0N/A * {@link SecurityManager#checkExec checkExec} 0N/A * method is invoked with the first component of the array 0N/A * <code>cmdarray</code> as its argument. This may result in a 0N/A * {@link SecurityException} being thrown. 0N/A * <p>Starting an operating system process is highly system-dependent. 0N/A * Among the many things that can go wrong are: 0N/A * <li>The operating system program file was not found. 0N/A * <li>Access to the program file was denied. 0N/A * <li>The working directory does not exist. 0N/A * <p>In such cases an exception will be thrown. The exact nature 0N/A * of the exception is system-dependent, but it will always be a 0N/A * subclass of {@link IOException}. 0N/A * @param cmdarray array containing the command to call and 0N/A * @param envp array of strings, each element of which 0N/A * has environment variable settings in the format 0N/A * <i>name</i>=<i>value</i>, or 0N/A * <tt>null</tt> if the subprocess should inherit 0N/A * the environment of the current process. 0N/A * @param dir the working directory of the subprocess, or 0N/A * <tt>null</tt> if the subprocess should inherit 0N/A * the working directory of the current process. 0N/A * @return A new {@link Process} object for managing the subprocess 0N/A * @throws SecurityException 0N/A * If a security manager exists and its 0N/A * {@link SecurityManager#checkExec checkExec} 0N/A * method doesn't allow creation of the subprocess 0N/A * @throws IOException 0N/A * If an I/O error occurs 0N/A * @throws NullPointerException 0N/A * If <code>cmdarray</code> is <code>null</code>, 0N/A * or one of the elements of <code>cmdarray</code> is <code>null</code>, 0N/A * or one of the elements of <code>envp</code> is <code>null</code> 0N/A * @throws IndexOutOfBoundsException 0N/A * If <code>cmdarray</code> is an empty array 0N/A * (has length <code>0</code>) 0N/A * @see ProcessBuilder 0N/A * Returns the number of processors available to the Java virtual machine. 0N/A * <p> This value may change during a particular invocation of the virtual 0N/A * machine. Applications that are sensitive to the number of available 0N/A * processors should therefore occasionally poll this property and adjust 0N/A * their resource usage appropriately. </p> 0N/A * @return the maximum number of processors available to the virtual 0N/A * machine; never smaller than one 0N/A * Returns the amount of free memory in the Java Virtual Machine. 0N/A * <code>gc</code> method may result in increasing the value returned 0N/A * by <code>freeMemory.</code> 0N/A * @return an approximation to the total amount of memory currently 0N/A * available for future allocated objects, measured in bytes. 0N/A * Returns the total amount of memory in the Java virtual machine. 0N/A * The value returned by this method may vary over time, depending on 0N/A * the host environment. 0N/A * Note that the amount of memory required to hold an object of any 0N/A * given type may be implementation-dependent. 0N/A * @return the total amount of memory currently available for current 0N/A * and future objects, measured in bytes. 0N/A * Returns the maximum amount of memory that the Java virtual machine will 0N/A * attempt to use. If there is no inherent limit then the value {@link 0N/A * java.lang.Long#MAX_VALUE} will be returned. </p> 0N/A * @return the maximum amount of memory that the virtual machine will 0N/A * attempt to use, measured in bytes 0N/A * Runs the garbage collector. 0N/A * Calling this method suggests that the Java virtual machine expend 0N/A * effort toward recycling unused objects in order to make the memory 0N/A * they currently occupy available for quick reuse. When control 0N/A * returns from the method call, the virtual machine has made 0N/A * its best effort to recycle all discarded objects. 0N/A * The name <code>gc</code> stands for "garbage 0N/A * collector". The virtual machine performs this recycling 0N/A * process automatically as needed, in a separate thread, even if the 0N/A * <code>gc</code> method is not invoked explicitly. 0N/A * The method {@link System#gc()} is the conventional and convenient 0N/A * means of invoking this method. 0N/A /* Wormhole for calling java.lang.ref.Finalizer.runFinalization */ 0N/A * Runs the finalization methods of any objects pending finalization. 0N/A * Calling this method suggests that the Java virtual machine expend 0N/A * effort toward running the <code>finalize</code> methods of objects 0N/A * that have been found to be discarded but whose <code>finalize</code> 0N/A * methods have not yet been run. When control returns from the 0N/A * method call, the virtual machine has made a best effort to 0N/A * complete all outstanding finalizations. 0N/A * The virtual machine performs the finalization process 0N/A * automatically as needed, in a separate thread, if the 0N/A * <code>runFinalization</code> method is not invoked explicitly. 0N/A * The method {@link System#runFinalization()} is the conventional 0N/A * and convenient means of invoking this method. 0N/A * @see java.lang.Object#finalize() 0N/A * If the <code>boolean</code> argument is <code>true</code>, this 0N/A * method suggests that the Java virtual machine emit debugging 0N/A * information for each instruction in the virtual machine as it 0N/A * is executed. The format of this information, and the file or other 0N/A * output stream to which it is emitted, depends on the host environment. 0N/A * The virtual machine may ignore this request if it does not support 0N/A * this feature. The destination of the trace output is system 0N/A * If the <code>boolean</code> argument is <code>false</code>, this 0N/A * method causes the virtual machine to stop performing the 0N/A * detailed instruction trace it is performing. 0N/A * @param on <code>true</code> to enable instruction tracing; 0N/A * <code>false</code> to disable this feature. 0N/A * If the <code>boolean</code> argument is <code>true</code>, this 0N/A * method suggests that the Java virtual machine emit debugging 0N/A * information for each method in the virtual machine as it is 0N/A * called. The format of this information, and the file or other output 0N/A * stream to which it is emitted, depends on the host environment. The 0N/A * virtual machine may ignore this request if it does not support 0N/A * Calling this method with argument false suggests that the 0N/A * virtual machine cease emitting per-call debugging information. 0N/A * @param on <code>true</code> to enable instruction tracing; 0N/A * <code>false</code> to disable this feature. 0N/A * Loads the specified filename as a dynamic library. The filename 0N/A * argument must be a complete path name, 0N/A * First, if there is a security manager, its <code>checkLink</code> 0N/A * method is called with the <code>filename</code> as its argument. 0N/A * This may result in a security exception. 0N/A * This is similar to the method {@link #loadLibrary(String)}, but it 0N/A * accepts a general file name as an argument rather than just a library 0N/A * name, allowing any file of native code to be loaded. 0N/A * The method {@link System#load(String)} is the conventional and 0N/A * convenient means of invoking this method. 0N/A * @param filename the file to load. 0N/A * @exception SecurityException if a security manager exists and its 0N/A * <code>checkLink</code> method doesn't allow 0N/A * loading of the specified dynamic library 0N/A * @exception UnsatisfiedLinkError if the file does not exist. 0N/A * @exception NullPointerException if <code>filename</code> is 0N/A * @see java.lang.Runtime#getRuntime() 0N/A * @see java.lang.SecurityException 0N/A * @see java.lang.SecurityManager#checkLink(java.lang.String) 0N/A "Expecting an absolute path of the library: " +
filename);
0N/A * Loads the dynamic library with the specified library name. 0N/A * A file containing native code is loaded from the local file system 0N/A * from a place where library files are conventionally obtained. The 0N/A * details of this process are implementation-dependent. The 0N/A * mapping from a library name to a specific filename is done in a 0N/A * system-specific manner. 0N/A * First, if there is a security manager, its <code>checkLink</code> 0N/A * method is called with the <code>libname</code> as its argument. 0N/A * This may result in a security exception. 0N/A * The method {@link System#loadLibrary(String)} is the conventional 0N/A * and convenient means of invoking this method. If native 0N/A * methods are to be used in the implementation of a class, a standard 0N/A * strategy is to put the native code in a library file (call it 0N/A * <code>LibFile</code>) and then to put a static initializer: 0N/A * static { System.loadLibrary("LibFile"); } 0N/A * </pre></blockquote> 0N/A * within the class declaration. When the class is loaded and 0N/A * initialized, the necessary native code implementation for the native 0N/A * methods will then be loaded as well. 0N/A * If this method is called more than once with the same library 0N/A * name, the second and subsequent calls are ignored. 0N/A * @param libname the name of the library. 0N/A * @exception SecurityException if a security manager exists and its 0N/A * <code>checkLink</code> method doesn't allow 0N/A * loading of the specified dynamic library 0N/A * @exception UnsatisfiedLinkError if the library does not exist. 0N/A * @exception NullPointerException if <code>libname</code> is 0N/A * @see java.lang.SecurityException 0N/A * @see java.lang.SecurityManager#checkLink(java.lang.String) 0N/A "Directory separator should not appear in library name: " +
libname);
0N/A * Creates a localized version of an input stream. This method takes 0N/A * an <code>InputStream</code> and returns an <code>InputStream</code> 0N/A * equivalent to the argument in all respects except that it is 0N/A * localized: as characters in the local character set are read from 0N/A * the stream, they are automatically converted from the local 0N/A * character set to Unicode. 0N/A * If the argument is already a localized stream, it may be returned 0N/A * @param in InputStream to localize 0N/A * @return a localized input stream 0N/A * @see java.io.InputStream 0N/A * @see java.io.BufferedReader#BufferedReader(java.io.Reader) 0N/A * @see java.io.InputStreamReader#InputStreamReader(java.io.InputStream) 0N/A * @deprecated As of JDK 1.1, the preferred way to translate a byte 0N/A * stream in the local encoding into a character stream in Unicode is via 0N/A * the <code>InputStreamReader</code> and <code>BufferedReader</code> 0N/A * Creates a localized version of an output stream. This method 0N/A * takes an <code>OutputStream</code> and returns an 0N/A * <code>OutputStream</code> equivalent to the argument in all respects 0N/A * except that it is localized: as Unicode characters are written to 0N/A * the stream, they are automatically converted to the local 0N/A * If the argument is already a localized stream, it may be returned 0N/A * @deprecated As of JDK 1.1, the preferred way to translate a 0N/A * Unicode character stream into a byte stream in the local encoding is via 0N/A * the <code>OutputStreamWriter</code>, <code>BufferedWriter</code>, and 0N/A * <code>PrintWriter</code> classes. 0N/A * @param out OutputStream to localize 0N/A * @return a localized output stream 0N/A * @see java.io.OutputStream 0N/A * @see java.io.BufferedWriter#BufferedWriter(java.io.Writer) 0N/A * @see java.io.OutputStreamWriter#OutputStreamWriter(java.io.OutputStream) 0N/A * @see java.io.PrintWriter#PrintWriter(java.io.OutputStream)