Teach Yourself Java in 21 Days tyjxcx.htm

- C

- The Java Class Library

- java.lang

- (d)Interfaces
- Classes

- java.util

- Interfaces
- Classes

- java.io

- Interfaces
- Classes

- java.net

- Interfaces
- Classes

- java.awt

- Interfaces
- Classes

- java.awt.image

- Interfaces
- Classes

- java.awt.peer
- java.applet

- Interfaces
- Classes

#
C

## The Java Class Library

by Laura Lemay

This appendix provides a general overview of the classes available in the standard Java packages (that is, the classes that are guaranteed to be available in any Java implementation). This appendix is intended for general reference; for more information about class inheritance and the exceptions defined for each package, see Appendix B. For more specific information about each class and the methods within each class, see the API documentation from Sun at http://java.sun.com. A copy of the 1.0 API documentation is on the CD-ROM included with this book.

### java.lang

The java.lang package contains the classes and interfaces that make up the core Java language.

#### (d)Interfaces

Cloneable | Inteface indicating that an object may be copied or cloned
Runnable | Methods for classes that want to run as threads

#### Classes

Boolean | Object wrapper for boolean values
Character | Object wrapper for char values
Class | Run-time representations of classes
ClassLoader | Abstract behavior for handling loading of classes
Compiler | System class that gives access to the Java compiler
Double | Object wrapper for double values
Float | Object wrapper for float values
Integer | Object wrapper for int values
Long | Object wrapper for long values
Math | Utility class for math operations
Number | Abstract superclass of all number classes (Integer, Float, and so on)
Object | Generic Object class, at top of inheritance hierarchy
Process | Abstract behavior for processes such as those spawned using methods in the System class
Runtime | Access to the Java run-time
SecurityManager | Abstract behavior for implementing security policies
String | Character strings
StringBuffer | Mutable strings
System | Access to Java's system-level behavior, provided in a platform-independent way
Thread | Methods for managing threads and classes that run in threads
ThreadDeath | Class of object thrown when a thread is asynchronously terminated.
ThreadGroup | A group of threads
Throwable | Generic Exception class; all objects thrown must be a Throwable

### java.util

The java.util package contains various utility classes and interfaces, including random numbers, system properties, and other useful classes.

#### Interfaces

Enumeration | Methods for enumerating sets of values
Observer | Methods for allowing classes to observe Observable objects

#### Classes

BitSet | A set of bits
Date | The current system date, as well as methods for generating and parsing dates
Dictionary | An abstract class that maps between keys and values (superclass of HashTable)
Hashtable | A hash table
Observable | An abstract class for observable objects
Properties | A hashtable that contains behavior for setting and retrieving persistent properties of the system or of a class
Random | Utilities for generating random numbers
Stack | A stack (a last-in-first-out queue)
StringTokenizer | Utilities for splitting strings into a sequence of individual "tokens"
Vector | A growable array of Objects

### java.io

The java.io package provides input and output classes and interfaces for streams and files.

#### Interfaces

DataInput | Methods for reading machine-independent typed input streams
DataOutput | Methods for writing machine-independent typed output streams
FilenameFilter | Methods for filtering file names

#### Classes

BufferedInputStream | A buffered input stream
BufferedOutputStream | A buffered output stream
ByteArrayInputStream | An input stream from a byte array
ByteArrayOutputStream | An output stream to a byte array
DataInputStream | Enables you to read primitive Java types (ints, chars, booleans, and so on) from a stream in a machine-independent way
DataOutputStream | Enables you to write primitive Java data types (ints, chars, booleans, and so on) to a stream in a machine-independent way
File | Represents a file on the host's file system
FileDescriptor | Holds onto the UNIX-like file descriptor of a file or socket
FileInputStream | An input stream from a file, constructed using a filename or descriptor
FileOutputStream | An output stream to a file, constructed using a filename or descriptor
FilterInputStream | Abstract class which provides a filter for input streams (and for adding stream functionality such as buffering)
FilterOutputStream | Abstract class which provides a filter for output streams (and for adding stream functionality such as buffering)
InputStream | An abstract class representing an input stream of bytes; the parent of all input streams in this package
LineNumberInputStream | An input stream that keeps track of line numbers
OutputStream | An abstract class representing an output stream of bytes; the parent of all output streams in this package
PipedInputStream | A piped input stream, which should be connected to a PipedOutputStream to be useful
PipedOutputStream | A piped output stream, which should be connected to a PipedInputStream to be useful (together they provide safe communication between threads)
PrintStream | An output stream for printing (used by System.out.println(...))
PushbackInputStream | An input stream with a 1-byte push back buffer
RandomAccessFile | Provides random-access to a file, constructed from filenames, descriptors, or objects
SequenceInputStream | Converts a sequence of input streams into a single input steam
StreamTokenizer | Converts an input stream into a sequence of individual tokens
StringBufferInputStream | An input stream from a String object

### java.net

The java.net package contains classes and interfaces for performing network operations, such as sockets and URLs.

#### Interfaces

ContentHandlerFactory | Methods for creating ContentHandler objects
SocketImplFactory | Methods for creating socket implementations (instance of the SocketImpl class)
URLStreamHandlerFactory | Methods for creating URLStreamHandler objects

#### Classes

ContentHandler | Abstract behavior for reading data from a URL connection and constructing the appropriate local object, based on MIME types
DatagramPacket | A datagram packet (UDP)
DatagramSocket | A datagram socket
InetAddress | An object representation of an Internet host (host name, IP address)
ServerSocket | A server-side socket
Socket | A socket
SocketImpl | An abstract class for specific socket implementations
URL | An object representation of a URL
URLConnection | Abstract behavior for a socket that can handle various Web-based protocols (http, ftp, and so on)
URLEucoder | Turns strings into x-www-form-urlencoded format
URLStreamHandler | Abstract class for managing streams to object referenced by URLs

### java.awt

The java.awt package contains the classes and interfaces that make up the Abstract Windowing Toolkit.

#### Interfaces

LayoutManager | Methods for laying out containers
MenuContainer | Methods for menu-related containers

#### Classes

BorderLayout | A layout manager for arranging items in border formation
Button | A UI pushbutton
Canvas | A canvas for drawing and performing other graphics operations
CardLayout | A layout manager for HyperCard-like metaphors
Checkbox | A checkbox
CheckboxGroup | A group of exclusive checkboxes (radio buttons)
CheckboxMenuItem | A toggle menu item
Choice | A popup menu of choices
Color | An abstract representation of a color
Component | The abstract generic class for all UI components
Container | Abstract behavior for a component that can hold other components or containers
Dialog | A window for brief interactions with users
Dimension | An object representing width and height
Event | An object representing events caused by the system or based on user input
FileDialog | A dialog for getting file names from the local file system
FlowLayout | A layout manager that lays out objects from left to right in rows
Font | An abstract representation of a font
FontMetrics | Abstract class for holding information about a specific font's character shapes and height and width infor-mation
Frame | A top-level window with a title
Graphics | Abstract behavior for representing a graphics context, and for drawing and painting shapes and objects
GridBagConstraints | Constraints for components laid out using GridBagLayout
GridBagLayout | A layout manager that aligns components horizontally and vertically based on their values from GridBagConstraints
GridLayout | A layout manager with rows and columns; elements are added to each cell in the grid
Image | An abstract representation of a bitmap image
Insets | Distances from the outer border of the window; used to lay out components
Label | A text label for UI components
List | A scrolling list
MediaTracker | A way to keep track of the status of media objects being loaded over the net
Menu | A menu, which can contain menu items and is a container on a menubar
MenuBar | A menubar (container for menus)
MenuComponent | The abstract superclass of all menu elements
MenuItem | An individual menu item
Panel | A container that is displayed
Point | An object representing a point (x and y coordinates)
Polygon | An object representing a set of points
Rectangle | An object representing a rectangle (x and y coordinates for the top corner, plus width and height)
Scrollbar | A UI scrollbar object
TextArea | A multiline, scrollable, editable text field
TextComponent | The superclass of all editable text components
TextField | A fixed-size editable text field
Toolkit | Abstract behavior for binding the abstract AWT classes to a platform-specific toolkit implementation
Window | A top-level window, and the superclass of the Frame and Dialog classes

### java.awt.image

The java.awt.image package is a subpackage of the AWT that provides classes for managing bitmap images.

#### Interfaces

ImageConsumer | Methods for receiving image data created by an ImageProducer
ImageObserver | Methods to track the loading and construction of an image
ImageProducer | Methods for producing image data received by an ImageConsumer

#### Classes

ColorModel | An abstract class for managing color information for images
CropImageFilter | A filter for cropping images to a particular size
DirectColorModel | A specific color model for managing and translating pixel color values
FilteredImageSource | An ImageProducer that takes an image and an ImageFilter object and produces an image for an ImageConsumer
ImageFilter | A filter that takes image data from an ImageProducer, modifies it in some way, and hands it off to a ImageConsumer
IndexColorModel | A specific color model for managing and translating color values in a fixed-color map
MemoryImageSource | An image producer that gets its image from memory; used after constructing an image by hand
PixelGrabber | An ImageConsumer that retrieves a subset of the pixels in an image
RGBImageFilter | Abstract behavior for a filter that modifies the RGB values of pixels in RGB images

### java.awt.peer

The java.awt.peer package is a subpackage of AWT that provides the (hidden) platform-specific AWT classes (for example, for Motif, Macintosh, or Windows 95) with platform-independent interfaces to implement. Thus, callers using these interfaces need not know which platform's window system these hidden AWT classes are currently implementing.

Each class in the AWT that inherits from either Component or MenuComponent has a corresponding peer class. Each of those classes is the name of the Component with -Peer added (for example, ButtonPeer, DialogPeer, and WindowPeer). Because each one provides similar behavior, they are not enumerated here.

### java.applet

The java.applet package provides applet-specific behavior.

#### Interfaces

AppletContext | Methods to refer to the applet's context
AppletStub | Methods for implementing applet viewers
AudioClip | Methods for playing audio files

#### Classes

Applet | The base applet class