The java.lang package contains the classes that are most central to the Java language. As you can see from Figure 12-1, the class hierarchy is broad rather than deep, which means that the classes are independent of each other.
Object is the ultimate superclass of all Java classes and is therefore at the top of all class hierarchies. Class is a class that describes a Java class. There is one Class object for each class that is loaded into Java.
Boolean, Character, Byte, Short, Integer, Long, Float, and Double are immutable class wrappers around each of the primitive Java data types. These classes are useful when you need to manipulate primitive types as objects. They also contain useful conversion and utility methods. String and StringBuffer are objects that represent strings. String is an immutable type, while StringBuffer can have its string changed in place. In Java 1.2 and later, all these classes (except StringBuffer) implement the Comparable interface, which enables sorting and searching algorithms. The Math class (and, in Java 1.3, the StrictMath class) defines static methods for various floating-point mathematical functions.
The Thread class provides support for multiple threads of control running within the same Java interpreter. The Runnable interface is implemented by objects that have a run() method that can serve as the body of a thread.
System provides low-level system methods. Runtime provides similar low-level methods, including an exec() method that, along with the Process class, defines an API for running external processes.
Throwable is the root class of the exception and error hierarchy. Throwable objects are used with the Java throw and catch statements. java.lang defines quite a few subclasses of Throwable. Exception and Error are the superclasses of all exceptions and errors. Figure 12-2 and Figure 12-3 show the class hierarchies for these core Java exceptions and errors.
AbstractMethodError | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
Signals an attempt to invoke an abstract method.
public class AbstractMethodError extends IncompatibleClassChangeError { | ||
// | Public Constructors | |
public AbstractMethodError (); | ||
public AbstractMethodError (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->LinkageError-->IncompatibleClassChangeError-->AbstractMethodError
ArithmeticException | Java 1.0 | |
|
||
java.lang | serializable unchecked PJ1.1 |
A RuntimeException that signals an exceptional arithmetic condition, such as integer division by zero.
public class ArithmeticException extends RuntimeException { | ||
// | Public Constructors | |
public ArithmeticException (); | ||
public ArithmeticException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->RuntimeException-->ArithmeticException
ArrayIndexOutOfBoundsException | Java 1.0 | |
|
||
java.lang | serializable unchecked PJ1.1 |
Signals that an array index less than zero or greater than or equal to the array size has been used.
public class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException { | ||
// | Public Constructors | |
public ArrayIndexOutOfBoundsException (); | ||
public ArrayIndexOutOfBoundsException (String s); | ||
public ArrayIndexOutOfBoundsException (int index); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->RuntimeException-->IndexOutOfBoundsException-->ArrayIndexOutOfBoundsException
Thrown By: Too many methods to list.
ArrayStoreException | Java 1.0 | |
|
||
java.lang | serializable unchecked PJ1.1 |
Signals an attempt to store the wrong type of object into an array.
public class ArrayStoreException extends RuntimeException { | ||
// | Public Constructors | |
public ArrayStoreException (); | ||
public ArrayStoreException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->RuntimeException-->ArrayStoreException
Boolean | Java 1.0 | |
|
||
java.lang | serializable PJ1.1 |
This class provides an immutable object wrapper around the boolean primitive type. Note that the TRUE and FALSE constants are Boolean objects; they are not the same as the true and falseboolean values. As of Java 1.1, this class defines a Class constant that represents the boolean type. booleanValue() returns the boolean value of a Boolean object. The class method getBoolean() retrieves the boolean value of a named property from the system property list. The class method valueOf() parses a string and returns the boolean value it represents.
public final class Boolean implements Serializable { | ||
// | Public Constructors | |
public Boolean (boolean value); | ||
public Boolean (String s); | ||
// | Public Constants | |
public static final Boolean FALSE ; | ||
public static final Boolean TRUE ; | ||
1.1 | public static final Class TYPE ; | |
// | Public Class Methods | |
public static boolean getBoolean (String name); | ||
public static Boolean valueOf (String s); | ||
// | Public Instance Methods | |
public boolean booleanValue (); | ||
// | Public Methods Overriding Object | |
public boolean equals (Object obj); | ||
public int hashCode (); | ||
public String toString (); | ||
} |
Hierarchy: Object-->Boolean(Serializable)
Passed To: javax.swing.DefaultDesktopManager.setWasIcon()
Returned By: Boolean.valueOf(), javax.swing.filechooser.FileView.isTraversable()
Type Of: java.awt.font.TextAttribute.{RUN_DIRECTION_LTR, RUN_DIRECTION_RTL, STRIKETHROUGH_ON, SWAP_COLORS_ON}, Boolean.{FALSE, TRUE}
Byte | Java 1.1 | |
|
||
java.lang | serializable comparable PJ1.1 |
This class provides an object wrapper around the byte primitive type. It defines useful constants for the minimum and maximum values that can be stored by the byte type and a Class object constant that represents the byte type. It also provides various methods for converting Byte values to and from strings and other numeric types.
Most of the static methods of this class can convert a String to a Byte object or a byte value: the four parseByte() and valueOf() methods parse a number from the specified string using an optionally specified radix and return it in one of these two forms. The decode() method parses a byte specified in base 10, base 8, or base 16 and returns it as a Byte. If the string begins with "0x" or "#", it is interpreted as a hexadecimal number. If it begins with "0", it is interpreted as an octal number. Otherwise, it is interpreted as a decimal number.
Note that this class has two toString() methods. One is static and converts a byte primitive value to a string; the other is the usual toString() method that converts a Byte object to a string. Most of the remaining methods convert a Byte to various primitive numeric types.
public final class Byte extends Number implements Comparable { | ||
// | Public Constructors | |
public Byte (byte value); | ||
public Byte (String s) throws NumberFormatException; | ||
// | Public Constants | |
public static final byte MAX_VALUE ; | =127 | |
public static final byte MIN_VALUE ; | =-128 | |
public static final Class TYPE ; | ||
// | Public Class Methods | |
public static Byte decode (String nm) throws NumberFormatException; | ||
public static byte parseByte (String s) throws NumberFormatException; | ||
public static byte parseByte (String s, int radix) throws NumberFormatException; | ||
public static String toString (byte b); | ||
public static Byte valueOf (String s) throws NumberFormatException; | ||
public static Byte valueOf (String s, int radix) throws NumberFormatException; | ||
// | Public Instance Methods | |
1.2 | public int compareTo (Byte anotherByte); | |
// | Methods Implementing Comparable | |
1.2 | public int compareTo (Object o); | |
// | Public Methods Overriding Number | |
public byte byteValue (); | ||
public double doubleValue (); | ||
public float floatValue (); | ||
public int intValue (); | ||
public long longValue (); | ||
public short shortValue (); | ||
// | Public Methods Overriding Object | |
public boolean equals (Object obj); | ||
public int hashCode (); | ||
public String toString (); | ||
} |
Hierarchy: Object-->Number(Serializable)-->Byte(Comparable)
Passed To: Byte.compareTo()
Returned By: Byte.{decode(), valueOf()}
Character | Java 1.0 | |
|
||
java.lang | serializable comparable PJ1.1 |
This class provides an immutable object wrapper around the primitive char data type. charValue() returns the char value of a Character object. A number of class methods provide the Java/Unicode equivalent of the C <ctype.h> character macros for checking the type of characters and converting to uppercase and lowercase letters. getType() returns the character type. The return value is one of the constants defined by the class, which represents a number of broad Unicode character categories. digit() returns the integer equivalent of a given character for a given radix (e.g., radix 16 for hexadecimal). forDigit() returns the character that corresponds to the specified value for the specified radix.
public final class Character implements ComparableSerializable { | ||
// | Public Constructors | |
public Character (char value); | ||
// | Public Constants | |
1.1 | public static final byte COMBINING_SPACING_MARK ; | =8 |
1.1 | public static final byte CONNECTOR_PUNCTUATION ; | =23 |
1.1 | public static final byte CONTROL ; | =15 |
1.1 | public static final byte CURRENCY_SYMBOL ; | =26 |
1.1 | public static final byte DASH_PUNCTUATION ; | =20 |
1.1 | public static final byte DECIMAL_DIGIT_NUMBER ; | =9 |
1.1 | public static final byte ENCLOSING_MARK ; | =7 |
1.1 | public static final byte END_PUNCTUATION ; | =22 |
1.1 | public static final byte FORMAT ; | =16 |
1.1 | public static final byte LETTER_NUMBER ; | =10 |
1.1 | public static final byte LINE_SEPARATOR ; | =13 |
1.1 | public static final byte LOWERCASE_LETTER ; | =2 |
1.1 | public static final byte MATH_SYMBOL ; | =25 |
public static final int MAX_RADIX ; | =36 | |
public static final char MAX_VALUE ; | ='\uFFFF' | |
public static final int MIN_RADIX ; | =2 | |
public static final char MIN_VALUE ; | ='\0' | |
1.1 | public static final byte MODIFIER_LETTER ; | =4 |
1.1 | public static final byte MODIFIER_SYMBOL ; | =27 |
1.1 | public static final byte NON_SPACING_MARK ; | =6 |
1.1 | public static final byte OTHER_LETTER ; | =5 |
1.1 | public static final byte OTHER_NUMBER ; | =11 |
1.1 | public static final byte OTHER_PUNCTUATION ; | =24 |
1.1 | public static final byte OTHER_SYMBOL ; | =28 |
1.1 | public static final byte PARAGRAPH_SEPARATOR ; | =14 |
1.1 | public static final byte PRIVATE_USE ; | =18 |
1.1 | public static final byte SPACE_SEPARATOR ; | =12 |
1.1 | public static final byte START_PUNCTUATION ; | =21 |
1.1 | public static final byte SURROGATE ; | =19 |
1.1 | public static final byte TITLECASE_LETTER ; | =3 |
1.1 | public static final Class TYPE ; | |
1.1 | public static final byte UNASSIGNED ; | =0 |
1.1 | public static final byte UPPERCASE_LETTER ; | =1 |
// | Inner Classes | |
1.2 | ; | |
1.2 | ; | |
// | Public Class Methods | |
public static int digit (char ch, int radix); | ||
public static char forDigit (int digit, int radix); | ||
1.1 | public static int getNumericValue (char ch); | |
1.1 | public static int getType (char ch); | |
public static boolean isDefined (char ch); | ||
public static boolean isDigit (char ch); | ||
1.1 | public static boolean isIdentifierIgnorable (char ch); | |
1.1 | public static boolean isISOControl (char ch); | |
1.1 | public static boolean isJavaIdentifierPart (char ch); | |
1.1 | public static boolean isJavaIdentifierStart (char ch); | |
public static boolean isLetter (char ch); | ||
public static boolean isLetterOrDigit (char ch); | ||
public static boolean isLowerCase (char ch); | ||
1.1 | public static boolean isSpaceChar (char ch); | |
public static boolean isTitleCase (char ch); | ||
1.1 | public static boolean isUnicodeIdentifierPart (char ch); | |
1.1 | public static boolean isUnicodeIdentifierStart (char ch); | |
public static boolean isUpperCase (char ch); | ||
1.1 | public static boolean isWhitespace (char ch); | |
public static char toLowerCase (char ch); | ||
public static char toTitleCase (char ch); | ||
public static char toUpperCase (char ch); | ||
// | Public Instance Methods | |
public char charValue (); | ||
1.2 | public int compareTo (Character anotherCharacter); | |
// | Methods Implementing Comparable | |
1.2 | public int compareTo (Object o); | |
// | Public Methods Overriding Object | |
public boolean equals (Object obj); | ||
public int hashCode (); | ||
public String toString (); | ||
// | Deprecated Public Methods | |
# | public static boolean isJavaLetter (char ch); | |
# | public static boolean isJavaLetterOrDigit (char ch); | |
# | public static boolean isSpace (char ch); | |
} |
Hierarchy: Object-->Character(Comparable,Serializable)
Passed To: Character.compareTo()
Character.Subset | Java 1.2 | |
|
||
java.lang |
This class represents a named subset of the Unicode character set. The toString() method returns the name of the subset. This is a base class intended for further subclassing. Note, in particular, that it does not provide a way to list the members of the subset, nor a way to test for membership in the subset. See Character.UnicodeBlock.
public static class Character.Subset { | ||
// | Protected Constructors | |
protected Subset (String name); | ||
// | Public Methods Overriding Object | |
public final boolean equals (Object obj); | ||
public final int hashCode (); | ||
public final String toString (); | ||
} |
Subclasses: java.awt.im.InputSubset, Character.UnicodeBlock
Passed To: java.awt.im.InputContext.setCharacterSubsets(), java.awt.im.spi.InputMethod.setCharacterSubsets()
Character.UnicodeBlock | Java 1.2 | |
|
||
java.lang |
This subclass of Character.Subset defines a number of constants that represent named subsets of the Unicode character set. The subsets and their names are the "character blocks" defined by the Unicode 2.0 specification (see http://www.unicode.org/ ). The static method of() takes a character and returns the Character.UnicodeBlock to which it belongs, or null if it is not part of any defined block. When presented with an unknown Unicode character, this method provides a useful way to determine what alphabet it belongs to.
public static final class Character.UnicodeBlock extends Character.Subset { | ||
// | No Constructor | |
// | Public Constants | |
public static final Character.UnicodeBlock ALPHABETIC_PRESENTATION_FORMS ; | ||
public static final Character.UnicodeBlock ARABIC ; | ||
public static final Character.UnicodeBlock ARABIC_PRESENTATION_FORMS_A ; | ||
public static final Character.UnicodeBlock ARABIC_PRESENTATION_FORMS_B ; | ||
public static final Character.UnicodeBlock ARMENIAN ; | ||
public static final Character.UnicodeBlock ARROWS ; | ||
public static final Character.UnicodeBlock BASIC_LATIN ; | ||
public static final Character.UnicodeBlock BENGALI ; | ||
public static final Character.UnicodeBlock BLOCK_ELEMENTS ; | ||
public static final Character.UnicodeBlock BOPOMOFO ; | ||
public static final Character.UnicodeBlock BOX_DRAWING ; | ||
public static final Character.UnicodeBlock CJK_COMPATIBILITY ; | ||
public static final Character.UnicodeBlock CJK_COMPATIBILITY_FORMS ; | ||
public static final Character.UnicodeBlock CJK_COMPATIBILITY_IDEOGRAPHS ; | ||
public static final Character.UnicodeBlock CJK_SYMBOLS_AND_PUNCTUATION ; | ||
public static final Character.UnicodeBlock CJK_UNIFIED_IDEOGRAPHS ; | ||
public static final Character.UnicodeBlock COMBINING_DIACRITICAL_MARKS ; | ||
public static final Character.UnicodeBlock COMBINING_HALF_MARKS ; | ||
public static final Character.UnicodeBlock COMBINING_MARKS_FOR_SYMBOLS ; | ||
public static final Character.UnicodeBlock CONTROL_PICTURES ; | ||
public static final Character.UnicodeBlock CURRENCY_SYMBOLS ; | ||
public static final Character.UnicodeBlock CYRILLIC ; | ||
public static final Character.UnicodeBlock DEVANAGARI ; | ||
public static final Character.UnicodeBlock DINGBATS ; | ||
public static final Character.UnicodeBlock ENCLOSED_ALPHANUMERICS ; | ||
public static final Character.UnicodeBlock ENCLOSED_CJK_LETTERS_AND_MONTHS ; | ||
public static final Character.UnicodeBlock GENERAL_PUNCTUATION ; | ||
public static final Character.UnicodeBlock GEOMETRIC_SHAPES ; | ||
public static final Character.UnicodeBlock GEORGIAN ; | ||
public static final Character.UnicodeBlock GREEK ; | ||
public static final Character.UnicodeBlock GREEK_EXTENDED ; | ||
public static final Character.UnicodeBlock GUJARATI ; | ||
public static final Character.UnicodeBlock GURMUKHI ; | ||
public static final Character.UnicodeBlock HALFWIDTH_AND_FULLWIDTH_FORMS ; | ||
public static final Character.UnicodeBlock HANGUL_COMPATIBILITY_JAMO ; | ||
public static final Character.UnicodeBlock HANGUL_JAMO ; | ||
public static final Character.UnicodeBlock HANGUL_SYLLABLES ; | ||
public static final Character.UnicodeBlock HEBREW ; | ||
public static final Character.UnicodeBlock HIRAGANA ; | ||
public static final Character.UnicodeBlock IPA_EXTENSIONS ; | ||
public static final Character.UnicodeBlock KANBUN ; | ||
public static final Character.UnicodeBlock KANNADA ; | ||
public static final Character.UnicodeBlock KATAKANA ; | ||
public static final Character.UnicodeBlock LAO ; | ||
public static final Character.UnicodeBlock LATIN_1_SUPPLEMENT ; | ||
public static final Character.UnicodeBlock LATIN_EXTENDED_A ; | ||
public static final Character.UnicodeBlock LATIN_EXTENDED_ADDITIONAL ; | ||
public static final Character.UnicodeBlock LATIN_EXTENDED_B ; | ||
public static final Character.UnicodeBlock LETTERLIKE_SYMBOLS ; | ||
public static final Character.UnicodeBlock MALAYALAM ; | ||
public static final Character.UnicodeBlock MATHEMATICAL_OPERATORS ; | ||
public static final Character.UnicodeBlock MISCELLANEOUS_SYMBOLS ; | ||
public static final Character.UnicodeBlock MISCELLANEOUS_TECHNICAL ; | ||
public static final Character.UnicodeBlock NUMBER_FORMS ; | ||
public static final Character.UnicodeBlock OPTICAL_CHARACTER_RECOGNITION ; | ||
public static final Character.UnicodeBlock ORIYA ; | ||
public static final Character.UnicodeBlock PRIVATE_USE_AREA ; | ||
public static final Character.UnicodeBlock SMALL_FORM_VARIANTS ; | ||
public static final Character.UnicodeBlock SPACING_MODIFIER_LETTERS ; | ||
public static final Character.UnicodeBlock SPECIALS ; | ||
public static final Character.UnicodeBlock SUPERSCRIPTS_AND_SUBSCRIPTS ; | ||
public static final Character.UnicodeBlock SURROGATES_AREA ; | ||
public static final Character.UnicodeBlock TAMIL ; | ||
public static final Character.UnicodeBlock TELUGU ; | ||
public static final Character.UnicodeBlock THAI ; | ||
public static final Character.UnicodeBlock TIBETAN ; | ||
// | Public Class Methods | |
public static Character.UnicodeBlock of (char c); | ||
} |
Returned By: Character.UnicodeBlock.of()
Type Of: Too many fields to list.
Class | Java 1.0 | |
|
||
java.lang | serializable PJ1.1 |
This class represents a Java class or interface, or, as of Java 1.1, any Java type. There is one Class object for each class that is loaded into the Java Virtual Machine, and, as of Java 1.1, there are special Class objects that represent the Java primitive types. The TYPE constants defined by Boolean, Integer, and the other primitive wrapper classes hold these special Class objects. Array types are also represented by Class objects in Java 1.1.
There is no constructor for this class. You can obtain a Class object by calling the getClass() method of any instance of the desired class. In Java 1.1 and later, you can also refer to a Class object by appending .class to the name of a class. Finally, and most interestingly, a class can be dynamically loaded by passing its fully qualified name (i.e., package name plus class name) to the static Class.forName() method. This method loads the named class (if it is not already loaded) into the Java interpreter and returns a Class object for it. Classes can also be loaded with a ClassLoader object.
The newInstance() method creates an instance of a given class; this allows you to create instances of dynamically loaded classes for which you cannot use the new keyword. Note that this method only works when the target class has a no-argument constructor. See newInstance() in java.lang.reflect.Constructor for a more powerful way to instantiate dynamically loaded classes.
getName() returns the name of the class. getSuperclass() returns its superclass. isInterface() tests whether the Class object represents an interface, and getInterfaces() returns an array of the interfaces that this class implements. In Java 1.2 and later, getPackage() returns a Package object that represents the package containing the class. getProtectionDomain() returns the java.security.ProtectionDomain to which this class belongs. The various other get() and is() methods return other information about the represented class; they form part of the Java Reflection API, along with the classes in java.lang.reflect.
public final class Class implements Serializable { | ||
// | No Constructor | |
// | Public Class Methods | |
public static Class forName (String className) throws ClassNotFoundException; | ||
1.2 | public static Class forName (String name, boolean initialize, ClassLoader loader) throws ClassNotFoundException; | |
// | Property Accessor Methods (by property name) | |
1.1 | public boolean isArray (); | native |
1.1 | public Class[ ] getClasses (); | |
public ClassLoader getClassLoader (); | ||
1.1 | public Class getComponentType (); | native |
1.1 | public java.lang.reflect.Constructor[ ] getConstructors () throws SecurityException; | |
1.1 | public Class[ ] getDeclaredClasses () throws SecurityException; | |
1.1 | public java.lang.reflect.Constructor[ ] getDeclaredConstructors () throws SecurityException; | |
1.1 | public java.lang.reflect.Field[ ] getDeclaredFields () throws SecurityException; | |
1.1 | public java.lang.reflect.Method[ ] getDeclaredMethods () throws SecurityException; | |
1.1 | public Class getDeclaringClass (); | native |
1.1 | public java.lang.reflect.Field[ ] getFields () throws SecurityException; | |
public boolean isInterface (); | native | |
public Class[ ] getInterfaces (); | native | |
1.1 | public java.lang.reflect.Method[ ] getMethods () throws SecurityException; | |
1.1 | public int getModifiers (); | native |
public String getName (); | native | |
1.2 | public Package getPackage (); | |
1.1 | public boolean isPrimitive (); | native |
1.2 | public java.security.ProtectionDomain getProtectionDomain (); | |
1.1 | public Object[ ] getSigners (); | native |
public Class getSuperclass (); | native | |
// | Public Instance Methods | |
1.1 | public java.lang.reflect.Constructor getConstructor (Class[ ] parameterTypes) throws NoSuchMethodExceptionSecurityException; | |
1.1 | public java.lang.reflect.Constructor getDeclaredConstructor (Class[ ] parameterTypes) throws NoSuchMethodExceptionSecurityException; | |
1.1 | public java.lang.reflect.Field getDeclaredField (String name) throws NoSuchFieldExceptionSecurityException; | |
1.1 | public java.lang.reflect.Method getDeclaredMethod (String name, Class[ ] parameterTypes) throws NoSuchMethodExceptionSecurityException; | |
1.1 | public java.lang.reflect.Field getField (String name) throws NoSuchFieldExceptionSecurityException; | |
1.1 | public java.lang.reflect.Method getMethod (String name, Class[ ] parameterTypes) throws NoSuchMethodExceptionSecurityException; | |
1.1 | public java.net.URL getResource (String name); | |
1.1 | public java.io.InputStream getResourceAsStream (String name); | |
1.1 | public boolean isAssignableFrom (Class cls); | native |
1.1 | public boolean isInstance (Object obj); | native |
public Object newInstance () throws InstantiationExceptionIllegalAccessException; | ||
// | Public Methods Overriding Object | |
public String toString (); | ||
} |
Hierarchy: Object-->Class(Serializable)
Passed To: Too many methods to list.
Returned By: Too many methods to list.
Type Of: java.beans.beancontext.BeanContextServiceAvailableEvent.serviceClass, java.beans.beancontext.BeanContextServiceRevokedEvent.serviceClass, Boolean.TYPE, Byte.TYPE, Character.TYPE, Double.TYPE, Float.TYPE, Integer.TYPE, Long.TYPE, Short.TYPE, Void.TYPE
ClassCastException | Java 1.0 | |
|
||
java.lang | serializable unchecked PJ1.1 |
Signals an invalid cast of an object to a type of which it is not an instance.
public class ClassCastException extends RuntimeException { | ||
// | Public Constructors | |
public ClassCastException (); | ||
public ClassCastException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->RuntimeException-->ClassCastException
ClassCircularityError | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
Signals that a circular dependency has been detected while performing initialization for a class.
public class ClassCircularityError extends LinkageError { | ||
// | Public Constructors | |
public ClassCircularityError (); | ||
public ClassCircularityError (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->LinkageError-->ClassCircularityError
ClassFormatError | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
Signals an error in the binary format of a class file.
public class ClassFormatError extends LinkageError { | ||
// | Public Constructors | |
public ClassFormatError (); | ||
public ClassFormatError (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->LinkageError-->ClassFormatError
Subclasses: UnsupportedClassVersionError
Thrown By: ClassLoader.defineClass()
ClassLoader | Java 1.0 | |
|
||
java.lang | PJ1.1 |
This class is the abstract superclass of objects that know how to load Java classes into a Java VM. Given a ClassLoader object, you can dynamically load a class by calling the public loadClass() method, specifying the full name of the desired class. You can obtain a resource associated with a class by calling getResource(), getResources(), and getResourceAsStream(). Many applications do not need to use ClassLoader directly; these applications use the Class.forName() and Class.getResource() methods to dynamically load classes and resources using the ClassLoader object that loaded the application itself.
In order to load classes over the network or from any source other than the standard system classes, you must use a custom ClassLoader object that knows how to obtain data from that source. A java.net.URLClassLoader is suitable for this purpose for almost all applications. Only rarely should an application need to define a ClassLoader subclass of its own. When this is necessary, the subclass should typically extend java.security.SecureClassLoader and override the findClass() method. This method must find the bytes that comprise the named class, then pass them to the defineClass() method and return the resulting Class object. In Java 1.2 and later, the findClass() method must also define the Package object associated with the class, if it has not already been defined. It can use getPackage() and definePackage() for this purpose. Custom subclasses of ClassLoader should also override findResource() and findResources() to enable the public getResource() and getResources() methods.
public abstract class ClassLoader { | ||
// | Protected Constructors | |
protected ClassLoader (); | ||
1.2 | protected ClassLoader (ClassLoader parent); | |
// | Public Class Methods | |
1.2 | public static ClassLoader getSystemClassLoader (); | |
1.1 | public static java.net.URL getSystemResource (String name); | |
1.1 | public static java.io.InputStream getSystemResourceAsStream (String name); | |
1.2 | public static java.util.Enumeration getSystemResources (String name) throws java.io.IOException; | |
// | Public Instance Methods | |
1.2 | public final ClassLoader getParent (); | |
1.1 | public java.net.URL getResource (String name); | |
1.1 | public java.io.InputStream getResourceAsStream (String name); | |
1.2 | public final java.util.Enumeration getResources (String name) throws java.io.IOException; | |
1.1 | public Class loadClass (String name) throws ClassNotFoundException; | |
// | Protected Instance Methods | |
1.1 | protected final Class defineClass (String name, byte[ ] b, int off, int len) throws ClassFormatError; | |
1.2 | protected final Class defineClass (String name, byte[ ] b, int off, int len, java.security.ProtectionDomain protectionDomain) throws ClassFormatError; | |
1.2 | protected Package definePackage (String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, java.net.URL sealBase) throws IllegalArgumentException; | |
1.2 | protected Class findClass (String name) throws ClassNotFoundException; | |
1.2 | protected String findLibrary (String libname); | constant |
1.1 | protected final Class findLoadedClass (String name); | native |
1.2 | protected java.net.URL findResource (String name); | constant |
1.2 | protected java.util.Enumeration findResources (String name) throws java.io.IOException; | |
protected final Class findSystemClass (String name) throws ClassNotFoundException; | ||
1.2 | protected Package getPackage (String name); | |
1.2 | protected Package[ ] getPackages (); | |
protected Class loadClass (String name, boolean resolve) throws ClassNotFoundException; | synchronized | |
protected final void resolveClass (Class c); | ||
1.1 | protected final void setSigners (Class c, Object[ ] signers); | |
// | Deprecated Protected Methods | |
# | protected final Class defineClass (byte[ ] b, int off, int len) throws ClassFormatError; | |
} |
Subclasses: java.security.SecureClassLoader
Passed To: Too many methods to list.
Returned By: Class.getClassLoader(), ClassLoader.{getParent(), getSystemClassLoader()}, SecurityManager.currentClassLoader(), Thread.getContextClassLoader(), java.rmi.server.RMIClassLoader.getClassLoader()
ClassNotFoundException | Java 1.0 | |
|
||
java.lang | serializable checked PJ1.1 |
Signals that a class to be loaded cannot be found.
public class ClassNotFoundException extends Exception { | ||
// | Public Constructors | |
public ClassNotFoundException (); | ||
public ClassNotFoundException (String s); | ||
1.2 | public ClassNotFoundException (String s, Throwable ex); | |
// | Public Instance Methods | |
1.2 | public Throwable getException (); | default:null |
// | Public Methods Overriding Throwable | |
1.2 | public void printStackTrace (); | |
1.2 | public void printStackTrace (java.io.PrintWriter pw); | |
1.2 | public void printStackTrace (java.io.PrintStream ps); | |
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->ClassNotFoundException
Thrown By: Too many methods to list.
Cloneable | Java 1.0 | |
|
||
java.lang | cloneable PJ1.1 |
This interface defines no methods or variables, but indicates that the class that implements it may be cloned (i.e., copied) by calling the Object method clone(). Calling clone() for an object that does not implement this interface (and does not override clone() with its own implementation) causes a CloneNotSupportedException to be thrown.
public interface Cloneable { | ||
} |
Implementations: Too many classes to list.
CloneNotSupportedException | Java 1.0 | |
|
||
java.lang | serializable checked PJ1.1 |
Signals that the clone() method has been called for an object of a class that does not implement the Cloneable interface.
public class CloneNotSupportedException extends Exception { | ||
// | Public Constructors | |
public CloneNotSupportedException (); | ||
public CloneNotSupportedException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->CloneNotSupportedException
Subclasses: java.rmi.server.ServerCloneException
Thrown By: java.awt.datatransfer.DataFlavor.clone(), Object.clone(), java.rmi.server.UnicastRemoteObject.clone(), java.security.MessageDigest.clone(), java.security.MessageDigestSpi.clone(), java.security.Signature.clone(), java.security.SignatureSpi.clone(), javax.crypto.Mac.clone(), javax.crypto.MacSpi.clone(), javax.swing.AbstractAction.clone(), javax.swing.DefaultListSelectionModel.clone(), javax.swing.tree.DefaultTreeSelectionModel.clone()
Comparable | Java 1.2 | |
|
||
java.lang | comparable |
This interface defines a single method, compareTo(), that is responsible for comparing one object to another and determining their relative order, according to some natural ordering for that class of objects. Any general-purpose class that represents a value that can be sorted or ordered should implement this interface. Any class that does implement this interface can make use of various powerful methods such as java.util.Collections.sort() and java.util.Arrays.binarySearch(). As of Java 1.2, many of the key classes in the Java API have been modified to implement this interface.
The compareTo() object compares this object to the object passed as an argument. It should assume that the supplied object is of the appropriate type; if it is not, it should throw a ClassCastException. If this object is less than the supplied object or should appear before the supplied object in a sorted list, compareTo() should return a negative number. If this object is greater than the supplied object or should come after the supplied object in a sorted list, compareTo() should return a positive integer. If the two objects are equivalent, and their relative order in a sorted list does not matter, compareTo() should return 0. If compareTo() returns 0 for two objects, the equals() method should typically return true. If this is not the case, the Comparable objects are not suitable for use in java.util.TreeSet and java.util.TreeMap classes.
See java.util.Comparator for a way to define an ordering for objects that do not implement Comparable or to define an ordering other than the natural ordering defined by a Comparable class.
public interface Comparable { | ||
// | Public Instance Methods | |
public abstract int compareTo (Object o); | ||
} |
Implementations: java.io.File, java.io.ObjectStreamField, Byte, Character, Double, Float, Integer, Long, Short, String, java.math.BigDecimal, java.math.BigInteger, java.text.CollationKey, java.util.Date
Compiler | Java 1.0 | |
|
||
java.lang | PJ1.1 |
The static methods of this class provide an interface to the just-in-time (JIT) byte-code-to-native code compiler in use by the Java interpreter. If no JIT compiler is in use by the VM, these methods do nothing. compileClass() asks the JIT compiler to compile the specified class. compileClasses() asks the JIT compiler to compile all classes that match the specified name. These methods return true if the compilation was successful, or false if it failed or if there is no JIT compiler on the system. enable() and disable() turn just-in-time compilation on and off. command() asks the JIT compiler to perform some compiler-specific operation; this is a hook for vendor extensions. No standard operations have been defined.
public final class Compiler { | ||
// | No Constructor | |
// | Public Class Methods | |
public static Object command (Object any); | native | |
public static boolean compileClass (Class clazz); | native | |
public static boolean compileClasses (String string); | native | |
public static void disable (); | native | |
public static void enable (); | native | |
} |
Double | Java 1.0 | |
|
||
java.lang | serializable comparable PJ1.1 |
This class provides an immutable object wrapper around the double primitive data type. valueOf() converts a string to a Double, doubleValue() returns the primitive double value of a Double object, and there are other methods for returning a Double value as a variety of other primitive types. This class also provides some useful constants and static methods for testing double values. MIN_VALUE and MAX_VALUE are the smallest (closest to zero) and largest representable double values. isInfinite() in class and instance method forms tests whether a double or a Double has an infinite value. Similarly, isNaN() tests whether a double or Double is not-a-number; this is a comparison that cannot be done directly because the NaN constant never tests equal to any other value, including itself. doubleToLongBits() and longBitsToDouble() allow you to manipulate the bit representation of a double directly.
public final class Double extends Number implements Comparable { | ||
// | Public Constructors | |
public Double (String s) throws NumberFormatException; | ||
public Double (double value); | ||
// | Public Constants | |
public static final double MAX_VALUE ; | =1.7976931348623157E308 | |
public static final double MIN_VALUE ; | ||
public static final double NaN ; | =NaN | |
public static final double NEGATIVE_INFINITY ; | =-Infinity | |
public static final double POSITIVE_INFINITY ; | =Infinity | |
1.1 | public static final Class TYPE ; | |
// | Public Class Methods | |
public static long doubleToLongBits (double value); | native | |
1.3 | public static long doubleToRawLongBits (double value); | native |
public static boolean isInfinite (double v); | ||
public static boolean isNaN (double v); | ||
public static double longBitsToDouble (long bits); | native | |
1.2 | public static double parseDouble (String s) throws NumberFormatException; | |
public static String toString (double d); | ||
public static Double valueOf (String s) throws NumberFormatException; | ||
// | Public Instance Methods | |
1.2 | public int compareTo (Double anotherDouble); | |
public boolean isInfinite (); | ||
public boolean isNaN (); | ||
// | Methods Implementing Comparable | |
1.2 | public int compareTo (Object o); | |
// | Public Methods Overriding Number | |
1.1 | public byte byteValue (); | |
public double doubleValue (); | ||
public float floatValue (); | ||
public int intValue (); | ||
public long longValue (); | ||
1.1 | public short shortValue (); | |
// | Public Methods Overriding Object | |
public boolean equals (Object obj); | ||
public int hashCode (); | ||
public String toString (); | ||
} |
Hierarchy: Object-->Number(Serializable)-->Double(Comparable)
Passed To: Double.compareTo()
Returned By: Double.valueOf()
Error | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
This class forms the root of the error hierarchy in Java. Subclasses of Error, unlike subclasses of Exception, should not be caught and generally cause termination of the program. Subclasses of Error need not be declared in the throws clause of a method definition. getMessage() returns a message associated with the error. See Throwable for other methods.
public class Error extends Throwable { | ||
// | Public Constructors | |
public Error (); | ||
public Error (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error
Subclasses: java.awt.AWTError, LinkageError, ThreadDeath, VirtualMachineError
Passed To: java.rmi.ServerError.ServerError()
Exception | Java 1.0 | |
|
||
java.lang | serializable checked PJ1.1 |
This class forms the root of the exception hierarchy in Java. An Exception signals an abnormal condition that must be specially handled to prevent program termination. Exceptions may be caught and handled. An exception that is not a subclass of RuntimeException must be declared in the throws clause of any method that can throw it. getMessage() returns a message associated with the exception. See Throwable for other methods.
public class Exception extends Throwable { | ||
// | Public Constructors | |
public Exception (); | ||
public Exception (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception
Subclasses: Too many classes to list.
Passed To: Too many methods to list.
Returned By: java.awt.event.InvocationEvent.getException(), java.security.PrivilegedActionException.getException(), javax.ejb.EJBException.getCausedByException(), javax.jms.JMSException.getLinkedException(), org.omg.CORBA.Environment.exception()
Thrown By: java.rmi.server.RemoteCall.executeCall(), java.rmi.server.RemoteRef.invoke(), java.rmi.server.Skeleton.dispatch(), java.security.PrivilegedExceptionAction.run(), javax.naming.spi.NamingManager.getObjectInstance(), javax.naming.spi.ObjectFactory.getObjectInstance()
Type Of: java.io.WriteAbortedException.detail, java.rmi.server.ServerCloneException.detail
ExceptionInInitializerError | Java 1.1 | |
|
||
java.lang | serializable error PJ1.1 |
This error is thrown by the Java Virtual Machine when an exception occurs in the static initializer of a class. You can use the getException() method to obtain the Throwable object that was thrown from the initializer.
public class ExceptionInInitializerError extends LinkageError { | ||
// | Public Constructors | |
public ExceptionInInitializerError (); | ||
public ExceptionInInitializerError (String s); | ||
public ExceptionInInitializerError (Throwable thrown); | ||
// | Public Instance Methods | |
public Throwable getException (); | default:null | |
// | Public Methods Overriding Throwable | |
1.2 | public void printStackTrace (); | |
1.2 | public void printStackTrace (java.io.PrintWriter pw); | |
1.2 | public void printStackTrace (java.io.PrintStream ps); | |
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->LinkageError-->ExceptionInInitializerError
Float | Java 1.0 | |
|
||
java.lang | serializable comparable PJ1.1 |
This class provides an immutable object wrapper around the float primitive data type. valueOf() converts a string to a Float, floatValue() returns the primitive float value of a Float object, and there are methods for returning a Float value as a variety of other primitive types. This class also provides some useful constants and static methods for testing float values. MIN_VALUE and MAX_VALUE are the smallest (closest to zero) and largest representable double values. isInfinite() in class and instance method forms tests whether a float or a Float has an infinite value. Similarly, isNaN() tests whether a float or Float is not-a-number; this is a comparison that cannot be done directly because the NaN constant never tests equal to any other value, including itself. floatToIntBits() and intBitsToFloat() allow you to manipulate the bit representation of a float directly.
public final class Float extends Number implements Comparable { | ||
// | Public Constructors | |
public Float (String s) throws NumberFormatException; | ||
public Float (float value); | ||
public Float (double value); | ||
// | Public Constants | |
public static final float MAX_VALUE ; | =3.4028235E38 | |
public static final float MIN_VALUE ; | =1.4E-45 | |
public static final float NaN ; | =NaN | |
public static final float NEGATIVE_INFINITY ; | =-Infinity | |
public static final float POSITIVE_INFINITY ; | =Infinity | |
1.1 | public static final Class TYPE ; | |
// | Public Class Methods | |
public static int floatToIntBits (float value); | native | |
1.3 | public static int floatToRawIntBits (float value); | native |
public static float intBitsToFloat (int bits); | native | |
public static boolean isInfinite (float v); | ||
public static boolean isNaN (float v); | ||
1.2 | public static float parseFloat (String s) throws NumberFormatException; | |
public static String toString (float f); | ||
public static Float valueOf (String s) throws NumberFormatException; | ||
// | Public Instance Methods | |
1.2 | public int compareTo (Float anotherFloat); | |
public boolean isInfinite (); | ||
public boolean isNaN (); | ||
// | Methods Implementing Comparable | |
1.2 | public int compareTo (Object o); | |
// | Public Methods Overriding Number | |
1.1 | public byte byteValue (); | |
public double doubleValue (); | ||
public float floatValue (); | ||
public int intValue (); | ||
public long longValue (); | ||
1.1 | public short shortValue (); | |
// | Public Methods Overriding Object | |
public boolean equals (Object obj); | ||
public int hashCode (); | ||
public String toString (); | ||
} |
Hierarchy: Object-->Number(Serializable)-->Float(Comparable)
Passed To: Float.compareTo()
Returned By: Float.valueOf()
Type Of: Too many fields to list.
IllegalAccessError | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
Signals an attempted use of a class, method, or field that is not accessible.
public class IllegalAccessError extends IncompatibleClassChangeError { | ||
// | Public Constructors | |
public IllegalAccessError (); | ||
public IllegalAccessError (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->LinkageError-->IncompatibleClassChangeError-->IllegalAccessError
IllegalAccessException | Java 1.0 | |
|
||
java.lang | serializable checked PJ1.1 |
Signals that a class or initializer is not accessible. Thrown by Class.newInstance().
public class IllegalAccessException extends Exception { | ||
// | Public Constructors | |
public IllegalAccessException (); | ||
public IllegalAccessException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->IllegalAccessException
Thrown By: Too many methods to list.
IllegalArgumentException | Java 1.0 | |
|
||
java.lang | serializable unchecked PJ1.1 |
Signals an illegal argument to a method. See subclasses IllegalThreadStateException and NumberFormatException.
public class IllegalArgumentException extends RuntimeException { | ||
// | Public Constructors | |
public IllegalArgumentException (); | ||
public IllegalArgumentException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->RuntimeException-->IllegalArgumentException
Subclasses: IllegalThreadStateException, NumberFormatException, java.security.InvalidParameterException
Thrown By: Too many methods to list.
IllegalMonitorStateException | Java 1.0 | |
|
||
java.lang | serializable unchecked PJ1.1 |
Signals an illegal monitor state. It is thrown by the Objectnotify() and wait() methods used for thread synchronization.
public class IllegalMonitorStateException extends RuntimeException { | ||
// | Public Constructors | |
public IllegalMonitorStateException (); | ||
public IllegalMonitorStateException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->RuntimeException-->IllegalMonitorStateException
IllegalStateException | Java 1.1 | |
|
||
java.lang | serializable unchecked PJ1.1 |
Signals that a method has been invoked on an object that is not in an appropriate state to perform the requested operation.
public class IllegalStateException extends RuntimeException { | ||
// | Public Constructors | |
public IllegalStateException (); | ||
public IllegalStateException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->RuntimeException-->java.lang.IllegalStateException
Subclasses: java.awt.IllegalComponentStateException, java.awt.dnd.InvalidDnDOperationException
Thrown By: Too many methods to list.
IllegalThreadStateException | Java 1.0 | |
|
||
java.lang | serializable unchecked PJ1.1 |
Signals that a thread is not in the appropriate state for an attempted operation to succeed.
public class IllegalThreadStateException extends IllegalArgumentException { | ||
// | Public Constructors | |
public IllegalThreadStateException (); | ||
public IllegalThreadStateException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->RuntimeException-->IllegalArgumentException-->IllegalThreadStateException
IncompatibleClassChangeError | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
This is the superclass of a group of related error types. It signals some kind of illegal use of a legal class.
public class IncompatibleClassChangeError extends LinkageError { | ||
// | Public Constructors | |
public IncompatibleClassChangeError (); | ||
public IncompatibleClassChangeError (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->LinkageError-->IncompatibleClassChangeError
Subclasses: AbstractMethodError, IllegalAccessError, InstantiationError, NoSuchFieldError, NoSuchMethodError
IndexOutOfBoundsException | Java 1.0 | |
|
||
java.lang | serializable unchecked PJ1.1 |
Signals that an index is out of bounds. See the subclasses ArrayIndexOutOfBoundsException and StringIndexOutOfBoundsException.
public class IndexOutOfBoundsException extends RuntimeException { | ||
// | Public Constructors | |
public IndexOutOfBoundsException (); | ||
public IndexOutOfBoundsException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->RuntimeException-->IndexOutOfBoundsException
Subclasses: ArrayIndexOutOfBoundsException, StringIndexOutOfBoundsException
Thrown By: java.awt.Toolkit.createCustomCursor(), java.awt.print.Book.{getPageFormat(), getPrintable(), setPage()}, java.awt.print.Pageable.{getPageFormat(), getPrintable()}
InheritableThreadLocal | Java 1.2 | |
|
||
java.lang |
This class holds a thread-local value that is inherited by child threads. See ThreadLocal for a discussion of thread-local values. Note that the inheritance referred to in the name of this class is not superclass-to-subclass inheritance; instead, it is parent-thread-to-child-thread inheritance.
This class is best understood by example. Suppose that an application has defined an InheritableThreadLocal object and that a certain thread (the parent thread) has a thread-local value stored in that object. Whenever that thread creates a new thread (a child thread), the InheritableThreadLocal object is automatically updated so that the new child thread has the same value associated with it as the parent thread. Note that the value associated with the child thread is independent from the value associated with the parent thread. If the child thread subsequently alters its value by calling the set() method of the InheritableThreadLocal, the value associated with the parent thread does not change.
By default, a child thread inherits a parent's values unmodified. By overriding the childValue() method, however, you can create a subclass of InheritableThreadLocal in which the child thread inherits some arbitrary function of the parent thread's value.
public class InheritableThreadLocal extends ThreadLocal { | ||
// | Public Constructors | |
public InheritableThreadLocal (); | ||
// | Protected Instance Methods | |
protected Object childValue (Object parentValue); | ||
} |
Hierarchy: Object-->ThreadLocal-->InheritableThreadLocal
InstantiationError | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
Signals an attempt to instantiate an interface or abstract class.
public class InstantiationError extends IncompatibleClassChangeError { | ||
// | Public Constructors | |
public InstantiationError (); | ||
public InstantiationError (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->LinkageError-->IncompatibleClassChangeError-->InstantiationError
InstantiationException | Java 1.0 | |
|
||
java.lang | serializable checked PJ1.1 |
Signals an attempt to instantiate an interface or an abstract class.
public class InstantiationException extends Exception { | ||
// | Public Constructors | |
public InstantiationException (); | ||
public InstantiationException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->InstantiationException
Thrown By: Class.newInstance(), java.lang.reflect.Constructor.newInstance(), javax.swing.UIManager.setLookAndFeel()
Integer | Java 1.0 | |
|
||
java.lang | serializable comparable PJ1.1 |
This class provides an immutable object wrapper around the int primitive data type. This class also contains useful minimum and maximum constants and useful conversion methods. parseInt() and valueOf() convert a string to an int or to an Integer, respectively. Each can take a radix argument to specify the base the value is represented in. decode() also converts a String to an Integer. It assumes a hexadecimal number if the string begins with "0X" or "0x", or an octal number if the string begins with "0". Otherwise, a decimal number is assumed. toString() converts in the other direction, and the static version takes a radix argument. toBinaryString(), toOctalString(), and toHexString() convert an int to a string using base 2, base 8, and base 16. These methods treat the integer as an unsigned value. Other routines return the value of an Integer as various primitive types, and, finally, the getInteger() methods return the integer value of a named property from the system property list, or the specified default value.
public final class Integer extends Number implements Comparable { | ||
// | Public Constructors | |
public Integer (String s) throws NumberFormatException; | ||
public Integer (int value); | ||
// | Public Constants | |
public static final int MAX_VALUE ; | =2147483647 | |
public static final int MIN_VALUE ; | =-2147483648 | |
1.1 | public static final Class TYPE ; | |
// | Public Class Methods | |
public static Integer decode (String nm) throws NumberFormatException; | ||
public static Integer getInteger (String nm); | ||
public static Integer getInteger (String nm, int val); | ||
public static Integer getInteger (String nm, Integer val); | ||
public static int parseInt (String s) throws NumberFormatException; | ||
public static int parseInt (String s, int radix) throws NumberFormatException; | ||
public static String toBinaryString (int i); | ||
public static String toHexString (int i); | ||
public static String toOctalString (int i); | ||
public static String toString (int i); | ||
public static String toString (int i, int radix); | ||
public static Integer valueOf (String s) throws NumberFormatException; | ||
public static Integer valueOf (String s, int radix) throws NumberFormatException; | ||
// | Public Instance Methods | |
1.2 | public int compareTo (Integer anotherInteger); | |
// | Methods Implementing Comparable | |
1.2 | public int compareTo (Object o); | |
// | Public Methods Overriding Number | |
1.1 | public byte byteValue (); | |
public double doubleValue (); | ||
public float floatValue (); | ||
public int intValue (); | ||
public long longValue (); | ||
1.1 | public short shortValue (); | |
// | Public Methods Overriding Object | |
public boolean equals (Object obj); | ||
public int hashCode (); | ||
public String toString (); | ||
} |
Hierarchy: Object-->Number(Serializable)-->Integer(Comparable)
Passed To: Integer.{compareTo(), getInteger()}, javax.swing.JInternalFrame.setLayer()
Returned By: Integer.{decode(), getInteger(), valueOf()}, javax.swing.JLayeredPane.getObjectForLayer()
Type Of: java.awt.font.TextAttribute.{SUPERSCRIPT_SUB, SUPERSCRIPT_SUPER, UNDERLINE_LOW_DASHED, UNDERLINE_LOW_DOTTED, UNDERLINE_LOW_GRAY, UNDERLINE_LOW_ONE_PIXEL, UNDERLINE_LOW_TWO_PIXEL, UNDERLINE_ON}, javax.swing.JLayeredPane.{DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER}
InternalError | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
Signals an internal error in the Java interpreter.
public class InternalError extends VirtualMachineError { | ||
// | Public Constructors | |
public InternalError (); | ||
public InternalError (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->VirtualMachineError-->InternalError
InterruptedException | Java 1.0 | |
|
||
java.lang | serializable checked PJ1.1 |
Signals that the thread has been interrupted.
public class InterruptedException extends Exception { | ||
// | Public Constructors | |
public InterruptedException (); | ||
public InterruptedException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->InterruptedException
Thrown By: Too many methods to list.
LinkageError | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
The superclass of a group of errors that signal problems linking a class or resolving dependencies between classes.
public class LinkageError extends Error { | ||
// | Public Constructors | |
public LinkageError (); | ||
public LinkageError (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->LinkageError
Subclasses: ClassCircularityError, ClassFormatError, ExceptionInInitializerError, IncompatibleClassChangeError, NoClassDefFoundError, UnsatisfiedLinkError, VerifyError
Long | Java 1.0 | |
|
||
java.lang | serializable comparable PJ1.1 |
This class provides an immutable object wrapper around the long primitive data type. This class also contains useful minimum and maximum constants and useful conversion methods. parseLong() and valueOf() convert a string to a long or to a Long, respectively. Each can take a radix argument to specify the base the value is represented in. toString() converts in the other direction and may also take a radix argument. toBinaryString(), toOctalString(), and toHexString() convert a long to a string using base 2, base 8, and base 16. These methods treat the long as an unsigned value. Other routines return the value of a Long as various primitive types, and, finally, the getLong() methods return the long value of a named property or the value of the specified default.
public final class Long extends Number implements Comparable { | ||
// | Public Constructors | |
public Long (long value); | ||
public Long (String s) throws NumberFormatException; | ||
// | Public Constants | |
public static final long MAX_VALUE ; | =9223372036854775807 | |
public static final long MIN_VALUE ; | =-9223372036854775808 | |
1.1 | public static final Class TYPE ; | |
// | Public Class Methods | |
1.2 | public static Long decode (String nm) throws NumberFormatException; | |
public static Long getLong (String nm); | ||
public static Long getLong (String nm, long val); | ||
public static Long getLong (String nm, Long val); | ||
public static long parseLong (String s) throws NumberFormatException; | ||
public static long parseLong (String s, int radix) throws NumberFormatException; | ||
public static String toBinaryString (long i); | ||
public static String toHexString (long i); | ||
public static String toOctalString (long i); | ||
public static String toString (long i); | ||
public static String toString (long i, int radix); | ||
public static Long valueOf (String s) throws NumberFormatException; | ||
public static Long valueOf (String s, int radix) throws NumberFormatException; | ||
// | Public Instance Methods | |
1.2 | public int compareTo (Long anotherLong); | |
// | Methods Implementing Comparable | |
1.2 | public int compareTo (Object o); | |
// | Public Methods Overriding Number | |
1.1 | public byte byteValue (); | |
public double doubleValue (); | ||
public float floatValue (); | ||
public int intValue (); | ||
public long longValue (); | ||
1.1 | public short shortValue (); | |
// | Public Methods Overriding Object | |
public boolean equals (Object obj); | ||
public int hashCode (); | ||
public String toString (); | ||
} |
Hierarchy: Object-->Number(Serializable)-->Long(Comparable)
Passed To: Long.{compareTo(), getLong()}
Returned By: Long.{decode(), getLong(), valueOf()}
Math | Java 1.0 | |
|
||
java.lang | PJ1.1 |
This class defines constants for the mathematical values e and π and defines static methods for floating-point trigonometry, exponentiation, and other operations. It is the equivalent of the C <math.h> functions. It also contains methods for computing minimum and maximum values and for generating pseudo-random numbers.
Most methods of Math operate on float and double floating-point values. Remember that these values are only approximations of actual real numbers. To allow implementations to take full advantage of the floating-point capabilities of a native platform, the methods of Math are not required to return exactly the same values on all platforms. In other words, the results returned by different implementations may differ slightly in the least-significant bits. In Java 1.3, applications that require strict platform-independence of results should use StrictMath instead.
public final class Math { | ||
// | No Constructor | |
// | Public Constants | |
public static final double E ; | =2.718281828459045 | |
public static final double PI ; | =3.141592653589793 | |
// | Public Class Methods | |
public static int abs (int a); | strictfp | |
public static long abs (long a); | strictfp | |
public static float abs (float a); | strictfp | |
public static double abs (double a); | strictfp | |
public static double acos (double a); | strictfp | |
public static double asin (double a); | strictfp | |
public static double atan (double a); | strictfp | |
public static double atan2 (double a, double b); | strictfp | |
public static double ceil (double a); | strictfp | |
public static double cos (double a); | strictfp | |
public static double exp (double a); | strictfp | |
public static double floor (double a); | strictfp | |
public static double IEEEremainder (double f1, double f2); | strictfp | |
public static double log (double a); | strictfp | |
public static int max (int a, int b); | strictfp | |
public static long max (long a, long b); | strictfp | |
public static float max (float a, float b); | strictfp | |
public static double max (double a, double b); | strictfp | |
public static int min (int a, int b); | strictfp | |
public static long min (long a, long b); | strictfp | |
public static float min (float a, float b); | strictfp | |
public static double min (double a, double b); | strictfp | |
public static double pow (double a, double b); | strictfp | |
public static double random (); | strictfp | |
public static double rint (double a); | strictfp | |
public static int round (float a); | strictfp | |
public static long round (double a); | strictfp | |
public static double sin (double a); | strictfp | |
public static double sqrt (double a); | strictfp | |
public static double tan (double a); | strictfp | |
1.2 | public static double toDegrees (double angrad); | strictfp |
1.2 | public static double toRadians (double angdeg); | strictfp |
} |
NegativeArraySizeException | Java 1.0 | |
|
||
java.lang | serializable unchecked PJ1.1 |
Signals an attempt to allocate an array with fewer than zero elements.
public class NegativeArraySizeException extends RuntimeException { | ||
// | Public Constructors | |
public NegativeArraySizeException (); | ||
public NegativeArraySizeException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->RuntimeException-->NegativeArraySizeException
Thrown By: java.lang.reflect.Array.newInstance()
NoClassDefFoundError | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
Signals that the definition of a specified class cannot be found.
public class NoClassDefFoundError extends LinkageError { | ||
// | Public Constructors | |
public NoClassDefFoundError (); | ||
public NoClassDefFoundError (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->LinkageError-->NoClassDefFoundError
NoSuchFieldError | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
Signals that a specified field cannot be found.
public class NoSuchFieldError extends IncompatibleClassChangeError { | ||
// | Public Constructors | |
public NoSuchFieldError (); | ||
public NoSuchFieldError (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->LinkageError-->IncompatibleClassChangeError-->NoSuchFieldError
NoSuchFieldException | Java 1.1 | |
|
||
java.lang | serializable checked PJ1.1 |
This exception signals that the specified field does not exist in the specified class.
public class NoSuchFieldException extends Exception { | ||
// | Public Constructors | |
public NoSuchFieldException (); | ||
public NoSuchFieldException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->NoSuchFieldException
Thrown By: Class.{getDeclaredField(), getField()}
NoSuchMethodError | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
Signals that a specified method cannot be found.
public class NoSuchMethodError extends IncompatibleClassChangeError { | ||
// | Public Constructors | |
public NoSuchMethodError (); | ||
public NoSuchMethodError (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->LinkageError-->IncompatibleClassChangeError-->NoSuchMethodError
NoSuchMethodException | Java 1.0 | |
|
||
java.lang | serializable checked PJ1.1 |
Signals that the specified method does not exist in the specified class.
public class NoSuchMethodException extends Exception { | ||
// | Public Constructors | |
public NoSuchMethodException (); | ||
public NoSuchMethodException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->NoSuchMethodException
Thrown By: Class.{getConstructor(), getDeclaredConstructor(), getDeclaredMethod(), getMethod()}
NullPointerException | Java 1.0 | |
|
||
java.lang | serializable unchecked PJ1.1 |
Signals an attempt to access a field or invoke a method of a null object.
public class NullPointerException extends RuntimeException { | ||
// | Public Constructors | |
public NullPointerException (); | ||
public NullPointerException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->RuntimeException-->NullPointerException
Thrown By: java.awt.print.PrinterJob.setPageable()
Number | Java 1.0 | |
|
||
java.lang | serializable PJ1.1 |
This is an abstract class that is the superclass of Byte, Short, Integer, Long, Float, and Double. It defines the conversion functions those types implement.
public abstract class Number implements Serializable { | ||
// | Public Constructors | |
public Number (); | ||
// | Public Instance Methods | |
1.1 | public byte byteValue (); | |
public abstract double doubleValue (); | ||
public abstract float floatValue (); | ||
public abstract int intValue (); | ||
public abstract long longValue (); | ||
1.1 | public short shortValue (); | |
} |
Hierarchy: Object-->Number(Serializable)
Subclasses: Byte, Double, Float, Integer, Long, Short, java.math.BigDecimal, java.math.BigInteger
Passed To: java.awt.Button.AccessibleAWTButton.setCurrentAccessibleValue(), java.awt.Checkbox.AccessibleAWTCheckbox.setCurrentAccessibleValue(), java.awt.CheckboxMenuItem.AccessibleAWTCheckboxMenuItem.setCurrentAccessibleValue(), java.awt.MenuItem.AccessibleAWTMenuItem.setCurrentAccessibleValue(), java.awt.Scrollbar.AccessibleAWTScrollBar.setCurrentAccessibleValue(), javax.accessibility.AccessibleValue.setCurrentAccessibleValue(), javax.swing.AbstractButton.AccessibleAbstractButton.setCurrentAccessibleValue(), javax.swing.JInternalFrame.AccessibleJInternalFrame.setCurrentAccessibleValue(), javax.swing.JInternalFrame.JDesktopIcon.AccessibleJDesktopIcon.setCurrentAccessibleValue(), javax.swing.JProgressBar.AccessibleJProgressBar.setCurrentAccessibleValue(), javax.swing.JScrollBar.AccessibleJScrollBar.setCurrentAccessibleValue(), javax.swing.JSlider.AccessibleJSlider.setCurrentAccessibleValue(), javax.swing.JSplitPane.AccessibleJSplitPane.setCurrentAccessibleValue()
Returned By: Too many methods to list.
NumberFormatException | Java 1.0 | |
|
||
java.lang | serializable unchecked PJ1.1 |
Signals an illegal number format.
public class NumberFormatException extends IllegalArgumentException { | ||
// | Public Constructors | |
public NumberFormatException (); | ||
public NumberFormatException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->RuntimeException-->IllegalArgumentException-->NumberFormatException
Thrown By: Too many methods to list.
Object | Java 1.0 | |
|
||
java.lang | PJ1.1 |
This is the root class in Java. All classes are subclasses of Object, and thus all objects can invoke the public and protected methods of this class. equals() tests whether two objects have the same value (not whether two variables refer to the same object, but whether two distinct objects have byte-for-byte equivalence). For classes that implement the Cloneable interface, clone() makes a byte-for-byte copy of an Object. getClass() returns the Class object associated with any Object, and the notify(), notifyAll(), and wait() methods are used for thread synchronization on a given Object.
A number of these Object methods should be overridden by subclasses of Object. For example, a subclass should provide its own definition of the toString() method so that it can be used with the string concatenation operator and with the PrintWriter.println() methods. Defining the toString() method for all objects also helps with debugging.
A class that contains references to other objects may want to override the equals() and clone() methods (for Cloneable objects) so that it recursively calls the equals() and clone() methods of the objects referred to within the original object. Some classes, particularly those that override equals(), may also want to override the hashCode() method to provide an appropriate hashcode to be used when storing instances in a Hashtable data structure.
A class that allocates system resources other than memory (such as file descriptors or windowing system graphic contexts) should override the finalize() method to release these resources when the object is no longer referred to and is about to be garbage-collected.
public class Object { | ||
// | Public Constructors | |
public Object (); | empty | |
// | Public Instance Methods | |
public boolean equals (Object obj); | ||
public final Class getClass (); | native | |
public int hashCode (); | native | |
public final void notify (); | native | |
public final void notifyAll (); | native | |
public String toString (); | ||
public final void wait () throws InterruptedException; | ||
public final void wait (long timeout) throws InterruptedException; | native | |
public final void wait (long timeout, int nanos) throws InterruptedException; | ||
// | Protected Instance Methods | |
protected Object clone () throws CloneNotSupportedException; | native | |
protected void finalize () throws Throwable; | empty | |
} |
Subclasses: Too many classes to list.
Passed To: Too many methods to list.
Returned By: Too many methods to list.
Type Of: Too many fields to list.
OutOfMemoryError | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
Signals that the interpreter has run out of memory (and that garbage collection is unable to free any memory).
public class OutOfMemoryError extends VirtualMachineError { | ||
// | Public Constructors | |
public OutOfMemoryError (); | ||
public OutOfMemoryError (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->VirtualMachineError-->OutOfMemoryError
Package | Java 1.2 | |
|
||
java.lang |
This class represents a Java package. You can obtain the Package object for a given Class by calling the getPackage() method of the Class object. The static Package.getPackage() method returns a Package object for the named package, if any such package has been loaded by the current class loader. Similarly, the static Package.getPackages() returns all Package objects that have been loaded by the current class loader. Note that a Package object is not defined unless at least one class has been loaded from that package. Although you can obtain the Package of a given Class, you cannot obtain an array of Class objects contained in a specified Package.
If the classes that comprise a package are contained in a JAR file that has the appropriate attributes set in its manifest file, the Package object allows you to query the title, vendor, and version of both the package specification and the package implementation; all six values are strings. The specification version string has a special format. It consists of one or more integers, separated from each other by periods. Each integer can have leading zeros, but is not considered an octal digit. Increasing numbers indicate later versions. The isCompatibleWith() method calls getSpecificationVersion() to obtain the specification version and compares it with the version string supplied as an argument. If the package-specification version is the same as or greater than the specified string, isCompatibleWith() returns true. This allows you to test whether the version of a package (typically a standard extension) is new enough for the purposes of your application.
Packages may be sealed, which means that all classes in the package must come from the same JAR file. If a package is sealed, the no-argument version of isSealed() returns true. The one-argument version of isSealed() returns true if the specified URL represents the JAR file from which the package is loaded.
public class Package { | ||
// | No Constructor | |
// | Public Class Methods | |
public static Package getPackage (String name); | ||
public static Package[ ] getPackages (); | ||
// | Property Accessor Methods (by property name) | |
public String getImplementationTitle (); | ||
public String getImplementationVendor (); | ||
public String getImplementationVersion (); | ||
public String getName (); | ||
public boolean isSealed (); | ||
public boolean isSealed (java.net.URL url); | ||
public String getSpecificationTitle (); | ||
public String getSpecificationVendor (); | ||
public String getSpecificationVersion (); | ||
// | Public Instance Methods | |
public boolean isCompatibleWith (String desired) throws NumberFormatException; | ||
// | Public Methods Overriding Object | |
public int hashCode (); | ||
public String toString (); | ||
} |
Returned By: Class.getPackage(), ClassLoader.{definePackage(), getPackage(), getPackages()}, Package.{getPackage(), getPackages()}, java.net.URLClassLoader.definePackage()
Process | Java 1.0 | |
|
||
java.lang | PJ1.1 |
This class describes a process that is running externally to the Java interpreter. Note that a Process is very different from a Thread; the Process class is abstract and cannot be instantiated. Call one of the Runtime.exec() methods to start a process and return a corresponding Process object.
waitFor() blocks until the process exits. exitValue() returns the exit code of the process. destroy() kills the process. getErrorStream() returns an InputStream from which you can read any bytes the process sends to its standard error stream. getInputStream() returns an InputStream from which you can read any bytes the process sends to its standard output stream. getOutputStream() returns an OutputStream you can use to send bytes to the standard input stream of the process.
public abstract class Process { | ||
// | Public Constructors | |
public Process (); | ||
// | Property Accessor Methods (by property name) | |
public abstract java.io.InputStream getErrorStream (); | ||
public abstract java.io.InputStream getInputStream (); | ||
public abstract java.io.OutputStream getOutputStream (); | ||
// | Public Instance Methods | |
public abstract void destroy (); | ||
public abstract int exitValue (); | ||
public abstract int waitFor () throws InterruptedException; | ||
} |
Returned By: Runtime.exec()
Runnable | Java 1.0 | |
|
||
java.lang | runnable PJ1.1 |
This interface specifies the run() method that is required to use with the Thread class. Any class that implements this interface can provide the body of a thread. See Thread for more information.
public interface Runnable { | ||
// | Public Instance Methods | |
public abstract void run (); | ||
} |
Implementations: java.awt.image.renderable.RenderableImageProducer, Thread, java.util.TimerTask, javax.jms.Session, javax.swing.text.AsyncBoxView.ChildState
Passed To: java.awt.EventQueue.{invokeAndWait(), invokeLater()}, java.awt.event.InvocationEvent.InvocationEvent(), Thread.Thread(), javax.swing.SwingUtilities.{invokeAndWait(), invokeLater()}, javax.swing.text.AbstractDocument.render(), javax.swing.text.Document.render(), javax.swing.text.LayoutQueue.addTask()
Returned By: javax.swing.text.LayoutQueue.waitForWork()
Type Of: java.awt.event.InvocationEvent.runnable
Runtime | Java 1.0 | |
|
||
java.lang | PJ1.1 |
This class encapsulates a number of platform-dependent system functions. The static method getRuntime() returns the Runtime object for the current platform; this object can perform system functions in a platform-independent way.
exit() causes the Java interpreter to exit and return a specified return code. This method is usually invoked through System.exit(). In Java 1.3, addShutdownHook() registers an unstarted Thread object that is run when the virtual machine shuts down, either through a call to exit() or through a user interrupt (a CTRL-C, for example). The purpose of a shutdown hook is to perform necessary cleanup, such as shutting down network connections, deleting temporary files, and so on. Any number of hooks can be registered with addShutdownHook(). Before the interpreter exits, it starts all registered shutdown-hook threads and lets them run concurrently. Any hooks you write should perform their cleanup operation and exit promptly so they do not delay the shutdown process. To remove a shutdown hook before it is run, call removeShutdownHook(). To force an immediate exit that does not invoke the shutdown hooks, call halt().
exec() starts a new process running externally to the interpreter. Note that any processes run outside of Java may be system-dependent.
freeMemory() returns the approximate amount of free memory. totalMemory() returns the total amount of memory available to the Java interpreter. gc() forces the garbage collector to run synchronously, which may free up more memory. Similarly, runFinalization() forces the finalize() methods of unreferenced objects to be run immediately. This may free up system resources those objects were holding.
load() loads a dynamic library with a fully specified pathname. loadLibrary() loads a dynamic library with only the library name specified; it looks in platform-dependent locations for the specified library. These libraries generally contain native code definitions for native methods.
traceInstructions() and traceMethodCalls() enable and disable tracing by the interpreter. These methods are used for debugging or profiling an application. It is not specified how the VM emits the trace information, and VMs are not even required to support this feature.
Note that some of the Runtime methods are more commonly called via the static methods of the System class.
public class Runtime { | ||
// | No Constructor | |
// | Public Class Methods | |
public static Runtime getRuntime (); | ||
// | Public Instance Methods | |
1.3 | public void addShutdownHook (Thread hook); | |
public Process exec (String[ ] cmdarray) throws java.io.IOException; | ||
public Process exec (String command) throws java.io.IOException; | ||
public Process exec (String command, String[ ] envp) throws java.io.IOException; | ||
public Process exec (String[ ] cmdarray, String[ ] envp) throws java.io.IOException; | ||
public void exit (int status); | ||
public long freeMemory (); | native | |
public void gc (); | native | |
1.3 | public void halt (int status); | |
public void load (String filename); | ||
public void loadLibrary (String libname); | ||
1.3 | public boolean removeShutdownHook (Thread hook); | |
public void runFinalization (); | ||
public long totalMemory (); | native | |
public void traceInstructions (boolean on); | native | |
public void traceMethodCalls (boolean on); | native | |
// | Deprecated Public Methods | |
# | public java.io.InputStream getLocalizedInputStream (java.io.InputStream in); | |
# | public java.io.OutputStream getLocalizedOutputStream (java.io.OutputStream out); | |
1.1# | public static void runFinalizersOnExit (boolean value); | |
} |
Returned By: Runtime.getRuntime()
RuntimeException | Java 1.0 | |
|
||
java.lang | serializable unchecked PJ1.1 |
This exception type is not used directly, but serves as a superclass of a group of run-time exceptions that need not be declared in the throws clause of a method definition. These exceptions need not be declared because they are runtime conditions that can generally occur in any Java method. Thus, declaring them would be unduly burdensome, and Java does not require it.
public class RuntimeException extends Exception { | ||
// | Public Constructors | |
public RuntimeException (); | ||
public RuntimeException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->RuntimeException
Subclasses: Too many classes to list.
RuntimePermission | Java 1.2 | |
|
||
java.lang | serializable permission |
This class is a java.security.Permission that represents access to various important system facilities. A RuntimePermission has a name, or target, that represents the facility for which permission is being sought or granted. The name "exitVM" represents permission to call System.exit(), and the name "accessClassInPackage.java.lang" represents permission to read classes from the java.lang package. The name of a RuntimePermission may use a ".*" suffix as a wildcard. For example, the name "accessClassInPackage.java.*" represents permission to read classes from any package whose name begins with "java.". RuntimePermission does not use action list strings as some Permission classes do; the name of the permission alone is enough.
Supported RuntimePermssion names are: "accessClassInPackage.package", "accessDeclaredMembers", "createClassLoader", "createSecurityManager", "defineClassInPackage.package", "exitVM", "getClassLoader", "getProtectionDomain", "loadLibrary.library_name", "modifyThread", "modifyThreadGroup", "queuePrintJob", "readFileDescriptor", "set-ContextClassLoader", "setFactory", "setIO", "setSecurityManager", "stopThread", and "writeFileDescriptor".
System administrators configuring security policies should be familiar with these permission names, the operations they govern access to, and with the risks inherent in granting any of them. Although system programmers may need to work with this class, application programmers should never need to use RuntimePermssion directly.
public final class RuntimePermission extends java.security.BasicPermission { | ||
// | Public Constructors | |
public RuntimePermission (String name); | ||
public RuntimePermission (String name, String actions); | ||
} |
Hierarchy: Object-->java.security.Permission(java.security.Guard,Serializable)-->java.security.BasicPermission(Serializable)-->RuntimePermission
SecurityException | Java 1.0 | |
|
||
java.lang | serializable unchecked PJ1.1 |
Signals that an operation is not permitted for security reasons.
public class SecurityException extends RuntimeException { | ||
// | Public Constructors | |
public SecurityException (); | ||
public SecurityException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->RuntimeException-->SecurityException
Subclasses: java.rmi.RMISecurityException, java.security.AccessControlException
Thrown By: Too many methods to list.
SecurityManager | Java 1.0 | |
|
||
java.lang | PJ1.1 |
This class defines the methods necessary to implement a security policy for the safe execution of untrusted code. Before performing potentially sensitive operations, Java calls methods of the SecurityManager object currently in effect to determine whether the operations are permitted. These methods throw a SecurityException if the operation is not permitted. Typical applications do not need to use or subclass SecurityManager. It is typically used only by web browsers, applet viewers, and other programs that need to run untrusted code in a controlled environment.
Prior to Java 1.2, this class is abstract, and the default implementation of each check() method throws a SecurityException unconditionally. The Java security mechanism has been overhauled as of Java 1.2. As part of the overhaul, this class is no longer abstract and its methods have useful default implementations, so there is rarely a need to subclass it. If so, the method returns silently; if not, it throws a SecurityException. checkPermission() operates by invoking the checkPermission() method of the system java.security.AccessController object. In Java 1.2 and later, all other check() methods of SecurityManager are now implemented on top of checkPermission().
public class SecurityManager { | ||
// | Public Constructors | |
public SecurityManager (); | ||
// | Property Accessor Methods (by property name) | |
public Object getSecurityContext (); | default:AccessControlContext | |
1.1 | public ThreadGroup getThreadGroup (); | |
// | Public Instance Methods | |
public void checkAccept (String host, int port); | ||
public void checkAccess (Thread t); | ||
public void checkAccess (ThreadGroup g); | ||
1.1 | public void checkAwtEventQueueAccess (); | |
public void checkConnect (String host, int port); | ||
public void checkConnect (String host, int port, Object context); | ||
public void checkCreateClassLoader (); | ||
public void checkDelete (String file); | ||
public void checkExec (String cmd); | ||
public void checkExit (int status); | ||
public void checkLink (String lib); | ||
public void checkListen (int port); | ||
1.1 | public void checkMemberAccess (Class clazz, int which); | |
1.1 | public void checkMulticast (java.net.InetAddress maddr); | |
1.1 | public void checkMulticast (java.net.InetAddress maddr, byte ttl); | |
public void checkPackageAccess (String pkg); | ||
public void checkPackageDefinition (String pkg); | ||
1.2 | public void checkPermission (java.security.Permission perm); | |
1.2 | public void checkPermission (java.security.Permission perm, Object context); | |
1.1 | public void checkPrintJobAccess (); | |
public void checkPropertiesAccess (); | ||
public void checkPropertyAccess (String key); | ||
public void checkRead (String file); | ||
public void checkRead (java.io.FileDescriptor fd); | ||
public void checkRead (String file, Object context); | ||
1.1 | public void checkSecurityAccess (String target); | |
public void checkSetFactory (); | ||
1.1 | public void checkSystemClipboardAccess (); | |
public boolean checkTopLevelWindow (Object window); | ||
public void checkWrite (String file); | ||
public void checkWrite (java.io.FileDescriptor fd); | ||
// | Protected Instance Methods | |
protected Class[ ] getClassContext (); | native | |
// | Deprecated Public Methods | |
# | public boolean getInCheck (); | default:false |
// | Deprecated Protected Methods | |
# | protected int classDepth (String name); | native |
# | protected int classLoaderDepth (); | |
# | protected ClassLoader currentClassLoader (); | |
1.1# | protected Class currentLoadedClass (); | |
# | protected boolean inClass (String name); | |
# | protected boolean inClassLoader (); | |
// | Deprecated Protected Fields | |
# | protected boolean inCheck ; | |
} |
Subclasses: java.rmi.RMISecurityManager
Passed To: System.setSecurityManager()
Returned By: System.getSecurityManager()
Short | Java 1.1 | |
|
||
java.lang | serializable comparable PJ1.1 |
This class provides an object wrapper around the short primitive type. It defines useful constants for the minimum and maximum values that can be stored by the short type, and also a Class object constant that represents the short type. It also provides various methods for converting Short values to and from strings and other numeric types.
Most of the static methods of this class can convert a String to a Short object or a short value; the four parseShort() and valueOf() methods parse a number from the specified string using an optionally specified radix and return it in one of these two forms. The decode() method parses a number specified in base 10, base 8, or base 16 and returns it as a Short. If the string begins with "0x" or "#", it is interpreted as a hexadecimal number; if it begins with "0", it is interpreted as an octal number. Otherwise, it is interpreted as a decimal number.
Note that this class has two different toString() methods. One is static and converts a short primitive value to a string. The other is the usual toString() method that converts a Short object to a string. Most of the remaining methods convert a Short to various primitive numeric types.
public final class Short extends Number implements Comparable { | ||
// | Public Constructors | |
public Short (short value); | ||
public Short (String s) throws NumberFormatException; | ||
// | Public Constants | |
public static final short MAX_VALUE ; | =32767 | |
public static final short MIN_VALUE ; | =-32768 | |
public static final Class TYPE ; | ||
// | Public Class Methods | |
public static Short decode (String nm) throws NumberFormatException; | ||
public static short parseShort (String s) throws NumberFormatException; | ||
public static short parseShort (String s, int radix) throws NumberFormatException; | ||
public static String toString (short s); | ||
public static Short valueOf (String s) throws NumberFormatException; | ||
public static Short valueOf (String s, int radix) throws NumberFormatException; | ||
// | Public Instance Methods | |
1.2 | public int compareTo (Short anotherShort); | |
// | Methods Implementing Comparable | |
1.2 | public int compareTo (Object o); | |
// | Public Methods Overriding Number | |
public byte byteValue (); | ||
public double doubleValue (); | ||
public float floatValue (); | ||
public int intValue (); | ||
public long longValue (); | ||
public short shortValue (); | ||
// | Public Methods Overriding Object | |
public boolean equals (Object obj); | ||
public int hashCode (); | ||
public String toString (); | ||
} |
Hierarchy: Object-->Number(Serializable)-->Short(Comparable)
Passed To: Short.compareTo()
Returned By: Short.{decode(), valueOf()}
StackOverflowError | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
Signals that a stack overflow has occurred within the Java interpreter.
public class StackOverflowError extends VirtualMachineError { | ||
// | Public Constructors | |
public StackOverflowError (); | ||
public StackOverflowError (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->VirtualMachineError-->StackOverflowError
StrictMath | Java 1.3 Beta | |
|
||
java.lang |
This class is identical to the Math class, but additionally requires that its methods strictly adhere to the behavior of certain published algorithms. The methods of StrictMath are intended to operate identically, down to the very least significant bit, for all possible arguments. When strict platform-independence of floating-point results is not required, use the Math class for better performance.
public final class StrictMath { | ||
// | No Constructor | |
// | Public Constants | |
public static final double E ; | =2.718281828459045 | |
public static final double PI ; | =3.141592653589793 | |
// | Public Class Methods | |
public static int abs (int a); | strictfp | |
public static long abs (long a); | strictfp | |
public static float abs (float a); | strictfp | |
public static double abs (double a); | strictfp | |
public static double acos (double a); | native strictfp | |
public static double asin (double a); | native strictfp | |
public static double atan (double a); | native strictfp | |
public static double atan2 (double a, double b); | native strictfp | |
public static double ceil (double a); | native strictfp | |
public static double cos (double a); | native strictfp | |
public static double exp (double a); | native strictfp | |
public static double floor (double a); | native strictfp | |
public static double IEEEremainder (double f1, double f2); | native strictfp | |
public static double log (double a); | native strictfp | |
public static int max (int a, int b); | strictfp | |
public static long max (long a, long b); | strictfp | |
public static float max (float a, float b); | strictfp | |
public static double max (double a, double b); | strictfp | |
public static int min (int a, int b); | strictfp | |
public static long min (long a, long b); | strictfp | |
public static float min (float a, float b); | strictfp | |
public static double min (double a, double b); | strictfp | |
public static double pow (double a, double b); | native strictfp | |
public static double random (); | strictfp | |
public static double rint (double a); | native strictfp | |
public static int round (float a); | strictfp | |
public static long round (double a); | strictfp | |
public static double sin (double a); | native strictfp | |
public static double sqrt (double a); | native strictfp | |
public static double tan (double a); | native strictfp | |
public static double toDegrees (double angrad); | strictfp | |
public static double toRadians (double angdeg); | strictfp | |
} |
String | Java 1.0 | |
|
||
java.lang | serializable comparable PJ1.1 |
The String class represents a string of characters. A String object is created by the Java compiler whenever it encounters a string in double quotes; this method of creation is typically simpler than using a constructor. Some methods of this class provide useful string-manipulation functions. length() returns the number of characters in a string. charAt() extracts a character from a string. compareTo() compares two strings, while equalsIgnoreCase() tests strings for equality, ignoring case. startsWith() and endsWith() compare the start and end of a string to a specified value. indexOf() and lastIndexOf() search forward and backward in a string for a specified character or substring. substring() returns a substring of a string. replace() creates a new copy of the string with one character replaced by another. toUpperCase() and toLowerCase() convert the case of a string. trim() strips whitespace from the start and end of a string. concat() concatenates two strings, which can also be done with the + operator. The static valueOf() methods convert various Java primitive types to strings.
Note that String objects are immutable; there is no setCharAt() method to change the contents. The methods above that return a String do not modify the string they are passed, but instead return a modified copy of the string. Use a StringBuffer if you want to manipulate the contents of a string or toCharArray() to convert a string to an array of char values.
public final class String implements ComparableSerializable { | ||
// | Public Constructors | |
public String (); | ||
1.1 | public String (byte[ ] bytes); | |
public String (StringBuffer buffer); | ||
public String (String value); | ||
public String (char[ ] value); | ||
1.1 | public String (byte[ ] bytes, String enc) throws java.io.UnsupportedEncodingException; | |
# | public String (byte[ ] ascii, int hibyte); | |
public String (char[ ] value, int offset, int count); | ||
1.1 | public String (byte[ ] bytes, int offset, int length); | |
1.1 | public String (byte[ ] bytes, int offset, int length, String enc) throws java.io.UnsupportedEncodingException; | |
# | public String (byte[ ] ascii, int hibyte, int offset, int count); | |
// | Public Constants | |
1.2 | public static final java.util.Comparator CASE_INSENSITIVE_ORDER ; | |
// | Public Class Methods | |
public static String copyValueOf (char[ ] data); | ||
public static String copyValueOf (char[ ] data, int offset, int count); | ||
public static String valueOf (long l); | ||
public static String valueOf (float f); | ||
public static String valueOf (double d); | ||
public static String valueOf (int i); | ||
public static String valueOf (Object obj); | ||
public static String valueOf (char[ ] data); | ||
public static String valueOf (char c); | ||
public static String valueOf (boolean b); | ||
public static String valueOf (char[ ] data, int offset, int count); | ||
// | Public Instance Methods | |
public char charAt (int index); | ||
public int compareTo (String anotherString); | ||
1.2 | public int compareToIgnoreCase (String str); | |
public String concat (String str); | ||
public boolean endsWith (String suffix); | ||
public boolean equalsIgnoreCase (String anotherString); | ||
1.1 | public byte[ ] getBytes (); | |
1.1 | public byte[ ] getBytes (String enc) throws java.io.UnsupportedEncodingException; | |
public void getChars (int srcBegin, int srcEnd, char[ ] dst, int dstBegin); | ||
public int indexOf (String str); | ||
public int indexOf (int ch); | ||
public int indexOf (int ch, int fromIndex); | ||
public int indexOf (String str, int fromIndex); | ||
public String intern (); | native | |
public int lastIndexOf (int ch); | ||
public int lastIndexOf (String str); | ||
public int lastIndexOf (int ch, int fromIndex); | ||
public int lastIndexOf (String str, int fromIndex); | ||
public int length (); | ||
public boolean regionMatches (int toffset, String other, int ooffset, int len); | ||
public boolean regionMatches (boolean ignoreCase, int toffset, String other, int ooffset, int len); | ||
public String replace (char oldChar, char newChar); | ||
public boolean startsWith (String prefix); | ||
public boolean startsWith (String prefix, int toffset); | ||
public String substring (int beginIndex); | ||
public String substring (int beginIndex, int endIndex); | ||
public char[ ] toCharArray (); | ||
public String toLowerCase (); | ||
1.1 | public String toLowerCase (java.util.Locale locale); | |
public String toUpperCase (); | ||
1.1 | public String toUpperCase (java.util.Locale locale); | |
public String trim (); | ||
// | Methods Implementing Comparable | |
1.2 | public int compareTo (Object o); | |
// | Public Methods Overriding Object | |
public boolean equals (Object anObject); | ||
public int hashCode (); | ||
public String toString (); | ||
// | Deprecated Public Methods | |
# | public void getBytes (int srcBegin, int srcEnd, byte[ ] dst, int dstBegin); | |
} |
Hierarchy: Object-->String(Comparable,Serializable)
Passed To: Too many methods to list.
Returned By: Too many methods to list.
Type Of: Too many fields to list.
StringBuffer | Java 1.0 | |
|
||
java.lang | serializable PJ1.1 |
This class represents a mutable string of characters that can grow or shrink as necessary. Its mutability makes it suitable for processing text in place, which is not possible with the immutable String class. Its resizability and the various methods it implements make it easier to use than a char[]. You can query the character stored at a given index with charAt() and set the character with setCharAt(). Use the various append() methods to append text to the end of the buffer. Use insert() to insert text at a specified position within the buffer. Note that arguments to append() and insert() are converted to strings as necessary before they are appended or inserted. Use toString() to convert the contents of a StringBuffer to a String object. In Java 1.2 and later, use deleteCharAt() or delete() to delete a single character or a range of characters from the buffer. Use replace() to replace a range of characters with a specified String, and use substring() to convert a portion of a StringBuffer to a String.
String concatenation in Java is performed with the + operator and is implemented using the append() method of a StringBuffer. After a string is processed in a StringBuffer object, it can be efficiently converted to a String object for subsequent use. The StringBuffer.toString() method is typically implemented so that it does not copy the internal array of characters. Instead, it shares that array with the new String object, making a new copy for itself only if and when further modifications are made to the StringBuffer object.
public final class StringBuffer implements Serializable { | ||
// | Public Constructors | |
public StringBuffer (); | ||
public StringBuffer (int length); | ||
public StringBuffer (String str); | ||
// | Public Instance Methods | |
public StringBuffer append (char[ ] str); | synchronized | |
public StringBuffer append (boolean b); | ||
public StringBuffer append (Object obj); | synchronized | |
public StringBuffer append (String str); | synchronized | |
public StringBuffer append (char c); | synchronized | |
public StringBuffer append (float f); | ||
public StringBuffer append (double d); | ||
public StringBuffer append (int i); | ||
public StringBuffer append (long l); | ||
public StringBuffer append (char[ ] str, int offset, int len); | synchronized | |
public int capacity (); | ||
public char charAt (int index); | synchronized | |
1.2 | public StringBuffer delete (int start, int end); | synchronized |
1.2 | public StringBuffer deleteCharAt (int index); | synchronized |
public void ensureCapacity (int minimumCapacity); | synchronized | |
public void getChars (int srcBegin, int srcEnd, char[ ] dst, int dstBegin); | synchronized | |
public StringBuffer insert (int offset, char[ ] str); | synchronized | |
public StringBuffer insert (int offset, boolean b); | ||
public StringBuffer insert (int offset, Object obj); | synchronized | |
public StringBuffer insert (int offset, String str); | synchronized | |
public StringBuffer insert (int offset, char c); | synchronized | |
public StringBuffer insert (int offset, float f); | ||
public StringBuffer insert (int offset, double d); | ||
public StringBuffer insert (int offset, int i); | ||
public StringBuffer insert (int offset, long l); | ||
1.2 | public StringBuffer insert (int index, char[ ] str, int offset, int len); | synchronized |
public int length (); | ||
1.2 | public StringBuffer replace (int start, int end, String str); | synchronized |
public StringBuffer reverse (); | synchronized | |
public void setCharAt (int index, char ch); | synchronized | |
public void setLength (int newLength); | synchronized | |
1.2 | public String substring (int start); | |
1.2 | public String substring (int start, int end); | synchronized |
// | Public Methods Overriding Object | |
public String toString (); | ||
} |
Hierarchy: Object-->StringBuffer(Serializable)
Passed To: Too many methods to list.
Returned By: Too many methods to list.
StringIndexOutOfBoundsException | Java 1.0 | |
|
||
java.lang | serializable unchecked PJ1.1 |
Signals that the index used to access a character of a String or StringBuffer is less than zero or is too large.
public class StringIndexOutOfBoundsException extends IndexOutOfBoundsException { | ||
// | Public Constructors | |
public StringIndexOutOfBoundsException (); | ||
public StringIndexOutOfBoundsException (int index); | ||
public StringIndexOutOfBoundsException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->RuntimeException-->IndexOutOfBoundsException-->StringIndexOutOfBoundsException
System | Java 1.0 | |
|
||
java.lang | PJ1.1 |
This class defines a platform-independent interface to system facilities, including system properties and system input and output streams. All methods and variables of this class are static, and the class cannot be instantiated. Because the methods defined by this class are low-level system methods, most require special permissions and cannot be executed by untrusted code.
getProperty() looks up a named property on the system-properties list, returning the optionally specified default value if no property definition is found. getProperties() returns the entire properties list. setProperties() sets a Properties object on the properties list. In Java 1.2 and later, setProperty() sets the value of a system property. The following table lists system properties that are always defined. Untrusted code may be unable to read some or all of these properties. Additional properties can be defined using the -D option when invoking the Java interpreter.
Property Name | Description |
---|---|
java.home | The directory Java is installed in |
java.class.path | Where classes are loaded from |
java.specification.version | Version of the Java API specification ( Java 1.2) |
java.specification.vendor | Vendor of the Java API specifiction ( Java 1.2) |
java.specification.name | Name of the Java API specification ( Java 1.2) |
java.version | Version of the Java API implementation |
java.vendor | Vendor of this Java API implementation |
java.vendor.url | URL of the vendor of this Java API implementation |
java.vm.specification.version | Version of the Java VM specification ( Java 1.2) |
java.vm.specification.vendor | Vendor of the Java VM specification ( Java 1.2) |
java.vm.specification.name | Name of the Java VM specification ( Java 1.2) |
java.vm.version | Version of the Java VM implementation ( Java 1.2) |
java.vm.vendor | Vendor of the Java VM implementation ( Java 1.2) |
java.vm.name | Name of the Java VM implementation ( Java 1.2) |
java.class.version | Version of the Java class file format |
os.name | Name of the host operating system |
os.arch | Host operating system architecture |
os.version | Version of the host operating system |
file.separator | Platform directory separator character |
path.separator | Platform path separator character |
line.separator | Platform line separator character(s) |
user.name | Current user's account name |
user.home | Home directory of current user |
user.dir | The current working directory |
The in, out, and err fields hold the standard input, output, and error streams for the system. These fields are frequently used in calls such as System.out.println(). In Java 1.1, setIn(), setOut(), and setErr() allow these streams to be redirected.
System also defines various other useful static methods. exit() causes the Java VM to exit. arraycopy() efficiently copies an array or a portion of an array into a destination array. currentTimeMillis() returns the current time in milliseconds since midnight GMT, January 1, 1970 GMT. gc() requests that the garbage collector perform a thorough garbage-collection pass, and runFinalization() requests that the garbage collector finalize all objects that are ready for finalization. Applications do not typically need to call these garbage-collection methods, but they can be useful when benchmarking code with currentTimeMillis(). identityHashCode() computes the hashcode for an object in the same way that the default Object.hashCode() method does. It does this regardless of whether or how the hashCode() method has been overridden. load() and loadLibrary() can read libraries of native code into the system. mapLibraryName() converts a system-independent library name into a system-dependent library filename. Finally, getSecurityManager() and setSecurityManager() get and set the system SecurityManager object responsible for the system security policy.
See also Runtime, which defines several other methods that provide low-level access to system facilities.
public final class System { | ||
// | No Constructor | |
// | Public Constants | |
public static final java.io.PrintStream err ; | ||
public static final java.io.InputStream in ; | ||
public static final java.io.PrintStream out ; | ||
// | Public Class Methods | |
public static void arraycopy (Object src, int src_position, Object dst, int dst_position, int length); | native | |
public static long currentTimeMillis (); | native | |
public static void exit (int status); | ||
public static void gc (); | ||
public static java.util.Properties getProperties (); | ||
public static String getProperty (String key); | ||
public static String getProperty (String key, String def); | ||
public static SecurityManager getSecurityManager (); | ||
1.1 | public static int identityHashCode (Object x); | native |
public static void load (String filename); | ||
public static void loadLibrary (String libname); | ||
1.2 | public static String mapLibraryName (String libname); | native |
public static void runFinalization (); | ||
1.1 | public static void setErr (java.io.PrintStream err); | |
1.1 | public static void setIn (java.io.InputStream in); | |
1.1 | public static void setOut (java.io.PrintStream out); | |
public static void setProperties (java.util.Properties props); | ||
1.2 | public static String setProperty (String key, String value); | |
public static void setSecurityManager (SecurityManager s); | ||
// | Deprecated Public Methods | |
# | public static String getenv (String name); | |
1.1# | public static void runFinalizersOnExit (boolean value); | |
} |
Thread | Java 1.0 | |
|
||
java.lang | runnable PJ1.1 |
This class encapsulates all information about a single thread of control running on the Java interpreter. To create a thread, you must either pass a Runnable object (i.e., an object that implements the Runnable interface by defining a run() method) to the Thread constructor or subclass Thread so that it defines its own run() method. The run() method of the Thread or of the specified Runnable object is the body of the thread. It begins executing when the start() method of the Thread object is called. The thread runs until the run() method returns. isAlive() returns true if a thread has been started, and the run() method has not yet exited.
The static methods of this class operate on the currently running thread. currentThread() returns the Thread object of the currently running code. sleep() makes the current thread stop for a specified amount of time. yield() makes the current thread give up control to any other threads of equal priority that are waiting to run.
The instance methods may be called by one thread to operate on a different thread. checkAccess() checks whether the running thread has permission to modify a Thread object and throws a SecurityException if it does not. join() waits for a thread to die. interrupt() wakes up a waiting or sleeping thread (with an InterruptedException) or sets an interrupted flag on a nonsleeping thread. A thread can test its own interrupted flag with the static interrupted() method or can test the flag of another thread with isInterrupted(). Calling interrupted() implicitly clears the interrupted flag, but calling isInterrupted() does not. Methods related to sleep() and interrupt() are the wait() and notify() methods defined by the Object class. Calling wait() causes the current thread to block until the object's notify() method is called by another thread.
setName() sets the name of a thread, which is purely optional. setPriority() sets the priority of the thread. Higher priority threads run before lower-priority threads. Java does not specify what happens to multiple threads of equal priority; some systems perform time-slicing and share the CPU between such threads. On other systems, one compute-bound thread that does not call yield() may starve another thread of the same priority. setDaemon() sets a boolean flag that specifies whether this thread is a daemon or not. The Java VM keeps running as long as at least one non-daemon thread is running. Call getThreadGroup() to obtain the ThreadGroup of which a thread is part. In Java 1.2 and later, use setContextClassLoader() to specify the ClassLoader to be used to load any classes required by the thread.
suspend(), resume(), and stop() suspend, resume, and stop a given thread, respectively, but all three methods are deprecated because they are inherently unsafe and can cause deadlock. If a thread must be stoppable, have it periodically check a flag and exit if the flag is set.
public class Thread implements Runnable { | ||
// | Public Constructors | |
public Thread (); | ||
public Thread (String name); | ||
public Thread (Runnable target); | ||
public Thread (Runnable target, String name); | ||
public Thread (ThreadGroup group, Runnable target); | ||
public Thread (ThreadGroup group, String name); | ||
public Thread (ThreadGroup group, Runnable target, String name); | ||
// | Public Constants | |
public static final int MAX_PRIORITY ; | =10 | |
public static final int MIN_PRIORITY ; | =1 | |
public static final int NORM_PRIORITY ; | =5 | |
// | Public Class Methods | |
public static int activeCount (); | ||
public static Thread currentThread (); | native | |
public static void dumpStack (); | ||
public static int enumerate (Thread[ ] tarray); | ||
public static boolean interrupted (); | ||
public static void sleep (long millis) throws InterruptedException; | native | |
public static void sleep (long millis, int nanos) throws InterruptedException; | ||
public static void yield (); | native | |
// | Property Accessor Methods (by property name) | |
public final boolean isAlive (); | native default:false | |
1.2 | public ClassLoader getContextClassLoader (); | |
1.2 | public void setContextClassLoader (ClassLoader cl); | |
public final boolean isDaemon (); | default:false | |
public final void setDaemon (boolean on); | ||
public boolean isInterrupted (); | default:false | |
public final String getName (); | default:"Thread-0" | |
public final void setName (String name); | ||
public final int getPriority (); | default:5 | |
public final void setPriority (int newPriority); | ||
public final ThreadGroup getThreadGroup (); | ||
// | Public Instance Methods | |
public final void checkAccess (); | ||
public void destroy (); | ||
public void interrupt (); | ||
public final void join () throws InterruptedException; | ||
public final void join (long millis) throws InterruptedException; | synchronized | |
public final void join (long millis, int nanos) throws InterruptedException; | synchronized | |
public void start (); | native synchronized | |
// | Methods Implementing Runnable | |
public void run (); | ||
// | Public Methods Overriding Object | |
public String toString (); | ||
// | Deprecated Public Methods | |
# | public int countStackFrames (); | native |
# | public final void resume (); | |
# | public final void stop (); | |
# | public final void stop (Throwable obj); | synchronized |
# | public final void suspend (); | |
} |
Hierarchy: Object-->Thread(Runnable)
Passed To: Runtime.{addShutdownHook(), removeShutdownHook()}, SecurityManager.checkAccess(), Thread.enumerate(), ThreadGroup.{enumerate(), uncaughtException()}
Returned By: Thread.currentThread(), javax.swing.text.AbstractDocument.getCurrentWriter()
ThreadDeath | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
Signals that a thread should terminate. This error is thrown in a thread when the Thread.stop() method is called for that thread. This is an unusual Error type that simply causes a thread to be terminated, but does not print an error message or cause the interpreter to exit. You can catch ThreadDeath errors to do any necessary cleanup for a thread, but if you do, you must rethrow the error so that the thread actually terminates.
public class ThreadDeath extends Error { | ||
// | Public Constructors | |
public ThreadDeath (); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->ThreadDeath
ThreadGroup | Java 1.0 | |
|
||
java.lang | PJ1.1 |
This class represents a group of threads and allows that group to be manipulated as a whole. A ThreadGroup can contain Thread objects, as well as other child ThreadGroup objects. All ThreadGroup objects are created as children of some other ThreadGroup, and thus there is a parent/child hierarchy of ThreadGroup objects. Use getParent() to obtain the parent ThreadGroup, and use activeCount(), activeGroupCount(), and the various enumerate() methods to list the child Thread and ThreadGroup objects. Most applications can simply rely on the default system thread group. System-level code and applications such as servers that need to create a large number of threads may find it convenient to create their own ThreadGroup objects, however.
interrupt() interrupts all threads in the group at once. setMaxPriority() specifies the maximum priority any thread in the group can have. checkAccess() checks whether the calling thread has permission to modify the given thread group. The method throws a SecurityException if the current thread does not have access. uncaughtException() contains the code that is run when a thread terminates because of an uncaught exception or error. You can customize this method by subclassing ThreadGroup.
public class ThreadGroup { | ||
// | Public Constructors | |
public ThreadGroup (String name); | ||
public ThreadGroup (ThreadGroup parent, String name); | ||
// | Property Accessor Methods (by property name) | |
public final boolean isDaemon (); | ||
public final void setDaemon (boolean daemon); | ||
1.1 | public boolean isDestroyed (); | synchronized |
public final int getMaxPriority (); | ||
public final void setMaxPriority (int pri); | ||
public final String getName (); | ||
public final ThreadGroup getParent (); | ||
// | Public Instance Methods | |
public int activeCount (); | ||
public int activeGroupCount (); | ||
public final void checkAccess (); | ||
public final void destroy (); | ||
public int enumerate (ThreadGroup[ ] list); | ||
public int enumerate (Thread[ ] list); | ||
public int enumerate (ThreadGroup[ ] list, boolean recurse); | ||
public int enumerate (Thread[ ] list, boolean recurse); | ||
1.2 | public final void interrupt (); | |
public void list (); | ||
public final boolean parentOf (ThreadGroup g); | ||
public void uncaughtException (Thread t, Throwable e); | ||
// | Public Methods Overriding Object | |
public String toString (); | ||
// | Deprecated Public Methods | |
1.1# | public boolean allowThreadSuspension (boolean b); | |
# | public final void resume (); | |
# | public final void stop (); | |
# | public final void suspend (); | |
} |
Passed To: SecurityManager.checkAccess(), Thread.Thread(), ThreadGroup.{enumerate(), parentOf(), ThreadGroup()}
Returned By: SecurityManager.getThreadGroup(), Thread.getThreadGroup(), ThreadGroup.getParent()
ThreadLocal | Java 1.2 | |
|
||
java.lang |
This class provides a convenient way to create thread-local variables. When you declare a static field in a class, there is only one value for that field, shared by all objects of the class. When you declare a nonstatic instance field in a class, every object of the class has its own separate copy of that variable. ThreadLocal provides an option between these two extremes. If you declare a static field to hold a ThreadLocal object, that ThreadLocal holds a different value for each thread. Objects running in the same thread see the same value when they call the get() method of the ThreadLocal object. Objects running in different threads obtain different values from get(), however.
The set() method sets the value held by the ThreadLocal object for the currently running thread. get() returns the value held for the currently running thread. Note that there is no way to obtain the value of the ThreadLocal object for any thread other than the one that calls get(). To understand the ThreadLocal class, you may find it helpful to think of a ThreadLocal object as a hashtable or java.util.Map that maps from Thread objects to arbitrary values. Calling set() creates an association between the current Thread (Thread.currentThread()) and the specified value. Calling get() first looks up the current thread, then uses the hashtable to look up the value associated with that current thread.
If a thread calls get() for the first time without having first called set() to establish a thread-local value, get() calls the protected initialValue() method to obtain the initial value to return. The default implementation of initialValue() simply returns null, but subclasses can override this if they desire.
See also InheritableThreadLocal, which allows thread-local values to be inherited from parent threads by child threads.
public class ThreadLocal { | ||
// | Public Constructors | |
public ThreadLocal (); | ||
// | Public Instance Methods | |
public Object get (); | ||
public void set (Object value); | ||
// | Protected Instance Methods | |
protected Object initialValue (); | constant | |
} |
Subclasses: InheritableThreadLocal
Throwable | Java 1.0 | |
|
||
java.lang | serializable PJ1.1 |
This is the root class of the Java exception and error hierarchy. All exceptions and errors are subclasses of Throwable. The getMessage() method retrieves any error message associated with the exception or error. printStackTrace() prints a stack trace that shows where the exception occurred. fillInStackTrace() extends the stack trace when the exception is partially handled and then rethrown.
public class Throwable implements Serializable { | ||
// | Public Constructors | |
public Throwable (); | ||
public Throwable (String message); | ||
// | Public Instance Methods | |
public Throwable fillInStackTrace (); | native | |
1.1 | public String getLocalizedMessage (); | default:null |
public String getMessage (); | default:null | |
public void printStackTrace (); | ||
public void printStackTrace (java.io.PrintStream s); | ||
1.1 | public void printStackTrace (java.io.PrintWriter s); | |
// | Public Methods Overriding Object | |
public String toString (); | ||
} |
Hierarchy: Object-->Throwable(Serializable)
Subclasses: Error, Exception
Passed To: Too many methods to list.
Returned By: ClassNotFoundException.getException(), ExceptionInInitializerError.getException(), Throwable.fillInStackTrace(), java.lang.reflect.InvocationTargetException.getTargetException(), java.lang.reflect.UndeclaredThrowableException.getUndeclaredThrowable(), javax.naming.NamingException.getRootCause(), javax.servlet.ServletException.getRootCause()
Thrown By: java.awt.AWTEvent.finalize(), java.awt.Font.finalize(), java.awt.Frame.finalize(), java.awt.Window.finalize(), Object.finalize(), java.lang.reflect.InvocationHandler.invoke(), javax.swing.text.AbstractDocument.AbstractElement.finalize()
Type Of: java.rmi.RemoteException.detail, java.rmi.activation.ActivationException.detail, javax.naming.NamingException.rootException, org.omg.CORBA.portable.UnknownException.originalEx
UnknownError | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
Signals that an unknown error has occurred at the level of the Java Virtual Machine.
public class UnknownError extends VirtualMachineError { | ||
// | Public Constructors | |
public UnknownError (); | ||
public UnknownError (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->VirtualMachineError-->UnknownError
UnsatisfiedLinkError | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
Signals that Java cannot satisfy all the links in a class that it has loaded.
public class UnsatisfiedLinkError extends LinkageError { | ||
// | Public Constructors | |
public UnsatisfiedLinkError (); | ||
public UnsatisfiedLinkError (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->LinkageError-->UnsatisfiedLinkError
UnsupportedClassVersionError | Java 1.2 | |
|
||
java.lang | serializable error |
Every Java class file contains a version number that specifies the version of the class file format. This error is thrown when the Java Virtual Machine attempts to read a class file with a version number it does not support.
public class UnsupportedClassVersionError extends ClassFormatError { | ||
// | Public Constructors | |
public UnsupportedClassVersionError (); | ||
public UnsupportedClassVersionError (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->LinkageError-->ClassFormatError-->UnsupportedClassVersionError
UnsupportedOperationException | Java 1.2 | |
|
||
java.lang | serializable unchecked |
Signals that a method you have called is not supported, and its implementation does not do anything (except throw this exception). This exception is used most often by the Java collection framework of java.util. Immutable or unmodifiable collections throw this exception when a modification method, such as add() or delete(), is called.
public class UnsupportedOperationException extends RuntimeException { | ||
// | Public Constructors | |
public UnsupportedOperationException (); | ||
public UnsupportedOperationException (String message); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->RuntimeException-->UnsupportedOperationException
VerifyError | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
Signals that a class has not passed the byte-code verification procedures.
public class VerifyError extends LinkageError { | ||
// | Public Constructors | |
public VerifyError (); | ||
public VerifyError (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->LinkageError-->VerifyError
VirtualMachineError | Java 1.0 | |
|
||
java.lang | serializable error PJ1.1 |
An abstract error type that serves as superclass for a group of errors related to the Java Virtual Machine. See InternalError, UnknownError, OutOfMemoryError, and StackOverflowError.
public abstract class VirtualMachineError extends Error { | ||
// | Public Constructors | |
public VirtualMachineError (); | ||
public VirtualMachineError (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Error-->VirtualMachineError
Subclasses: InternalError, OutOfMemoryError, StackOverflowError, UnknownError
Void | Java 1.1 | |
|
||
java.lang | PJ1.1 |
The Void class cannot be instantiated and serves merely as a placeholder for its static TYPE field, which is a Class object constant that represents the void type.
public final class Void { | ||
// | No Constructor | |
// | Public Constants | |
public static final Class TYPE ; | ||
} |
Copyright © 2001 O'Reilly & Associates. All rights reserved.
This HTML Help has been published using the chm2web software. |