Improved build.xml
[vimdoclet.git] / sample / java.lang.System.txt
blob842d2cfb1a2f4e8fd4457f8a437bdc9c0635bd22
1 *java.lang.System* *System* The System class contains several useful class field
3 public final class System
4   extends    |java.lang.Object|
6 |java.lang.System_Description|
7 |java.lang.System_Fields|
8 |java.lang.System_Constructors|
9 |java.lang.System_Methods|
11 ================================================================================
13 *java.lang.System_Fields*
14 |java.io.PrintStream_java.lang.System.err|
15 |java.io.InputStream_java.lang.System.in|
16 |java.io.PrintStream_java.lang.System.out|
18 *java.lang.System_Methods*
19 |java.lang.System.arraycopy(Object,int,Object,int,int)|Copies an array from the
20 |java.lang.System.clearProperty(String)|Removes the system property indicated b
21 |java.lang.System.currentTimeMillis()|Returns the current time in milliseconds.
22 |java.lang.System.exit(int)|Terminates the currently running Java Virtual Machi
23 |java.lang.System.gc()|Runs the garbage collector.
24 |java.lang.System.getenv()|Returns an unmodifiable string map view of the curre
25 |java.lang.System.getenv(String)|Gets the value of the specified environment va
26 |java.lang.System.getProperties()|Determines the current system properties.
27 |java.lang.System.getProperty(String)|Gets the system property indicated by the
28 |java.lang.System.getProperty(String,String)|Gets the system property indicated
29 |java.lang.System.getSecurityManager()|Gets the system security interface.
30 |java.lang.System.identityHashCode(Object)|Returns the same hash code for the g
31 |java.lang.System.inheritedChannel()|Returns the channel inherited from the ent
32 |java.lang.System.load(String)|Loads a code file with the specified filename fr
33 |java.lang.System.loadLibrary(String)|Loads the system library specified by the
34 |java.lang.System.mapLibraryName(String)|Maps a library name into a platform-sp
35 |java.lang.System.nanoTime()|Returns the current value of the most precise avai
36 |java.lang.System.runFinalization()|Runs the finalization methods of any object
37 |java.lang.System.runFinalizersOnExit(boolean)|Enable or disable finalization o
38 |java.lang.System.setErr(PrintStream)|Reassigns the "standard" error output str
39 |java.lang.System.setIn(InputStream)|Reassigns the "standard" input stream.
40 |java.lang.System.setOut(PrintStream)|Reassigns the "standard" output stream.
41 |java.lang.System.setProperties(Properties)|Sets the system properties to the P
42 |java.lang.System.setProperty(String,String)|Sets the system property indicated
43 |java.lang.System.setSecurityManager(SecurityManager)|Sets the System security.
45 *java.lang.System_Description*
47 The System class contains several useful class fields and methods. It cannot be 
48 instantiated. 
50 Among the facilities provided by the System class are standard input, standard 
51 output, and error output streams; access to externally defined properties and 
52 environment variables; a means of loading files and libraries; and a utility 
53 method for quickly copying a portion of an array. 
56 *java.io.PrintStream_java.lang.System.err*
58 The System class contains several useful class fields and methods. It cannot be 
59 instantiated. 
61 Among the facilities provided by the System class are standard input, standard 
62 output, and error output streams; access to externally defined properties and 
63 environment variables; a means of loading files and libraries; and a utility 
64 method for quickly copying a portion of an array. 
67 *java.io.InputStream_java.lang.System.in*
69 The System class contains several useful class fields and methods. It cannot be 
70 instantiated. 
72 Among the facilities provided by the System class are standard input, standard 
73 output, and error output streams; access to externally defined properties and 
74 environment variables; a means of loading files and libraries; and a utility 
75 method for quickly copying a portion of an array. 
78 *java.io.PrintStream_java.lang.System.out*
80 The System class contains several useful class fields and methods. It cannot be 
81 instantiated. 
83 Among the facilities provided by the System class are standard input, standard 
84 output, and error output streams; access to externally defined properties and 
85 environment variables; a means of loading files and libraries; and a utility 
86 method for quickly copying a portion of an array. 
90 *java.lang.System.arraycopy(Object,int,Object,int,int)*
92 public static native void arraycopy(
93   java.lang.Object src,
94   int srcPos,
95   java.lang.Object dest,
96   int destPos,
97   int length)
99 Copies an array from the specified source array, beginning at the specified 
100 position, to the specified position of the destination array. A subsequence of 
101 array components are copied from the source array referenced by src to the 
102 destination array referenced by dest. The number of components copied is equal 
103 to the length argument. The components at positions srcPos through 
104 srcPos+length-1 in the source array are copied into positions destPos through 
105 destPos+length-1, respectively, of the destination array. 
107 If the src and dest arguments refer to the same array object, then the copying 
108 is performed as if the components at positions srcPos through srcPos+length-1 
109 were first copied to a temporary array with length components and then the 
110 contents of the temporary array were copied into positions destPos through 
111 destPos+length-1 of the destination array. 
113 If dest is null, then a NullPointerException is thrown. 
115 If src is null, then a NullPointerException is thrown and the destination array 
116 is not modified. 
118 Otherwise, if any of the following is true, an ArrayStoreException is thrown 
119 and the destination is not modified: 
121 The src argument refers to an object that is not an array. The dest argument 
122 refers to an object that is not an array. The src argument and dest argument 
123 refer to arrays whose component types are different primitive types. The src 
124 argument refers to an array with a primitive component type and the dest 
125 argument refers to an array with a reference component type. The src argument 
126 refers to an array with a reference component type and the dest argument refers 
127 to an array with a primitive component type. 
129 Otherwise, if any of the following is true, an IndexOutOfBoundsException is 
130 thrown and the destination is not modified: 
132 The srcPos argument is negative. The destPos argument is negative. The length 
133 argument is negative. srcPos+length is greater than src.length, the length of 
134 the source array. destPos+length is greater than dest.length, the length of the 
135 destination array. 
137 Otherwise, if any actual component of the source array from position srcPos 
138 through srcPos+length-1 cannot be converted to the component type of the 
139 destination array by assignment conversion, an ArrayStoreException is thrown. 
140 In this case, let k be the smallest nonnegative integer less than length such 
141 that src[srcPos+k] cannot be converted to the component type of the destination 
142 array; when the exception is thrown, source array components from positions 
143 srcPos through srcPos+k-1 will already have been copied to destination array 
144 positions destPos through destPos+k-1 and no other positions of the destination 
145 array will have been modified. (Because of the restrictions already itemized, 
146 this paragraph effectively applies only to the situation where both arrays have 
147 component types that are reference types.) 
149     src - the source array. 
150     srcPos - starting position in the source array. 
151     dest - the destination array. 
152     destPos - starting position in the destination data. 
153     length - the number of array elements to be copied. 
155 *java.lang.System.clearProperty(String)*
157 public static |java.lang.String| clearProperty(java.lang.String key)
159 Removes the system property indicated by the specified key. 
161 First, if a security manager exists, its SecurityManager.checkPermission method 
162 is called with a PropertyPermission(key, "write") permission. This may result 
163 in a SecurityException being thrown. If no exception is thrown, the specified 
164 property is removed. 
166     key - the name of the system property to be removed. 
168     Returns: the previous string value of the system property, or null if there was no 
169              property with that key. 
170 *java.lang.System.currentTimeMillis()*
172 public static native long currentTimeMillis()
174 Returns the current time in milliseconds. Note that while the unit of time of 
175 the return value is a millisecond, the granularity of the value depends on the 
176 underlying operating system and may be larger. For example, many operating 
177 systems measure time in units of tens of milliseconds. 
179 See the description of the class Date for a discussion of slight discrepancies 
180 that may arise between "computer time" and coordinated universal time (UTC). 
183     Returns: the difference, measured in milliseconds, between the current time and 
184              midnight, January 1, 1970 UTC. 
185 *java.lang.System.exit(int)*
187 public static void exit(int status)
189 Terminates the currently running Java Virtual Machine. The argument serves as a 
190 status code; by convention, a nonzero status code indicates abnormal 
191 termination. 
193 This method calls the exit method in class Runtime. This method never returns 
194 normally. 
196 The call System.exit(n) is effectively equivalent to the call: 
198 Runtime.getRuntime().exit(n) 
200     status - exit status. 
202 *java.lang.System.gc()*
204 public static void gc()
206 Runs the garbage collector. 
208 Calling the gc method suggests that the Java Virtual Machine expend effort 
209 toward recycling unused objects in order to make the memory they currently 
210 occupy available for quick reuse. When control returns from the method call, 
211 the Java Virtual Machine has made a best effort to reclaim space from all 
212 discarded objects. 
214 The call System.gc() is effectively equivalent to the call: 
216 Runtime.getRuntime().gc() 
219 *java.lang.System.getenv()*
221 public static |java.util.Map| getenv()
223 Returns an unmodifiable string map view of the current system environment. The 
224 environment is a system-dependent mapping from names to values which is passed 
225 from parent to child processes. 
227 If the system does not support environment variables, an empty map is returned. 
229 The returned map will never contain null keys or values. Attempting to query 
230 the presence of a null key or value will throw a 
231 (|java.lang.NullPointerException|) . Attempting to query the presence of a key 
232 or value which is not of type (|java.lang.String|) will throw a 
233 (|java.lang.ClassCastException|) . 
235 The returned map and its collection views may not obey the general contract of 
236 the (|java.lang.Object|) and (|java.lang.Object|) methods. 
238 The returned map is typically case-sensitive on all platforms. 
240 If a security manager exists, its checkPermission(|java.lang.SecurityManager|) 
241 method is called with a (|java.lang.RuntimePermission|) ("getenv.*") 
242 permission. This may result in a (|java.lang.SecurityException|) being thrown. 
244 When passing information to a Java subprocess, system properties are generally 
245 preferred over environment variables. 
248     Returns: the environment as a map of variable names to values 
249 *java.lang.System.getenv(String)*
251 public static |java.lang.String| getenv(java.lang.String name)
253 Gets the value of the specified environment variable. An environment variable 
254 is a system-dependent external named value. 
256 If a security manager exists, its checkPermission(|java.lang.SecurityManager|) 
257 method is called with a (|java.lang.RuntimePermission|) ("getenv."+name) 
258 permission. This may result in a (|java.lang.SecurityException|) being thrown. 
259 If no exception is thrown the value of the variable name is returned. 
261 System properties and environment variables are both conceptually mappings 
262 between names and values. Both mechanisms can be used to pass user-defined 
263 information to a Java process. Environment variables have a more global effect, 
264 because they are visible to all descendants of the process which defines them, 
265 not just the immediate Java subprocess. They can have subtly different 
266 semantics, such as case insensitivity, on different operating systems. For 
267 these reasons, environment variables are more likely to have unintended side 
268 effects. It is best to use system properties where possible. Environment 
269 variables should be used when a global effect is desired, or when an external 
270 system interface requires an environment variable (such as PATH). 
272 On UNIX systems the alphabetic case of name is typically significant, while on 
273 Microsoft Windows systems it is typically not. For example, the expression 
274 System.getenv("FOO").equals(System.getenv("foo")) is likely to be true on 
275 Microsoft Windows. 
277     name - the name of the environment variable 
279     Returns: the string value of the variable, or null if the variable is not defined in the 
280              system environment 
281 *java.lang.System.getProperties()*
283 public static |java.util.Properties| getProperties()
285 Determines the current system properties. 
287 First, if there is a security manager, its checkPropertiesAccess method is 
288 called with no arguments. This may result in a security exception. 
290 The current set of system properties for use by the (|java.lang.System|) method 
291 is returned as a Properties object. If there is no current set of system 
292 properties, a set of system properties is first created and initialized. This 
293 set of system properties always includes values for the following keys: 
295 Key Description of Associated Value java.version Java Runtime Environment 
296 version java.vendor Java Runtime Environment vendorjava.vendor.url Java vendor 
297 URL java.home Java installation directory java.vm.specification.version Java 
298 Virtual Machine specification version java.vm.specification.vendor Java Virtual 
299 Machine specification vendor java.vm.specification.name Java Virtual Machine 
300 specification name java.vm.version Java Virtual Machine implementation version 
301 java.vm.vendor Java Virtual Machine implementation vendor java.vm.name Java 
302 Virtual Machine implementation name java.specification.version Java Runtime 
303 Environment specification version java.specification.vendor Java Runtime 
304 Environment specification vendor java.specification.name Java Runtime 
305 Environment specification name java.class.version Java class format version 
306 number java.class.path Java class path java.library.path List of paths to 
307 search when loading libraries java.io.tmpdir Default temp file path 
308 java.compiler Name of JIT compiler to use java.ext.dirs Path of extension 
309 directory or directories os.name Operating system name os.arch Operating system 
310 architecture os.version Operating system version file.separator File separator 
311 ("/" on UNIX) path.separator Path separator (":" on UNIX) line.separator Line 
312 separator ("\n" on UNIX) user.name User's account name user.home User's home 
313 directory user.dir User's current working directory 
315 Multiple paths in a system property value are separated by the path separator 
316 character of the platform. 
318 Note that even if the security manager does not permit the getProperties 
319 operation, it may choose to permit the (|java.lang.System|) operation. 
322     Returns: the system properties 
323 *java.lang.System.getProperty(String)*
325 public static |java.lang.String| getProperty(java.lang.String key)
327 Gets the system property indicated by the specified key. 
329 First, if there is a security manager, its checkPropertyAccess method is called 
330 with the key as its argument. This may result in a SecurityException. 
332 If there is no current set of system properties, a set of system properties is 
333 first created and initialized in the same manner as for the getProperties 
334 method. 
336     key - the name of the system property. 
338     Returns: the string value of the system property, or null if there is no property with 
339              that key. 
340 *java.lang.System.getProperty(String,String)*
342 public static |java.lang.String| getProperty(
343   java.lang.String key,
344   java.lang.String def)
346 Gets the system property indicated by the specified key. 
348 First, if there is a security manager, its checkPropertyAccess method is called 
349 with the key as its argument. 
351 If there is no current set of system properties, a set of system properties is 
352 first created and initialized in the same manner as for the getProperties 
353 method. 
355     key - the name of the system property. 
356     def - a default value. 
358     Returns: the string value of the system property, or the default value if there is no 
359              property with that key. 
360 *java.lang.System.getSecurityManager()*
362 public static |java.lang.SecurityManager| getSecurityManager()
364 Gets the system security interface. 
367     Returns: if a security manager has already been established for the current application, 
368              then that security manager is returned; otherwise, null is 
369              returned. 
370 *java.lang.System.identityHashCode(Object)*
372 public static native int identityHashCode(java.lang.Object x)
374 Returns the same hash code for the given object as would be returned by the 
375 default method hashCode(), whether or not the given object's class overrides 
376 hashCode(). The hash code for the null reference is zero. 
378     x - object for which the hashCode is to be calculated 
380     Returns: 
381 *java.lang.System.inheritedChannel()*
383 public static |java.nio.channels.Channel| inheritedChannel()
384   throws |java.io.IOException|
385          
386 Returns the channel inherited from the entity that created this Java virtual 
387 machine. 
389 This method returns the channel obtained by invoking the 
390 inheritedChannel(|java.nio.channels.spi.SelectorProvider|) method of the 
391 system-wide default (|java.nio.channels.spi.SelectorProvider|) object. 
393 In addition to the network-oriented channels described in 
394 inheritedChannel(|java.nio.channels.spi.SelectorProvider|) , this method may 
395 return other kinds of channels in the future. 
398     Returns: The inherited channel, if any, otherwise null. 
399 *java.lang.System.load(String)*
401 public static void load(java.lang.String filename)
403 Loads a code file with the specified filename from the local file system as a 
404 dynamic library. The filename argument must be a complete path name. 
406 The call System.load(name) is effectively equivalent to the call: 
408 Runtime.getRuntime().load(name) 
410     filename - the file to load. 
412 *java.lang.System.loadLibrary(String)*
414 public static void loadLibrary(java.lang.String libname)
416 Loads the system library specified by the libname argument. The manner in which 
417 a library name is mapped to the actual system library is system dependent. 
419 The call System.loadLibrary(name) is effectively equivalent to the call 
421 Runtime.getRuntime().loadLibrary(name) 
423     libname - the name of the library. 
425 *java.lang.System.mapLibraryName(String)*
427 public static native |java.lang.String| mapLibraryName(java.lang.String libname)
429 Maps a library name into a platform-specific string representing a native 
430 library. 
432     libname - the name of the library. 
434     Returns: a platform-dependent native library name. 
435 *java.lang.System.nanoTime()*
437 public static native long nanoTime()
439 Returns the current value of the most precise available system timer, in 
440 nanoseconds. 
442 This method can only be used to measure elapsed time and is not related to any 
443 other notion of system or wall-clock time. The value returned represents 
444 nanoseconds since some fixed but arbitrary time (perhaps in the future, so 
445 values may be negative). This method provides nanosecond precision, but not 
446 necessarily nanosecond accuracy. No guarantees are made about how frequently 
447 values change. Differences in successive calls that span greater than 
448 approximately 292 years (263 nanoseconds) will not accurately compute elapsed 
449 time due to numerical overflow. 
451 For example, to measure how long some code takes to execute: 
453 long startTime = System.nanoTime(); // ... the code being measured ... long 
454 estimatedTime = System.nanoTime() - startTime; 
457     Returns: The current value of the system timer, in nanoseconds. 
458 *java.lang.System.runFinalization()*
460 public static void runFinalization()
462 Runs the finalization methods of any objects pending finalization. 
464 Calling this method suggests that the Java Virtual Machine expend effort toward 
465 running the finalize methods of objects that have been found to be discarded 
466 but whose finalize methods have not yet been run. When control returns from the 
467 method call, the Java Virtual Machine has made a best effort to complete all 
468 outstanding finalizations. 
470 The call System.runFinalization() is effectively equivalent to the call: 
472 Runtime.getRuntime().runFinalization() 
475 *java.lang.System.runFinalizersOnExit(boolean)*
477 public static void runFinalizersOnExit(boolean value)
479 Enable or disable finalization on exit; doing so specifies that the finalizers 
480 of all objects that have finalizers that have not yet been automatically 
481 invoked are to be run before the Java runtime exits. By default, finalization 
482 on exit is disabled. 
484 If there is a security manager, its checkExit method is first called with 0 as 
485 its argument to ensure the exit is allowed. This could result in a 
486 SecurityException. 
488     value - indicating enabling or disabling of finalization 
490 *java.lang.System.setErr(PrintStream)*
492 public static void setErr(java.io.PrintStream err)
494 Reassigns the "standard" error output stream. 
496 First, if there is a security manager, its checkPermission method is called 
497 with a RuntimePermission("setIO") permission to see if it's ok to reassign the 
498 "standard" error output stream. 
500     err - the new standard error output stream. 
502 *java.lang.System.setIn(InputStream)*
504 public static void setIn(java.io.InputStream in)
506 Reassigns the "standard" input stream. 
508 First, if there is a security manager, its checkPermission method is called 
509 with a RuntimePermission("setIO") permission to see if it's ok to reassign the 
510 "standard" input stream. 
512     in - the new standard input stream. 
514 *java.lang.System.setOut(PrintStream)*
516 public static void setOut(java.io.PrintStream out)
518 Reassigns the "standard" output stream. 
520 First, if there is a security manager, its checkPermission method is called 
521 with a RuntimePermission("setIO") permission to see if it's ok to reassign the 
522 "standard" output stream. 
524     out - the new standard output stream 
526 *java.lang.System.setProperties(Properties)*
528 public static void setProperties(java.util.Properties props)
530 Sets the system properties to the Properties argument. 
532 First, if there is a security manager, its checkPropertiesAccess method is 
533 called with no arguments. This may result in a security exception. 
535 The argument becomes the current set of system properties for use by the 
536 (|java.lang.System|) method. If the argument is null, then the current set of 
537 system properties is forgotten. 
539     props - the new system properties. 
541 *java.lang.System.setProperty(String,String)*
543 public static |java.lang.String| setProperty(
544   java.lang.String key,
545   java.lang.String value)
547 Sets the system property indicated by the specified key. 
549 First, if a security manager exists, its SecurityManager.checkPermission method 
550 is called with a PropertyPermission(key, "write") permission. This may result 
551 in a SecurityException being thrown. If no exception is thrown, the specified 
552 property is set to the given value. 
554     key - the name of the system property. 
555     value - the value of the system property. 
557     Returns: the previous value of the system property, or null if it did not have one. 
558 *java.lang.System.setSecurityManager(SecurityManager)*
560 public static void setSecurityManager(java.lang.SecurityManager s)
562 Sets the System security. 
564 If there is a security manager already installed, this method first calls the 
565 security manager's checkPermission method with a 
566 RuntimePermission("setSecurityManager") permission to ensure it's ok to replace 
567 the existing security manager. This may result in throwing a SecurityException. 
569 Otherwise, the argument is established as the current security manager. If the 
570 argument is null and no security manager has been established, then no action 
571 is taken and the method simply returns. 
573     s - the security manager.