 Java API

Java API Packages

  • package java.applet
  • package java.awt
  • package java.awt.datatransfer
  • package java.awt.event
  • package java.awt.image
  • package java.beans
  • package java.io
  • package java.lang
  • package java.lang.reflect
  • package java.math
  • package java.net
  • package java.security
  • package java.security.acl
  • package java.security.interfaces
  • package java.sql
  • package java.text
  • package java.util
  • package java.util.zip


 Package java.applet

Package java.applet

All Packages

Interfaces

  • AppletContext
  • AppletStub
  • AudioClip

    • Classes

  • Applet


 Class Applet

Class java.applet.Applet

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----java.applet.Applet

public class Applet
extends Panel

An applet is a small program that is intended not to be run on its own, but rather to be embedded inside another application.

The Applet class must be the superclass of any applet that is to be embedded in a Web page or viewed by the Java Applet Viewer. The Applet class provides a standard interface between applets and their environment.


 Applet Members

Applet Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Applet() |

Methods
Name | Description
destroy() | Called by the browser or applet viewer to inform this applet that it is being reclaimed and that it should destroy any resources that it has allocated.
getAppletContext() | Determines this applet's context, which allows the applet to query and affect the environment in which it runs.
getAppletInfo() | Returns information about this applet.
getAudioClip(URL) | Returns the AudioClip object specified by the URL argument.
getAudioClip(URL, String) | Returns the AudioClip object specified by the URL and name arguments.
getCodeBase() | Gets the base URL.
getDocumentBase() | Gets the document URL.
getImage(URL) | Returns an Image object that can then be painted on the screen.
getImage(URL, String) | Returns an Image object that can then be painted on the screen.
getLocale() | Gets the Locale for the applet, if it has been set.
getParameter(String) | Returns the value of the named parameter in the HTML tag.
getParameterInfo() | Returns information about the parameters than are understood by this applet.
init() | Called by the browser or applet viewer to inform this applet that it has been loaded into the system.
isActive() | Determines if this applet is active.
play(URL) | Plays the audio clip at the specified absolute URL.
play(URL, String) | Plays the audio clip given the URL and a specifier that is relative to it.
resize(Dimension) | Requests that this applet be resized.
resize(int, int) | Requests that this applet be resized.
setStub(AppletStub) | Sets this applet's stub.
showStatus(String) | Requests that the argument string be displayed in the "status window".
start() | Called by the browser or applet viewer to inform this applet that it should start its execution.
stop() | Called by the browser or applet viewer to inform this applet that it should stop its execution.


 Applet.Applet

Applet.Applet

Class Overview | Class Members | This Package | All Packages

Syntax
public Applet()


 Applet.destroy

Applet.destroy

Syntax
public void destroy()
Description
Called by the browser or applet viewer to inform this applet that it is being reclaimed and that it should destroy any resources that it has allocated. The stop method will always be called before destroy.

A subclass of Applet should override this method if it has any operation that it wants to perform before it is destroyed. For example, an applet with threads would use the init method to create the threads and the destroy method to kill them.

The implementation of this method provided by the Applet class does nothing.

See Also
init, start, stop


 Applet.getAppletContext

Applet.getAppletContext

Syntax
public AppletContext getAppletContext()
Returns
the applet's context.
Description
Determines this applet's context, which allows the applet to query and affect the environment in which it runs.

This environment of an applet represents the document that contains the applet.


 Applet.getAppletInfo

Applet.getAppletInfo

Syntax
public String getAppletInfo()
Returns
a string containing information about the author, version, and copyright of the applet.
Description
Returns information about this applet. An applet should override this method to return a String containing information about the author, version, and copyright of the applet.

The implementation of this method provided by the Applet class returns null.


 Applet.getAudioClip

Applet.getAudioClip

Syntax 1
public AudioClip getAudioClip( URL url )
Parameters
url
an absolute URL giving the location of the audio clip.
Returns
the audio clip at the specified URL.
Description
Returns the AudioClip object specified by the URL argument.

This method always returns immediately, whether or not the audio clip exists. When this applet attempts to play the audio clip, the data will be loaded.

See Also
AudioClip

Syntax 2
public AudioClip getAudioClip( URL url, String name )
Parameters
url
an absolute URL giving the base location of the audio clip.
name
the location of the audio clip, relative to the url argument.
Returns
the audio clip at the specified URL.
Description
Returns the AudioClip object specified by the URL and name arguments.

This method always returns immediately, whether or not the audio clip exists. When this applet attempts to play the audio clip, the data will be loaded.

See Also
AudioClip


 Applet.getCodeBase

Applet.getCodeBase

Syntax
public URL getCodeBase()
Returns
the URL of this applet.
Description
Gets the base URL. This is the URL of the applet itself.

See Also
getDocumentBase


 Applet.getDocumentBase

Applet.getDocumentBase

Syntax
public URL getDocumentBase()
Returns
the URL of the document that contains this applet.
Description
Gets the document URL. This is the URL of the document in which the applet is embedded.

See Also
getCodeBase


 Applet.getImage

Applet.getImage

Syntax 1
public Image getImage( URL url )
Parameters
url
an absolute URL giving the location of the image.
Returns
the image at the specified URL.
Description
Returns an Image object that can then be painted on the screen. The url that is passed as an argument must specify an absolute URL.

This method always returns immediately, whether or not the image exists. When this applet attempts to draw the image on the screen, the data will be loaded. The graphics primitives that draw the image will incrementally paint on the screen.

See Also
Image

Syntax 2
public Image getImage( URL url, String name )
Parameters
url
an absolute URL giving the base location of the image.
name
the location of the image, relative to the url argument.
Returns
the image at the specified URL.
Description
Returns an Image object that can then be painted on the screen. The url argument must specify an absolute URL. The name argument is a specifier that is relative to the url argument.

This method always returns immediately, whether or not the image exists. When this applet attempts to draw the image on the screen, the data will be loaded. The graphics primitives that draw the image will incrementally paint on the screen.

See Also
Image


 Applet.getLocale

Applet.getLocale

Syntax
public Locale getLocale()
Returns
A Locale object.
Description
Gets the Locale for the applet, if it has been set. If no Locale has been set, then the default Locale is returned.

Overrides
getLocale in class Component


 Applet.getParameter

Applet.getParameter

Syntax
public String getParameter( String name )
Parameters
name
a parameter name.
Returns
the value of the named parameter.
Description
Returns the value of the named parameter in the HTML tag. For example, if this applet is specified as
    <applet code="Clock" width=50 height=50>
    <param name=Color value="blue">
    </applet>

then a call to getParameter("Color") returns the value "blue".

The name argument is case insensitive.


 Applet.getParameterInfo

Applet.getParameterInfo

Syntax
public String[][] getParameterInfo()
Returns
an array describing the parameters this applet looks for.
Description
Returns information about the parameters than are understood by this applet. An applet should override this method to return an array of Strings describing these parameters.

Each element of the array should be a set of three Strings containing the name, the type, and a description. For example:

 String pinfo[][] = {
     {"fps",    "1-10",    "frames per second"},
     {"repeat", "boolean", "repeat image loop"},
     {"imgs",   "url",     "images directory"}
 };

The implementation of this method provided by the Applet class returns null.


 Applet.init

Applet.init

Syntax
public void init()
Description
Called by the browser or applet viewer to inform this applet that it has been loaded into the system. It is always called before the first time that the start method is called.

A subclass of Applet should override this method if it has initialization to perform. For example, an applet with threads would use the init method to create the threads and the destroy method to kill them.

The implementation of this method provided by the Applet class does nothing.

See Also
destroy, start, stop


 Applet.isActive

Applet.isActive

Syntax
public boolean isActive()
Returns
true if the applet is active; false otherwise.
Description
Determines if this applet is active. An applet is marked active just before its start method is called. It becomes inactive immediately after its stop method is called.

See Also
start, stop


 Applet.play

Applet.play

Syntax 1
public void play( URL url )
Parameters
url
an absolute URL giving the location of the audio clip.
Description
Plays the audio clip at the specified absolute URL. Nothing happens if the audio clip cannot be found.

Syntax 2
public void play( URL url, String name )
Parameters
url
an absolute URL giving the base location of the audio clip.
name
the location of the audio clip, relative to the url argument.
Description
Plays the audio clip given the URL and a specifier that is relative to it. Nothing happens if the audio clip cannot be found.


 Applet.resize

Applet.resize

Syntax 1
public void resize( int width, int height )
Parameters
width
the new requested width for the applet.
height
the new requested height for the applet.
Description
Requests that this applet be resized.

Overrides
resize in class Component

Syntax 2
public void resize( Dimension d )
Parameters
d
an object giving the new width and height.
Description
Requests that this applet be resized.

Overrides
resize in class Component


 Applet.setStub

Applet.setStub

Syntax
public final void setStub( AppletStub stub )
Parameters
stub
the new stub.
Description
Sets this applet's stub. This is done automatically by the system.


 Applet.showStatus

Applet.showStatus

Syntax
public void showStatus( String msg )
Parameters
msg
a string to display in the status window.
Description
Requests that the argument string be displayed in the "status window". Many browsers and applet viewers provide such a window, where the application can inform users of its current state.


 Applet.start

Applet.start

Syntax
public void start()
Description
Called by the browser or applet viewer to inform this applet that it should start its execution. It is called after the init method and each time the applet is revisited in a Web page.

A subclass of Applet should override this method if it has any operation that it wants to perform each time the Web page containing it is visited. For example, an applet with animation might want to use the start method to resume animation, and the stop method to suspend the animation.

The implementation of this method provided by the Applet class does nothing.

See Also
destroy, init, stop


 Applet.stop

Applet.stop

Syntax
public void stop()
Description
Called by the browser or applet viewer to inform this applet that it should stop its execution. It is called when the Web page that contains this applet has been replaced by another page, and also just before the applet is to be destroyed.

A subclass of Applet should override this method if it has any operation that it wants to perform each time the Web page containing it is no longer visible. For example, an applet with animation might want to use the start method to resume animation, and the stop method to suspend the animation.

The implementation of this method provided by the Applet class does nothing.

See Also
destroy, init


 Interface AppletContext

Interface java.applet.AppletContext

Interface Members | This Package | All Packages

public interface AppletContext

This interface corresponds to an applet's environment: the document containing the applet and the other applets in the same document.

The methods in this interface can be used by an applet to obtain information about its environment.


 AppletContext Members

AppletContext Members

Interface Overview | This Package | All Packages

Methods
Name | Description
getApplet(String) | Finds and returns the applet in the document represented by this applet context with the given name.
getApplets() | Finds all the applets in the document represented by this applet context.
getAudioClip(URL) | Creates an audio clip.
getImage(URL) | Returns an Image object that can then be painted on the screen.
showDocument(URL) | Replaces the Web page currently being viewed with the given URL.
showDocument(URL, String) | Requests that the browser or applet viewer show the Web page indicated by the url argument.
showStatus(String) | Requests that the argument string be displayed in the "status window".


 AppletContext.getApplet

AppletContext.getApplet

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Applet getApplet( String name )
Parameters
name
an applet name.
Returns
the applet with the given name, or null if not found.
Description
Finds and returns the applet in the document represented by this applet context with the given name. The name can be set in the HTML tag by setting the name attribute.


 AppletContext.getApplets

AppletContext.getApplets

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Enumeration getApplets()
Returns
an enumeration of all applets in the document represented by this applet context.
Description
Finds all the applets in the document represented by this applet context.


 AppletContext.getAudioClip

AppletContext.getAudioClip

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract AudioClip getAudioClip( URL url )
Parameters
url
an absolute URL giving the location of the audio clip.
Returns
the audio clip at the specified URL.
Description
Creates an audio clip.


 AppletContext.getImage

AppletContext.getImage

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Image getImage( URL url )
Parameters
url
an absolute URL giving the location of the image.
Returns
the image at the specified URL.
Description
Returns an Image object that can then be painted on the screen. The url argument that is passed as an argument must specify an absolute URL.

This method always returns immediately, whether or not the image exists. When the applet attempts to draw the image on the screen, the data will be loaded. The graphics primitives that draw the image will incrementally paint on the screen.

See Also
Image


 AppletContext.showDocument

AppletContext.showDocument

Interface Overview | Interface Members | This Package | All Packages

Syntax 1
public abstract void showDocument( URL url )
Parameters
url
an absolute URL giving the location of the document.
Description
Replaces the Web page currently being viewed with the given URL. This method may be ignored by applet contexts that are not browsers.

Syntax 2
public abstract void showDocument( URL url, String target )
Parameters
url
an absolute URL giving the location of the document.
target
a String indicating where to display the page.
Description
Requests that the browser or applet viewer show the Web page indicated by the url argument. The target argument indicates where to display the frame. The target argument is interpreted as follows:

"_self" | show in the current frame
"_parent" | show in the parent frame
"_top" | show in the topmost frame
"_blank" | show in a new unnamed top-level window
name | show in a new top-level window named name

An applet viewer or browser is free to ignore showDocument.


 AppletContext.showStatus

AppletContext.showStatus

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void showStatus( String status )
Parameters
status
a string to display in the status window.
Description
Requests that the argument string be displayed in the "status window". Many browsers and applet viewers provide such a window, where the application can inform users of its current state.


 Interface AppletStub

Interface java.applet.AppletStub

Interface Members | This Package | All Packages

public interface AppletStub

When an applet is first created, an applet stub is attached to it using the applet's setStub method. This stub serves as the interface between the applet and the browser environment or applet viewer environment in which the application is running.

See Also:
setStub


 AppletStub Members

AppletStub Members

Interface Overview | This Package | All Packages

Methods
Name | Description
appletResize(int, int) | Called when the applet wants to be resized.
getAppletContext() | Gets a handler to the applet's context.
getCodeBase() | Gets the base URL.
getDocumentBase() | Gets the document URL.
getParameter(String) | Returns the value of the named parameter in the HTML tag.
isActive() | Determines if the applet is active.


 AppletStub.appletResize

AppletStub.appletResize

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void appletResize( int width, int height )
Parameters
width
the new requested width for the applet.
height
the new requested height for the applet.
Description
Called when the applet wants to be resized.


 AppletStub.getAppletContext

AppletStub.getAppletContext

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract AppletContext getAppletContext()
Returns
the applet's context.
Description
Gets a handler to the applet's context.


 AppletStub.getCodeBase

AppletStub.getCodeBase

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract URL getCodeBase()
Returns
the URL of the applet.
Description
Gets the base URL.


 AppletStub.getDocumentBase

AppletStub.getDocumentBase

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract URL getDocumentBase()
Returns
the URL of the document containing the applet.
Description
Gets the document URL.


 AppletStub.getParameter

AppletStub.getParameter

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getParameter( String name )
Parameters
name
a parameter name.
Returns
the value of the named parameter.
Description
Returns the value of the named parameter in the HTML tag. For example, if an applet is specified as
    <applet code="Clock" width=50 height=50>
    <param name=Color value="blue">
    </applet>

then a call to getParameter("Color") returns the value "blue".


 AppletStub.isActive

AppletStub.isActive

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isActive()
Returns
true if the applet is active; false otherwise.
Description
Determines if the applet is active. An applet is active just before its start method is called. It becomes inactive immediately after its stop method is called.


 Interface AudioClip

Interface java.applet.AudioClip

Interface Members | This Package | All Packages

public interface AudioClip

The AudioClip interface is a simple abstraction for playing a sound clip. Multiple AudioClip items can be playing at the same time, and the resulting sound is mixed together to produce a composite.


 AudioClip Members

AudioClip Members

Interface Overview | This Package | All Packages

Methods
Name | Description
loop() | Starts playing this audio clip in a loop.
play() | Starts playing this audio clip.
stop() | Stops playing this audio clip.


 AudioClip.loop

AudioClip.loop

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void loop()
Description
Starts playing this audio clip in a loop.


 AudioClip.play

AudioClip.play

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void play()
Description
Starts playing this audio clip. Each time this method is called, the clip is restarted from the beginning.


 AudioClip.stop

AudioClip.stop

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void stop()
Description
Stops playing this audio clip.


 Package java.awt

Package java.awt

All Packages

Interfaces

  • Adjustable
  • ItemSelectable
  • LayoutManager
  • LayoutManager2
  • MenuContainer
  • PrintGraphics
  • Shape

    • Classes

  • AWTEvent
  • AWTEventMulticaster
  • BorderLayout
  • Button
  • Canvas
  • CardLayout
  • Checkbox
  • CheckboxGroup
  • CheckboxMenuItem
  • Choice
  • Color
  • Component
  • Container
  • Cursor
  • Dialog
  • Dimension
  • Event
  • EventQueue
  • FileDialog
  • FlowLayout
  • Font
  • FontMetrics
  • Frame
  • Graphics
  • GridBagConstraints
  • GridBagLayout
  • GridLayout
  • Image
  • Insets
  • Label
  • List
  • MediaTracker
  • Menu
  • MenuBar
  • MenuComponent
  • MenuItem
  • MenuShortcut
  • Panel
  • Point
  • Polygon
  • PopupMenu
  • PrintJob
  • Rectangle
  • ScrollPane
  • Scrollbar
  • SystemColor
  • TextArea
  • TextComponent
  • TextField
  • Toolkit
  • Window

    • Exceptions

  • AWTException
  • IllegalComponentStateException

    • Errors

  • AWTError


 Class AWTError

Class java.awt.AWTError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.awt.AWTError

public class AWTError
extends Error

Thrown when a serious Abstract Window Toolkit error has occurred.


 AWTError Members

AWTError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
AWTError(String) | Constructs an instance of AWTError with the specified detail message.


 AWTError.AWTError

AWTError.AWTError

Syntax
public AWTError( String msg )
Parameters
msg
the detail message.
Description
Constructs an instance of AWTError with the specified detail message.


 Class AWTEvent

Class java.awt.AWTEvent

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.EventObject
           |
           +----java.awt.AWTEvent

public abstract class AWTEvent
extends EventObject

The root event class for all AWT events. This class and its subclasses supercede the original java.awt.Event class. Subclasses of this root AWTEvent class defined outside of the java.awt.event package should define event ID values greater than the value defined by RESERVED_ID_MAX. The event masks defined in this class are needed ONLY by component subclasses which are using Component.enableEvents() to select for event types not selected by registered listeners. If a listener is registered on a component, the appropriate event mask is already set internally by the component.

See Also:
enableEvents, ComponentEvent, FocusEvent, KeyEvent, MouseEvent, WindowEvent, ActionEvent, AdjustmentEvent, ItemEvent, TextEvent


 AWTEvent Members

AWTEvent Members

Class Overview | This Package | All Packages

Fields
Name | Description
ACTION_EVENT_MASK | The event mask for selecting action events.
ADJUSTMENT_EVENT_MASK | The event mask for selecting adjustment events.
COMPONENT_EVENT_MASK | The event mask for selecting component events.
consumed |
CONTAINER_EVENT_MASK | The event mask for selecting container events.
FOCUS_EVENT_MASK | The event mask for selecting focus events.
id |
ITEM_EVENT_MASK | The event mask for selecting item events.
KEY_EVENT_MASK | The event mask for selecting key events.
MOUSE_EVENT_MASK | The event mask for selecting mouse events.
MOUSE_MOTION_EVENT_MASK | The event mask for selecting mouse motion events.
RESERVED_ID_MAX | The maximum value for reserved AWT event IDs.
TEXT_EVENT_MASK | The event mask for selecting text events.
WINDOW_EVENT_MASK | The event mask for selecting window events.

Constructors
Name | Description
AWTEvent(Event) | Constructs an AWTEvent object from the parameters of a 1.0-style event.
AWTEvent(Object, int) | Constructs an AWTEvent object with the specified source object and type.

Methods
Name | Description
consume() |
getID() | Returns the event type.
isConsumed() |
paramString() |
toString() | Returns a string representation of the object.


 AWTEvent.ACTION_EVENT_MASK

AWTEvent.ACTION_EVENT_MASK

Syntax
public static final long ACTION_EVENT_MASK
Description
The event mask for selecting action events.


 AWTEvent.ADJUSTMENT_EVENT_MASK

AWTEvent.ADJUSTMENT_EVENT_MASK

Syntax
public static final long ADJUSTMENT_EVENT_MASK
Description
The event mask for selecting adjustment events.


 AWTEvent.COMPONENT_EVENT_MASK

AWTEvent.COMPONENT_EVENT_MASK

Syntax
public static final long COMPONENT_EVENT_MASK
Description
The event mask for selecting component events.


 AWTEvent.consumed

AWTEvent.consumed

Syntax
protected boolean consumed


 AWTEvent.CONTAINER_EVENT_MASK

AWTEvent.CONTAINER_EVENT_MASK

Syntax
public static final long CONTAINER_EVENT_MASK
Description
The event mask for selecting container events.


 AWTEvent.FOCUS_EVENT_MASK

AWTEvent.FOCUS_EVENT_MASK

Syntax
public static final long FOCUS_EVENT_MASK
Description
The event mask for selecting focus events.


 AWTEvent.id

AWTEvent.id

Syntax
protected int id


 AWTEvent.ITEM_EVENT_MASK

AWTEvent.ITEM_EVENT_MASK

Syntax
public static final long ITEM_EVENT_MASK
Description
The event mask for selecting item events.


 AWTEvent.KEY_EVENT_MASK

AWTEvent.KEY_EVENT_MASK

Syntax
public static final long KEY_EVENT_MASK
Description
The event mask for selecting key events.


 AWTEvent.MOUSE_EVENT_MASK

AWTEvent.MOUSE_EVENT_MASK

Syntax
public static final long MOUSE_EVENT_MASK
Description
The event mask for selecting mouse events.


 AWTEvent.MOUSE_MOTION_EVENT_MASK

AWTEvent.MOUSE_MOTION_EVENT_MASK

Syntax
public static final long MOUSE_MOTION_EVENT_MASK
Description
The event mask for selecting mouse motion events.


 AWTEvent.RESERVED_ID_MAX

AWTEvent.RESERVED_ID_MAX

Syntax
public static final int RESERVED_ID_MAX
Description
The maximum value for reserved AWT event IDs. Programs defining their own event IDs should use IDs greater than this value.


 AWTEvent.TEXT_EVENT_MASK

AWTEvent.TEXT_EVENT_MASK

Syntax
public static final long TEXT_EVENT_MASK
Description
The event mask for selecting text events.


 AWTEvent.WINDOW_EVENT_MASK

AWTEvent.WINDOW_EVENT_MASK

Syntax
public static final long WINDOW_EVENT_MASK
Description
The event mask for selecting window events.


 AWTEvent.AWTEvent

AWTEvent.AWTEvent

Syntax 1
public AWTEvent( Event event )
Parameters
event
the old-style event
Description
Constructs an AWTEvent object from the parameters of a 1.0-style event.

Syntax 2
public AWTEvent( Object source, int id )
Parameters
source
the object where the event originated
Description
Constructs an AWTEvent object with the specified source object and type.


 AWTEvent.consume

AWTEvent.consume

Syntax
protected void consume()


 AWTEvent.getID

AWTEvent.getID

Syntax
public int getID()
Description
Returns the event type.


 AWTEvent.isConsumed

AWTEvent.isConsumed

Syntax
protected boolean isConsumed()


 AWTEvent.paramString

AWTEvent.paramString

Syntax
public String paramString()


 AWTEvent.toString

AWTEvent.toString

Syntax
public String toString()
Description
Returns a string representation of the object.

Overrides
toString in class EventObject


 Class AWTEventMulticaster

Class java.awt.AWTEventMulticaster

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.AWTEventMulticaster

public class AWTEventMulticaster
extends Object
implements ComponentListener, ContainerListener, FocusListener, KeyListener, MouseListener, MouseMotionListener, WindowListener, ActionListener, ItemListener, AdjustmentListener, TextListener

A class which implements efficient and thread-safe multi-cast event dispatching for the AWT events defined in the java.awt.event package. This class will manage an immutable structure consisting of a chain of event listeners and will dispatch events to those listeners. Because the structure is immutable, it is safe to use this API to add/remove listeners during the process of an event dispatch operation. An example of how this class could be used to implement a new component which fires "action" events:

 public myComponent extends Component {
     ActionListener actionListener = null;
     public void addActionListener(ActionListener l) {
       actionListener = AWTEventMulticaster.add(actionListener, l);
     }
     public void removeActionListener(ActionListener l) {
         actionListener = AWTEventMulticaster.remove(actionListener, l);
     }
     public void processEvent(AWTEvent e) {
         // when event occurs which causes "action" semantic
         if (actionListener != null) {
             actionListener.actionPerformed(new ActionEvent());
         }
 }


 AWTEventMulticaster Members

AWTEventMulticaster Members

Class Overview | This Package | All Packages

Fields
Name | Description
a |
b |

Constructors
Name | Description
AWTEventMulticaster(EventListener, EventListener) | Creates an event multicaster instance which chains listener-a with listener-b.

Methods
Name | Description
actionPerformed(ActionEvent) | Handles the actionPerformed event by invoking the actionPerformed methods on listener-a and listener-b.
add(ActionListener, ActionListener) | Adds action-listener-a with action-listener-b and returns the resulting multicast listener.
add(AdjustmentListener, AdjustmentListener) | Adds adjustment-listener-a with adjustment-listener-b and returns the resulting multicast listener.
add(ComponentListener, ComponentListener) | Adds component-listener-a with component-listener-b and returns the resulting multicast listener.
add(ContainerListener, ContainerListener) | Adds container-listener-a with container-listener-b and returns the resulting multicast listener.
add(FocusListener, FocusListener) | Adds focus-listener-a with focus-listener-b and returns the resulting multicast listener.
add(ItemListener, ItemListener) | Adds item-listener-a with item-listener-b and returns the resulting multicast listener.
add(KeyListener, KeyListener) | Adds key-listener-a with key-listener-b and returns the resulting multicast listener.
add(MouseListener, MouseListener) | Adds mouse-listener-a with mouse-listener-b and returns the resulting multicast listener.
add(MouseMotionListener, MouseMotionListener) | Adds mouse-motion-listener-a with mouse-motion-listener-b and returns the resulting multicast listener.
add(TextListener, TextListener) |
add(WindowListener, WindowListener) | Adds window-listener-a with window-listener-b and returns the resulting multicast listener.
addInternal(EventListener, EventListener) | Returns the resulting multicast listener from adding listener-a and listener-b together.
adjustmentValueChanged(AdjustmentEvent) | Handles the adjustmentValueChanged event by invoking the adjustmentValueChanged methods on listener-a and listener-b.
componentAdded(ContainerEvent) | Handles the componentAdded container event by invoking the componentAdded methods on listener-a and listener-b.
componentHidden(ComponentEvent) | Handles the componentHidden event by invoking the componentHidden methods on listener-a and listener-b.
componentMoved(ComponentEvent) | Handles the componentMoved event by invoking the componentMoved methods on listener-a and listener-b.
componentRemoved(ContainerEvent) | Handles the componentRemoved container event by invoking the componentRemoved methods on listener-a and listener-b.
componentResized(ComponentEvent) | Handles the componentResized event by invoking the componentResized methods on listener-a and listener-b.
componentShown(ComponentEvent) | Handles the componentShown event by invoking the componentShown methods on listener-a and listener-b.
focusGained(FocusEvent) | Handles the focusGained event by invoking the focusGained methods on listener-a and listener-b.
focusLost(FocusEvent) | Handles the focusLost event by invoking the focusLost methods on listener-a and listener-b.
itemStateChanged(ItemEvent) | Handles the itemStateChanged event by invoking the itemStateChanged methods on listener-a and listener-b.
keyPressed(KeyEvent) | Handles the keyPressed event by invoking the keyPressed methods on listener-a and listener-b.
keyReleased(KeyEvent) | Handles the keyReleased event by invoking the keyReleased methods on listener-a and listener-b.
keyTyped(KeyEvent) | Handles the keyTyped event by invoking the keyTyped methods on listener-a and listener-b.
mouseClicked(MouseEvent) | Handles the mouseClicked event by invoking the mouseClicked methods on listener-a and listener-b.
mouseDragged(MouseEvent) | Handles the mouseDragged event by invoking the mouseDragged methods on listener-a and listener-b.
mouseEntered(MouseEvent) | Handles the mouseEntered event by invoking the mouseEntered methods on listener-a and listener-b.
mouseExited(MouseEvent) | Handles the mouseExited event by invoking the mouseExited methods on listener-a and listener-b.
mouseMoved(MouseEvent) | Handles the mouseMoved event by invoking the mouseMoved methods on listener-a and listener-b.
mousePressed(MouseEvent) | Handles the mousePressed event by invoking the mousePressed methods on listener-a and listener-b.
mouseReleased(MouseEvent) | Handles the mouseReleased event by invoking the mouseReleased methods on listener-a and listener-b.
remove(ActionListener, ActionListener) | Removes the old action-listener from action-listener-l and returns the resulting multicast listener.
remove(AdjustmentListener, AdjustmentListener) | Removes the old adjustment-listener from adjustment-listener-l and returns the resulting multicast listener.
remove(ComponentListener, ComponentListener) | Removes the old component-listener from component-listener-l and returns the resulting multicast listener.
remove(ContainerListener, ContainerListener) | Removes the old container-listener from container-listener-l and returns the resulting multicast listener.
remove(EventListener) | Removes a listener from this multicaster and returns the resulting multicast listener.
remove(FocusListener, FocusListener) | Removes the old focus-listener from focus-listener-l and returns the resulting multicast listener.
remove(ItemListener, ItemListener) | Removes the old item-listener from item-listener-l and returns the resulting multicast listener.
remove(KeyListener, KeyListener) | Removes the old key-listener from key-listener-l and returns the resulting multicast listener.
remove(MouseListener, MouseListener) | Removes the old mouse-listener from mouse-listener-l and returns the resulting multicast listener.
remove(MouseMotionListener, MouseMotionListener) | Removes the old mouse-motion-listener from mouse-motion-listener-l and returns the resulting multicast listener.
remove(TextListener, TextListener) |
remove(WindowListener, WindowListener) | Removes the old window-listener from window-listener-l and returns the resulting multicast listener.
removeInternal(EventListener, EventListener) | Returns the resulting multicast listener after removing the old listener from listener-l.
save(ObjectOutputStream, String, EventListener) |
saveInternal(ObjectOutputStream, String) |
textValueChanged(TextEvent) |
windowActivated(WindowEvent) | Handles the windowActivated event by invoking the windowActivated methods on listener-a and listener-b.
windowClosed(WindowEvent) | Handles the windowClosed event by invoking the windowClosed methods on listener-a and listener-b.
windowClosing(WindowEvent) | Handles the windowClosing event by invoking the windowClosing methods on listener-a and listener-b.
windowDeactivated(WindowEvent) | Handles the windowDeactivated event by invoking the windowDeactivated methods on listener-a and listener-b.
windowDeiconified(WindowEvent) | Handles the windowDeiconfied event by invoking the windowDeiconified methods on listener-a and listener-b.
windowIconified(WindowEvent) | Handles the windowIconified event by invoking the windowIconified methods on listener-a and listener-b.
windowOpened(WindowEvent) | Handles the windowOpened event by invoking the windowOpened methods on listener-a and listener-b.


 AWTEventMulticaster.a

AWTEventMulticaster.a

Syntax
protected final EventListener a


 AWTEventMulticaster.b

AWTEventMulticaster.b

Syntax
protected final EventListener b


 AWTEventMulticaster.AWTEventMulticaster

AWTEventMulticaster.AWTEventMulticaster

Syntax
protected AWTEventMulticaster( EventListener a, EventListener b )
Parameters
a
listener-a
b
listener-b
Description
Creates an event multicaster instance which chains listener-a with listener-b.


 AWTEventMulticaster.actionPerformed

AWTEventMulticaster.actionPerformed

Syntax
public void actionPerformed( ActionEvent e )
Parameters
e
the action event
Description
Handles the actionPerformed event by invoking the actionPerformed methods on listener-a and listener-b.


 AWTEventMulticaster.add

AWTEventMulticaster.add

Syntax 1
public static ComponentListener add( ComponentListener a, ComponentListener b )
Parameters
a
component-listener-a
b
component-listener-b
Description
Adds component-listener-a with component-listener-b and returns the resulting multicast listener.

Syntax 2
public static ContainerListener add( ContainerListener a, ContainerListener b )
Parameters
a
container-listener-a
b
container-listener-b
Description
Adds container-listener-a with container-listener-b and returns the resulting multicast listener.

Syntax 3
public static FocusListener add( FocusListener a, FocusListener b )
Parameters
a
focus-listener-a
b
focus-listener-b
Description
Adds focus-listener-a with focus-listener-b and returns the resulting multicast listener.

Syntax 4
public static KeyListener add( KeyListener a, KeyListener b )
Parameters
a
key-listener-a
b
key-listener-b
Description
Adds key-listener-a with key-listener-b and returns the resulting multicast listener.

Syntax 5
public static MouseListener add( MouseListener a, MouseListener b )
Parameters
a
mouse-listener-a
b
mouse-listener-b
Description
Adds mouse-listener-a with mouse-listener-b and returns the resulting multicast listener.

Syntax 6
public static MouseMotionListener add( MouseMotionListener a, MouseMotionListener b )
Parameters
a
mouse-motion-listener-a
b
mouse-motion-listener-b
Description
Adds mouse-motion-listener-a with mouse-motion-listener-b and returns the resulting multicast listener.

Syntax 7
public static WindowListener add( WindowListener a, WindowListener b )
Parameters
a
window-listener-a
b
window-listener-b
Description
Adds window-listener-a with window-listener-b and returns the resulting multicast listener.

Syntax 8
public static ActionListener add( ActionListener a, ActionListener b )
Parameters
a
action-listener-a
b
action-listener-b
Description
Adds action-listener-a with action-listener-b and returns the resulting multicast listener.

Syntax 9
public static ItemListener add( ItemListener a, ItemListener b )
Parameters
a
item-listener-a
b
item-listener-b
Description
Adds item-listener-a with item-listener-b and returns the resulting multicast listener.

Syntax 10
public static AdjustmentListener add( AdjustmentListener a, AdjustmentListener b )
Parameters
a
adjustment-listener-a
b
adjustment-listener-b
Description
Adds adjustment-listener-a with adjustment-listener-b and returns the resulting multicast listener.

Syntax 11
public static TextListener add( TextListener a, TextListener b )


 AWTEventMulticaster.addInternal

AWTEventMulticaster.addInternal

Syntax
protected static EventListener addInternal( EventListener a, EventListener b )
Parameters
a
event listener-a
b
event listener-b
Description
Returns the resulting multicast listener from adding listener-a and listener-b together. If listener-a is null, it returns listener-b; If listener-b is null, it returns listener-a If neither are null, then it creates and returns a new AWTEventMulticaster instance which chains a with b.


 AWTEventMulticaster.adjustmentValueChanged

AWTEventMulticaster.adjustmentValueChanged

Syntax
public void adjustmentValueChanged( AdjustmentEvent e )
Parameters
e
the adjustment event
Description
Handles the adjustmentValueChanged event by invoking the adjustmentValueChanged methods on listener-a and listener-b.


 AWTEventMulticaster.componentAdded

AWTEventMulticaster.componentAdded

Syntax
public void componentAdded( ContainerEvent e )
Parameters
e
the component event
Description
Handles the componentAdded container event by invoking the componentAdded methods on listener-a and listener-b.


 AWTEventMulticaster.componentHidden

AWTEventMulticaster.componentHidden

Syntax
public void componentHidden( ComponentEvent e )
Parameters
e
the component event
Description
Handles the componentHidden event by invoking the componentHidden methods on listener-a and listener-b.


 AWTEventMulticaster.componentMoved

AWTEventMulticaster.componentMoved

Syntax
public void componentMoved( ComponentEvent e )
Parameters
e
the component event
Description
Handles the componentMoved event by invoking the componentMoved methods on listener-a and listener-b.


 AWTEventMulticaster.componentRemoved

AWTEventMulticaster.componentRemoved

Syntax
public void componentRemoved( ContainerEvent e )
Parameters
e
the component event
Description
Handles the componentRemoved container event by invoking the componentRemoved methods on listener-a and listener-b.


 AWTEventMulticaster.componentResized

AWTEventMulticaster.componentResized

Syntax
public void componentResized( ComponentEvent e )
Parameters
e
the component event
Description
Handles the componentResized event by invoking the componentResized methods on listener-a and listener-b.


 AWTEventMulticaster.componentShown

AWTEventMulticaster.componentShown

Syntax
public void componentShown( ComponentEvent e )
Parameters
e
the component event
Description
Handles the componentShown event by invoking the componentShown methods on listener-a and listener-b.


 AWTEventMulticaster.focusGained

AWTEventMulticaster.focusGained

Syntax
public void focusGained( FocusEvent e )
Parameters
e
the focus event
Description
Handles the focusGained event by invoking the focusGained methods on listener-a and listener-b.


 AWTEventMulticaster.focusLost

AWTEventMulticaster.focusLost

Syntax
public void focusLost( FocusEvent e )
Parameters
e
the focus event
Description
Handles the focusLost event by invoking the focusLost methods on listener-a and listener-b.


 AWTEventMulticaster.itemStateChanged

AWTEventMulticaster.itemStateChanged

Syntax
public void itemStateChanged( ItemEvent e )
Parameters
e
the item event
Description
Handles the itemStateChanged event by invoking the itemStateChanged methods on listener-a and listener-b.


 AWTEventMulticaster.keyPressed

AWTEventMulticaster.keyPressed

Syntax
public void keyPressed( KeyEvent e )
Parameters
e
the key event
Description
Handles the keyPressed event by invoking the keyPressed methods on listener-a and listener-b.


 AWTEventMulticaster.keyReleased

AWTEventMulticaster.keyReleased

Syntax
public void keyReleased( KeyEvent e )
Parameters
e
the key event
Description
Handles the keyReleased event by invoking the keyReleased methods on listener-a and listener-b.


 AWTEventMulticaster.keyTyped

AWTEventMulticaster.keyTyped

Syntax
public void keyTyped( KeyEvent e )
Parameters
e
the key event
Description
Handles the keyTyped event by invoking the keyTyped methods on listener-a and listener-b.


 AWTEventMulticaster.mouseClicked

AWTEventMulticaster.mouseClicked

Syntax
public void mouseClicked( MouseEvent e )
Parameters
e
the mouse event
Description
Handles the mouseClicked event by invoking the mouseClicked methods on listener-a and listener-b.


 AWTEventMulticaster.mouseDragged

AWTEventMulticaster.mouseDragged

Syntax
public void mouseDragged( MouseEvent e )
Parameters
e
the mouse event
Description
Handles the mouseDragged event by invoking the mouseDragged methods on listener-a and listener-b.


 AWTEventMulticaster.mouseEntered

AWTEventMulticaster.mouseEntered

Syntax
public void mouseEntered( MouseEvent e )
Parameters
e
the mouse event
Description
Handles the mouseEntered event by invoking the mouseEntered methods on listener-a and listener-b.


 AWTEventMulticaster.mouseExited

AWTEventMulticaster.mouseExited

Syntax
public void mouseExited( MouseEvent e )
Parameters
e
the mouse event
Description
Handles the mouseExited event by invoking the mouseExited methods on listener-a and listener-b.


 AWTEventMulticaster.mouseMoved

AWTEventMulticaster.mouseMoved

Syntax
public void mouseMoved( MouseEvent e )
Parameters
e
the mouse event
Description
Handles the mouseMoved event by invoking the mouseMoved methods on listener-a and listener-b.


 AWTEventMulticaster.mousePressed

AWTEventMulticaster.mousePressed

Syntax
public void mousePressed( MouseEvent e )
Parameters
e
the mouse event
Description
Handles the mousePressed event by invoking the mousePressed methods on listener-a and listener-b.


 AWTEventMulticaster.mouseReleased

AWTEventMulticaster.mouseReleased

Syntax
public void mouseReleased( MouseEvent e )
Parameters
e
the mouse event
Description
Handles the mouseReleased event by invoking the mouseReleased methods on listener-a and listener-b.


 AWTEventMulticaster.remove

AWTEventMulticaster.remove

Syntax
protected EventListener remove( EventListener oldl )
Parameters
oldl
the listener to be removed
Description
Removes a listener from this multicaster and returns the resulting multicast listener.


 AWTEventMulticaster.remove

AWTEventMulticaster.remove

Syntax 1
public static ComponentListener remove( ComponentListener l, ComponentListener oldl )
Parameters
l
component-listener-l
oldl
the component-listener being removed
Description
Removes the old component-listener from component-listener-l and returns the resulting multicast listener.

Syntax 2
public static ContainerListener remove( ContainerListener l, ContainerListener oldl )
Parameters
l
container-listener-l
oldl
the container-listener being removed
Description
Removes the old container-listener from container-listener-l and returns the resulting multicast listener.

Syntax 3
public static FocusListener remove( FocusListener l, FocusListener oldl )
Parameters
l
focus-listener-l
oldl
the focus-listener being removed
Description
Removes the old focus-listener from focus-listener-l and returns the resulting multicast listener.

Syntax 4
public static KeyListener remove( KeyListener l, KeyListener oldl )
Parameters
l
key-listener-l
oldl
the key-listener being removed
Description
Removes the old key-listener from key-listener-l and returns the resulting multicast listener.

Syntax 5
public static MouseListener remove( MouseListener l, MouseListener oldl )
Parameters
l
mouse-listener-l
oldl
the mouse-listener being removed
Description
Removes the old mouse-listener from mouse-listener-l and returns the resulting multicast listener.

Syntax 6
public static MouseMotionListener remove( MouseMotionListener l, MouseMotionListener oldl )
Parameters
l
mouse-motion-listener-l
oldl
the mouse-motion-listener being removed
Description
Removes the old mouse-motion-listener from mouse-motion-listener-l and returns the resulting multicast listener.

Syntax 7
public static WindowListener remove( WindowListener l, WindowListener oldl )
Parameters
l
window-listener-l
oldl
the window-listener being removed
Description
Removes the old window-listener from window-listener-l and returns the resulting multicast listener.

Syntax 8
public static ActionListener remove( ActionListener l, ActionListener oldl )
Parameters
l
action-listener-l
oldl
the action-listener being removed
Description
Removes the old action-listener from action-listener-l and returns the resulting multicast listener.

Syntax 9
public static ItemListener remove( ItemListener l, ItemListener oldl )
Parameters
l
item-listener-l
oldl
the item-listener being removed
Description
Removes the old item-listener from item-listener-l and returns the resulting multicast listener.

Syntax 10
public static AdjustmentListener remove( AdjustmentListener l, AdjustmentListener oldl )
Parameters
l
adjustment-listener-l
oldl
the adjustment-listener being removed
Description
Removes the old adjustment-listener from adjustment-listener-l and returns the resulting multicast listener.

Syntax 11
public static TextListener remove( TextListener l, TextListener oldl )


 AWTEventMulticaster.removeInternal

AWTEventMulticaster.removeInternal

Syntax
protected static EventListener removeInternal( EventListener l, EventListener oldl )
Parameters
l
the listener being removed from
oldl
the listener being removed
Description
Returns the resulting multicast listener after removing the old listener from listener-l. If listener-l equals the old listener OR listener-l is null, returns null. Else if listener-l is an instance of AWTEventMulticaster, then it removes the old listener from it. Else, returns listener l.


 AWTEventMulticaster.save

AWTEventMulticaster.save

Syntax
protected static void save( ObjectOutputStream s, String k, EventListener l ) throws IOException


 AWTEventMulticaster.saveInternal

AWTEventMulticaster.saveInternal

Syntax
protected void saveInternal( ObjectOutputStream s, String k ) throws IOException


 AWTEventMulticaster.textValueChanged

AWTEventMulticaster.textValueChanged

Syntax
public void textValueChanged( TextEvent e )


 AWTEventMulticaster.windowActivated

AWTEventMulticaster.windowActivated

Syntax
public void windowActivated( WindowEvent e )
Parameters
e
the window event
Description
Handles the windowActivated event by invoking the windowActivated methods on listener-a and listener-b.


 AWTEventMulticaster.windowClosed

AWTEventMulticaster.windowClosed

Syntax
public void windowClosed( WindowEvent e )
Parameters
e
the window event
Description
Handles the windowClosed event by invoking the windowClosed methods on listener-a and listener-b.


 AWTEventMulticaster.windowClosing

AWTEventMulticaster.windowClosing

Syntax
public void windowClosing( WindowEvent e )
Parameters
e
the window event
Description
Handles the windowClosing event by invoking the windowClosing methods on listener-a and listener-b.


 AWTEventMulticaster.windowDeactivated

AWTEventMulticaster.windowDeactivated

Syntax
public void windowDeactivated( WindowEvent e )
Parameters
e
the window event
Description
Handles the windowDeactivated event by invoking the windowDeactivated methods on listener-a and listener-b.


 AWTEventMulticaster.windowDeiconified

AWTEventMulticaster.windowDeiconified

Syntax
public void windowDeiconified( WindowEvent e )
Parameters
e
the window event
Description
Handles the windowDeiconfied event by invoking the windowDeiconified methods on listener-a and listener-b.


 AWTEventMulticaster.windowIconified

AWTEventMulticaster.windowIconified

Syntax
public void windowIconified( WindowEvent e )
Parameters
e
the window event
Description
Handles the windowIconified event by invoking the windowIconified methods on listener-a and listener-b.


 AWTEventMulticaster.windowOpened

AWTEventMulticaster.windowOpened

Syntax
public void windowOpened( WindowEvent e )
Parameters
e
the window event
Description
Handles the windowOpened event by invoking the windowOpened methods on listener-a and listener-b.


 Class AWTException

Class java.awt.AWTException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.awt.AWTException

public class AWTException
extends Exception

Signals that an Absract Window Toolkit exception has occurred.


 AWTException Members

AWTException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
AWTException(String) | Constructs an instance of AWTException with the specified detail message.


 AWTException.AWTException

AWTException.AWTException

Syntax
public AWTException( String msg )
Parameters
msg
the detail message
Description
Constructs an instance of AWTException with the specified detail message. A detail message is an instance of String that describes this particular exception.


 Interface Adjustable

Interface java.awt.Adjustable

Interface Members | This Package | All Packages

public interface Adjustable

The interface for objects which have an adjustable numeric value contained within a bounded range of values.


 Adjustable Members

Adjustable Members

Interface Overview | This Package | All Packages

Fields
Name | Description
HORIZONTAL | The horizontal orientation.
VERTICAL | The vertical orientation.

Methods
Name | Description
addAdjustmentListener(AdjustmentListener) | Add a listener to recieve adjustment events when the value of the adjustable object changes.
getBlockIncrement() | Gets the block value increment for the adjustable object.
getMaximum() | Gets the maximum value of the adjustable object.
getMinimum() | Gets the minimum value of the adjustable object.
getOrientation() | Gets the orientation of the adjustable object.
getUnitIncrement() | Gets the unit value increment for the adjustable object.
getValue() | Gets the current value of the adjustable object.
getVisibleAmount() | Gets the length of the propertional indicator.
removeAdjustmentListener(AdjustmentListener) | Removes an adjustment listener.
setBlockIncrement(int) | Sets the block value increment for the adjustable object.
setMaximum(int) | Sets the maximum value of the adjustable object.
setMinimum(int) | Sets the minimum value of the adjustable object.
setUnitIncrement(int) | Sets the unit value increment for the adjustable object.
setValue(int) | Sets the current value of the adjustable object.
setVisibleAmount(int) | Sets the length of the proportionl indicator of the adjustable object.


 Adjustable.HORIZONTAL

Adjustable.HORIZONTAL

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int HORIZONTAL
Description
The horizontal orientation.


 Adjustable.VERTICAL

Adjustable.VERTICAL

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int VERTICAL
Description
The vertical orientation.


 Adjustable.addAdjustmentListener

Adjustable.addAdjustmentListener

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void addAdjustmentListener( AdjustmentListener l )
Parameters
l
the listener to recieve events
Description
Add a listener to recieve adjustment events when the value of the adjustable object changes.

See Also
AdjustmentEvent


 Adjustable.getBlockIncrement

Adjustable.getBlockIncrement

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getBlockIncrement()
Description
Gets the block value increment for the adjustable object.


 Adjustable.getMaximum

Adjustable.getMaximum

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaximum()
Description
Gets the maximum value of the adjustable object.


 Adjustable.getMinimum

Adjustable.getMinimum

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMinimum()
Description
Gets the minimum value of the adjustable object.


 Adjustable.getOrientation

Adjustable.getOrientation

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getOrientation()
Description
Gets the orientation of the adjustable object.


 Adjustable.getUnitIncrement

Adjustable.getUnitIncrement

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getUnitIncrement()
Description
Gets the unit value increment for the adjustable object.


 Adjustable.getValue

Adjustable.getValue

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getValue()
Description
Gets the current value of the adjustable object.


 Adjustable.getVisibleAmount

Adjustable.getVisibleAmount

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getVisibleAmount()
Description
Gets the length of the propertional indicator.


 Adjustable.removeAdjustmentListener

Adjustable.removeAdjustmentListener

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void removeAdjustmentListener( AdjustmentListener l )
Parameters
l
the listener being removed
Description
Removes an adjustment listener.

See Also
AdjustmentEvent


 Adjustable.setBlockIncrement

Adjustable.setBlockIncrement

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setBlockIncrement( int b )
Parameters
b
the block increment
Description
Sets the block value increment for the adjustable object.


 Adjustable.setMaximum

Adjustable.setMaximum

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setMaximum( int max )
Parameters
max
the maximum value
Description
Sets the maximum value of the adjustable object.


 Adjustable.setMinimum

Adjustable.setMinimum

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setMinimum( int min )
Parameters
min
the minimum value
Description
Sets the minimum value of the adjustable object.


 Adjustable.setUnitIncrement

Adjustable.setUnitIncrement

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setUnitIncrement( int u )
Parameters
u
the unit increment
Description
Sets the unit value increment for the adjustable object.


 Adjustable.setValue

Adjustable.setValue

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setValue( int v )
Parameters
v
the current value
Description
Sets the current value of the adjustable object. This value must be within the range defined by the minimum and maximum values for this object.


 Adjustable.setVisibleAmount

Adjustable.setVisibleAmount

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setVisibleAmount( int v )
Parameters
v
the length of the indicator
Description
Sets the length of the proportionl indicator of the adjustable object.


 Class BorderLayout

Class java.awt.BorderLayout

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.BorderLayout

public class BorderLayout
extends Object
implements LayoutManager2, Serializable

A border layout lays out a container, arranging and resizing its components to fit in five regions: North, South, East, West, and Center. When adding a component to a container with a border layout, use one of these five names, for example:

    Panel p = new Panel();
    p.setLayout(new BorderLayout());
    p.add(new Button("Okay"), "South");
As a convenience, BorderLayout interprets the absence of a string specification the same as "Center":
    Panel p2 = new Panel();
    p2.setLayout(new BorderLayout());
    p2.add(new TextArea());  // Same as p.add(new TextArea(), "Center");

The components are laid out according to their preferred sizes and the constraints of the container's size. The North and South components may be stretched horizontally; the East and West components may be stretched vertically; the Center component may stretch both horizontally and vertically to fill any space left over.

Here is an example of five buttons in an applet laid out using the BorderLayout layout manager:

The code for this applet is as follows:

 import java.awt.*;
 import java.applet.Applet;
 public class buttonDir extends Applet {
   public void init() {
     setLayout(new BorderLayout());
     add("North",  new Button("North"));
     add("South",  new Button("South"));
     add("East",   new Button("East"));
     add("West",   new Button("West"));
     add("Center", new Button("Center"));
   }
 }

See Also:
add


 BorderLayout Members

BorderLayout Members

Class Overview | This Package | All Packages

Fields
Name | Description
CENTER | The center layout constraint (middle of container).
EAST | The east layout constraint (left side of container).
NORTH | The north layout constraint (top of container).
SOUTH | The south layout constraint (bottom of container).
WEST | The west layout constraint (right side of container).

Constructors
Name | Description
BorderLayout() | Constructs a new border layout with no gaps between components.
BorderLayout(int, int) | Constructs a border layout with the specified gaps between components.

Methods
Name | Description
addLayoutComponent(Component, Object) | Adds the specified component to the layout, using the specified constraint object.
addLayoutComponent(String, Component) | Deprecated.
getHgap() | Returns the horizontal gap between components.
getLayoutAlignmentX(Container) | Returns the alignment along the x axis.
getLayoutAlignmentY(Container) | Returns the alignment along the y axis.
getVgap() | Returns the vertical gap between components.
invalidateLayout(Container) | Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
layoutContainer(Container) | Lays out the container argument using this border layout.
maximumLayoutSize(Container) | Returns the maximum dimensions for this layout given the components in the specified target container.
minimumLayoutSize(Container) | Determines the minimum size of the target container using this layout manager.
preferredLayoutSize(Container) | Determines the preferred size of the target container using this layout manager, based on the components in the container.
removeLayoutComponent(Component) | Removes the specified component from this border layout.
setHgap(int) | Sets the horizontal gap between components.
setVgap(int) | Sets the vertical gap between components.
toString() | Returns a string representation of the state of this border layout.


 BorderLayout.CENTER

BorderLayout.CENTER

Syntax
public static final String CENTER
Description
The center layout constraint (middle of container).


 BorderLayout.EAST

BorderLayout.EAST

Syntax
public static final String EAST
Description
The east layout constraint (left side of container).


 BorderLayout.NORTH

BorderLayout.NORTH

Syntax
public static final String NORTH
Description
The north layout constraint (top of container).


 BorderLayout.SOUTH

BorderLayout.SOUTH

Syntax
public static final String SOUTH
Description
The south layout constraint (bottom of container).


 BorderLayout.WEST

BorderLayout.WEST

Syntax
public static final String WEST
Description
The west layout constraint (right side of container).


 BorderLayout.BorderLayout

BorderLayout.BorderLayout

Syntax 1
public BorderLayout()
Description
Constructs a new border layout with no gaps between components.

Syntax 2
public BorderLayout( int hgap, int vgap )
Parameters
hgap
the horizontal gap.
vgap
the vertical gap.
Description
Constructs a border layout with the specified gaps between components. The horizontal gap is specified by hgap and the vertical gap is specified by vgap.


 BorderLayout.addLayoutComponent

BorderLayout.addLayoutComponent

Syntax 1
public void addLayoutComponent( Component comp, Object constraints )
Parameters
comp
the component to be added.
constraints
an object that specifies how and where the component is added to the layout.
Description
Adds the specified component to the layout, using the specified constraint object. For border layouts, the constraint must be one of the following strings: "North", "South", "East", "West", or "Center".

Most applications do not call this method directly. This method is called when a component is added to a container using the Container.add method with the same argument types.

Exceptions
IllegalArgumentException if the constraint object is not a string, or if it not one of the five specified strings.
See Also
add

Syntax 2
public void addLayoutComponent( String name, Component comp )
Description
Note: addLayoutComponent() is deprecated. replaced by addLayoutComponent(Component, Object).


 BorderLayout.getHgap

BorderLayout.getHgap

Syntax
public int getHgap()
Description
Returns the horizontal gap between components.


 BorderLayout.getLayoutAlignmentX

BorderLayout.getLayoutAlignmentX

Syntax
public float getLayoutAlignmentX( Container parent )
Description
Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.


 BorderLayout.getLayoutAlignmentY

BorderLayout.getLayoutAlignmentY

Syntax
public float getLayoutAlignmentY( Container parent )
Description
Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.


 BorderLayout.getVgap

BorderLayout.getVgap

Syntax
public int getVgap()
Description
Returns the vertical gap between components.


 BorderLayout.invalidateLayout

BorderLayout.invalidateLayout

Syntax
public void invalidateLayout( Container target )
Description
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.


 BorderLayout.layoutContainer

BorderLayout.layoutContainer

Syntax
public void layoutContainer( Container target )
Parameters
target
the container in which to do the layout.
Description
Lays out the container argument using this border layout.

This method actually reshapes the components in the specified container in order to satisfy the constraints of this BorderLayout object. The North and Southcomponents, if any, are placed at the top and bottom of the container, respectively. The West and East components are then placed on the left and right, respectively. Finally, the Center object is placed in any remaining space in the middle.

Most applications do not call this method directly. This method is called when a container calls its doLayout method.

See Also
Container, doLayout


 BorderLayout.maximumLayoutSize

BorderLayout.maximumLayoutSize

Syntax
public Dimension maximumLayoutSize( Container target )
Parameters
target
the component which needs to be laid out
Description
Returns the maximum dimensions for this layout given the components in the specified target container.

See Also
Container, minimumLayoutSize, preferredLayoutSize


 BorderLayout.minimumLayoutSize

BorderLayout.minimumLayoutSize

Syntax
public Dimension minimumLayoutSize( Container target )
Parameters
target
the container in which to do the layout.
Returns
the minimum dimensions needed to lay out the subcomponents of the specified container.
Description
Determines the minimum size of the target container using this layout manager.

This method is called when a container calls its getMinimumSize method. Most applications do not call this method directly.

See Also
Container, preferredLayoutSize, getMinimumSize


 BorderLayout.preferredLayoutSize

BorderLayout.preferredLayoutSize

Syntax
public Dimension preferredLayoutSize( Container target )
Parameters
target
the container in which to do the layout.
Returns
the preferred dimensions to lay out the subcomponents of the specified container.
Description
Determines the preferred size of the target container using this layout manager, based on the components in the container.

Most applications do not call this method directly. This method is called when a container calls its getPreferredSize method.

See Also
Container, minimumLayoutSize, getPreferredSize


 BorderLayout.removeLayoutComponent

BorderLayout.removeLayoutComponent

Syntax
public void removeLayoutComponent( Component comp )
Parameters
comp
the component to be removed.
Description
Removes the specified component from this border layout. This method is called when a container calls its remove or removeAll methods. Most applications do not call this method directly.

See Also
remove, removeAll


 BorderLayout.setHgap

BorderLayout.setHgap

Syntax
public void setHgap( int hgap )
Parameters
hgap
the horizontal gap between components
Description
Sets the horizontal gap between components.


 BorderLayout.setVgap

BorderLayout.setVgap

Syntax
public void setVgap( int vgap )
Parameters
vgap
the vertical gap between components
Description
Sets the vertical gap between components.


 BorderLayout.toString

BorderLayout.toString

Syntax
public String toString()
Returns
a string representation of this border layout.
Description
Returns a string representation of the state of this border layout.

Overrides
toString in class Object


 Class Button

Class java.awt.Button

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Button

public class Button
extends Component

This class creates a labeled button. The application can cause some action to happen when the button is pushed. This image depicts three views of a "Quit" button as it appears under the Solaris operating system:

The first view shows the button as it appears normally. The second view shows the button when it has input focus. Its outline is darkened to let the user know that it is an active object. The third view shows the button when the user clicks the mouse over the button, and thus requests that an action be performed.

The gesture of clicking on a button with the mouse is associated with one instance of ActionEvent, which is sent out when the mouse is both pressed and released over the button. If an application is interested in knowing when the button has been pressed but not released, as a separate gesture, it can specialize processMouseEvent, or it can register itself as a listener for mouse events by calling addMouseListener. Both of these methods are defined by Component, the abstract superclass of all components.

When a button is pressed and released, AWT sends an instance of ActionEvent to the button, by calling processEvent on the button. The button's processEvent method receives all events for the button; it passes an action event along by calling its own processActionEvent method. The latter method passes the action event on to any action listeners that have registered an interest in action events generated by this button.

If an application wants to perform some action based on a button being pressed and released, it should implement ActionListener and register the new listener to receive events from this button, by calling the button's addActionListener method. The application can make use of the button's action command as a messaging protocol.

See Also:
ActionEvent, ActionListener, processMouseEvent, addMouseListener


 Button Members

Button Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Button() | Constructs a Button with no label.
Button(String) | Constructs a Button with the specified label.

Methods
Name | Description
addActionListener(ActionListener) | Adds the specified action listener to receive action events from this button.
addNotify() | Creates the peer of the button.
getActionCommand() | Returns the command name of the action event fired by this button.
getLabel() | Gets the label of this button.
paramString() | Returns the parameter string representing the state of this button.
processActionEvent(ActionEvent) | Processes action events occurring on this button by dispatching them to any registered ActionListener objects.
processEvent(AWTEvent) | Processes events on this button.
removeActionListener(ActionListener) | Removes the specified action listener so that it no longer receives action events from this button.
setActionCommand(String) | Sets the command name for the action event fired by this button.
setLabel(String) | Sets the button's label to be the specified string.


 Button.Button

Button.Button

Syntax 1
public Button()
Description
Constructs a Button with no label.

Syntax 2
public Button( String label )
Parameters
label
A string label for the button.
Description
Constructs a Button with the specified label.


 Button.addActionListener

Button.addActionListener

Syntax
public synchronized void addActionListener( ActionListener l )
Parameters
l
the action listener.
Description
Adds the specified action listener to receive action events from this button. Action events occur when a user presses or releases the mouse over this button.

See Also
ActionListener, removeActionListener


 Button.addNotify

Button.addNotify

Syntax
public void addNotify()
Description
Creates the peer of the button. The button's peer allows the application to change the look of the button without changing its functionality.

Overrides
addNotify in class Component
See Also
createButton, getToolkit


 Button.getActionCommand

Button.getActionCommand

Syntax
public String getActionCommand()
Description
Returns the command name of the action event fired by this button.


 Button.getLabel

Button.getLabel

Syntax
public String getLabel()
Returns
the button's label, or null if the button has no label.
Description
Gets the label of this button.

See Also
setLabel


 Button.paramString

Button.paramString

Syntax
protected String paramString()
Returns
the parameter string of this button.
Description
Returns the parameter string representing the state of this button. This string is useful for debugging.

Overrides
paramString in class Component


 Button.processActionEvent

Button.processActionEvent

Syntax
protected void processActionEvent( ActionEvent e )
Parameters
e
the action event.
Description
Processes action events occurring on this button by dispatching them to any registered ActionListener objects.

This method is not called unless action events are enabled for this button. Action events are enabled when one of the following occurs:

  • An ActionListener object is registered via addActionListener.
  • Action events are enabled via enableEvents.

See Also
ActionListener, addActionListener, enableEvents


 Button.processEvent

Button.processEvent

Syntax
protected void processEvent( AWTEvent e )
Parameters
e
the event.
Description
Processes events on this button. If an event is an instance of ActionEvent, this method invokes the processActionEvent method. Otherwise, it invokes processEvent on the superclass.

Overrides
processEvent in class Component
See Also
ActionEvent, processActionEvent


 Button.removeActionListener

Button.removeActionListener

Syntax
public synchronized void removeActionListener( ActionListener l )
Parameters
l
the action listener.
Description
Removes the specified action listener so that it no longer receives action events from this button. Action events occur when a user presses or releases the mouse over this button.

See Also
ActionListener, addActionListener


 Button.setActionCommand

Button.setActionCommand

Syntax
public void setActionCommand( String command )
Parameters
command
A string used to set the button's action command.
Description
Sets the command name for the action event fired by this button. By default this action command is set to match the label of the button.

See Also
ActionEvent


 Button.setLabel

Button.setLabel

Syntax
public synchronized void setLabel( String label )
Parameters
label
the new label, or null if the button has no label.
Description
Sets the button's label to be the specified string.

See Also
getLabel


 Class Canvas

Class java.awt.Canvas

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas

public class Canvas
extends Component

A Canvas component represents a blank rectangular area of the screen onto which the application can draw or from which the application can trap input events from the user.

An application must subclass the Canvas class in order to get useful functionality such as creating a custom component. The paint method must be overridden in order to perform custom graphics on the canvas.


 Canvas Members

Canvas Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Canvas() | Constructs a new Canvas.

Methods
Name | Description
addNotify() | Creates the peer of the canvas.
paint(Graphics) | This method is called to repaint this canvas.


 Canvas.Canvas

Canvas.Canvas

Syntax
public Canvas()
Description
Constructs a new Canvas.


 Canvas.addNotify

Canvas.addNotify

Syntax
public void addNotify()
Description
Creates the peer of the canvas. This peer allows you to change the user interface of the canvas without changing its functionality.

Overrides
addNotify in class Component
See Also
createCanvas, getToolkit


 Canvas.paint

Canvas.paint

Syntax
public void paint( Graphics g )
Parameters
g
the graphics context.
Description
This method is called to repaint this canvas. Most applications that subclass Canvas should override this method in order to perform some useful operation.

The paint method provided by Canvas redraws this canvas's rectangle in the background color.

The graphics context's origin (0, 0) is the top-left corner of this canvas. Its clipping region is the area of the context.

Overrides
paint in class Component
See Also
Graphics


 Class CardLayout

Class java.awt.CardLayout

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.CardLayout

public class CardLayout
extends Object
implements LayoutManager2, Serializable

A CardLayout object is a layout manager for a container. It treats each component in the container as a card. Only one card is visible at a time, and the container acts as a stack of cards.

The ordering of cards is determined by the container's own internal ordering of its component objects. CardLayout defines a set of methods that allow an application to flip through these cards sequentially, or to show a specified card. The addLayoutComponent method can be used to associate a string identifier with a given card for fast random access.

See Also:
Container


 CardLayout Members

CardLayout Members

Class Overview | This Package | All Packages

Constructors
Name | Description
CardLayout() | Creates a new card layout with gaps of size zero.
CardLayout(int, int) | Creates a new card layout with the specified horizontal and vertical gaps.

Methods
Name | Description
addLayoutComponent(Component, Object) | Adds the specified component to this card layout's internal table of names.
addLayoutComponent(String, Component) | Deprecated.
first(Container) | Flips to the first card of the container.
getHgap() | Gets the horizontal gap between components.
getLayoutAlignmentX(Container) | Returns the alignment along the x axis.
getLayoutAlignmentY(Container) | Returns the alignment along the y axis.
getVgap() | Gets the vertical gap between components.
invalidateLayout(Container) | Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
last(Container) | Flips to the last card of the container.
layoutContainer(Container) | Lays out the specified container using this card layout.
maximumLayoutSize(Container) | Returns the maximum dimensions for this layout given the components in the specified target container.
minimumLayoutSize(Container) | Calculates the minimum size for the specified panel.
next(Container) | Flips to the next card of the specified container.
preferredLayoutSize(Container) | Determines the preferred size of the container argument using this card layout.
previous(Container) | Flips to the previous card of the specified container.
removeLayoutComponent(Component) | Removes the specified component from the layout.
setHgap(int) | Sets the horizontal gap between components.
setVgap(int) | Sets the vertical gap between components.
show(Container, String) | Flips to the component that was added to this layout with the specified name, using addLayoutComponent.
toString() | Returns a string representation of the state of this card layout.


 CardLayout.CardLayout

CardLayout.CardLayout

Syntax 1
public CardLayout()
Description
Creates a new card layout with gaps of size zero.

Syntax 2
public CardLayout( int hgap, int vgap )
Parameters
hgap
the horizontal gap.
vgap
the vertical gap.
Description
Creates a new card layout with the specified horizontal and vertical gaps. The horizontal gaps are placed at the left and right edges. The vertical gaps are placed at the top and bottom edges.


 CardLayout.addLayoutComponent

CardLayout.addLayoutComponent

Syntax 1
public void addLayoutComponent( Component comp, Object constraints )
Parameters
comp
the component to be added.
constraints
a tag that identifies a particular card in the layout.
Description
Adds the specified component to this card layout's internal table of names. The object specified by constraints must be a string. The card layout stores this string as a key-value pair that can be used for random access to a particular card. By calling the show method, an application can display the component with the specified name.

Exceptions
IllegalArgumentException if the constraint is not a string.
See Also
show

Syntax 2
public void addLayoutComponent( String name, Component comp )
Description
Note: addLayoutComponent() is deprecated. replaced by addLayoutComponent(Component, Object).


 CardLayout.first

CardLayout.first

Syntax
public void first( Container parent )
Parameters
parent
the name of the parent container in which to do the layout.
Description
Flips to the first card of the container.

See Also
last


 CardLayout.getHgap

CardLayout.getHgap

Syntax
public int getHgap()
Returns
the horizontal gap between components.
Description
Gets the horizontal gap between components.

See Also
setHgap, getVgap


 CardLayout.getLayoutAlignmentX

CardLayout.getLayoutAlignmentX

Syntax
public float getLayoutAlignmentX( Container parent )
Description
Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.


 CardLayout.getLayoutAlignmentY

CardLayout.getLayoutAlignmentY

Syntax
public float getLayoutAlignmentY( Container parent )
Description
Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.


 CardLayout.getVgap

CardLayout.getVgap

Syntax
public int getVgap()
Returns
the vertical gap between components.
Description
Gets the vertical gap between components.

See Also
setVgap, getHgap


 CardLayout.invalidateLayout

CardLayout.invalidateLayout

Syntax
public void invalidateLayout( Container target )
Description
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.


 CardLayout.last

CardLayout.last

Syntax
public void last( Container parent )
Parameters
parent
the name of the parent container in which to do the layout.
Description
Flips to the last card of the container.

See Also
first


 CardLayout.layoutContainer

CardLayout.layoutContainer

Syntax
public void layoutContainer( Container parent )
Parameters
parent
the name of the parent container in which to do the layout.
Description
Lays out the specified container using this card layout.

Each component in the parent container is reshaped to be the size of the container, minus space for surrounding insets, horizontal gaps, and vertical gaps.

See Also
doLayout


 CardLayout.maximumLayoutSize

CardLayout.maximumLayoutSize

Syntax
public Dimension maximumLayoutSize( Container target )
Parameters
target
the component which needs to be laid out
Description
Returns the maximum dimensions for this layout given the components in the specified target container.

See Also
Container, minimumLayoutSize, preferredLayoutSize


 CardLayout.minimumLayoutSize

CardLayout.minimumLayoutSize

Syntax
public Dimension minimumLayoutSize( Container parent )
Parameters
parent
the name of the parent container in which to do the layout.
Returns
the minimum dimensions required to lay out the subcomponents of the specified container.
Description
Calculates the minimum size for the specified panel.

See Also
doLayout, preferredLayoutSize


 CardLayout.next

CardLayout.next

Syntax
public void next( Container parent )
Parameters
parent
the name of the parent container in which to do the layout.
Description
Flips to the next card of the specified container. If the currently visible card is the last one, this method flips to the first card in the layout.

See Also
previous


 CardLayout.preferredLayoutSize

CardLayout.preferredLayoutSize

Syntax
public Dimension preferredLayoutSize( Container parent )
Parameters
parent
the name of the parent container.
Returns
the preferred dimensions to lay out the subcomponents of the specified container.
Description
Determines the preferred size of the container argument using this card layout.

See Also
getPreferredSize, minimumLayoutSize


 CardLayout.previous

CardLayout.previous

Syntax
public void previous( Container parent )
Parameters
parent
the name of the parent container in which to do the layout.
Description
Flips to the previous card of the specified container. If the currently visible card is the first one, this method flips to the last card in the layout.

See Also
next


 CardLayout.removeLayoutComponent

CardLayout.removeLayoutComponent

Syntax
public void removeLayoutComponent( Component comp )
Parameters
comp
the component to be removed.
Description
Removes the specified component from the layout.

See Also
remove, removeAll


 CardLayout.setHgap

CardLayout.setHgap

Syntax
public void setHgap( int hgap )
Parameters
hgap
the horizontal gap between components.
Description
Sets the horizontal gap between components.

See Also
getHgap, setVgap


 CardLayout.setVgap

CardLayout.setVgap

Syntax
public void setVgap( int vgap )
Parameters
vgap
the vertical gap between components.
Description
Sets the vertical gap between components.

See Also
getVgap, setHgap


 CardLayout.show

CardLayout.show

Syntax
public void show( Container parent, String name )
Parameters
parent
the name of the parent container in which to do the layout.
name
the component name.
Description
Flips to the component that was added to this layout with the specified name, using addLayoutComponent. If no such component exists, then nothing happens.

See Also
addLayoutComponent


 CardLayout.toString

CardLayout.toString

Syntax
public String toString()
Returns
a string representation of this card layout.
Description
Returns a string representation of the state of this card layout.

Overrides
toString in class Object


 Class Checkbox

Class java.awt.Checkbox

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Checkbox

public class Checkbox
extends Component
implements ItemSelectable

A check box is a graphical component that can be in either an "on" (true) or "off" (false) state. Clicking on a check box changes its state from "on" to "off," or from "off" to "on."

The following code example creates a set of check boxes in a grid layout:

 setLayout(new GridLayout(3, 1));
 add(new Checkbox("one", null, true));
 add(new Checkbox("two"));
 add(new Checkbox("three"));

This image depicts the check boxes and grid layout created by this code example:

The button labeled one is in the "on" state, and the other two are in the "off" state. In this example, which uses the GridLayout class, the states of the three check boxes are set independently.

Alternatively, several check boxes can be grouped together under the control of a single object, using the CheckboxGroup class. In a check box group, at most one button can be in the "on" state at any given time. Clicking on a check box to turn it on forces any other check box in the same group that is on into the "off" state.

See Also:
GridLayout, CheckboxGroup


 Checkbox Members

Checkbox Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Checkbox() | Creates a check box with no label.
Checkbox(String) | Creates a check box with the specified label.
Checkbox(String, boolean) | Creates a check box with the specified label.
Checkbox(String, boolean, CheckboxGroup) | Creates a check box with the specified label, in the specified check box group, and set to the specified state.
Checkbox(String, CheckboxGroup, boolean) | Constructs a Checkbox with the specified label, set to the specified state, and in the specified check box group.

Methods
Name | Description
addItemListener(ItemListener) | Adds the specified item listener to receive item events from this check box.
addNotify() | Creates the peer of the Checkbox.
getCheckboxGroup() | Determines this check box's group.
getLabel() | Gets the label of this check box.
getSelectedObjects() | Returns the an array (length 1) containing the checkbox label or null if the checkbox is not selected.
getState() | Determines whether this check box is in the "on" or "off" state.
paramString() | Returns the parameter string representing the state of this check box.
processEvent(AWTEvent) | Processes events on this check box.
processItemEvent(ItemEvent) | Processes item events occurring on this check box by dispatching them to any registered ItemListener objects.
removeItemListener(ItemListener) | Removes the specified item listener so that the item listener no longer receives item events from this check box.
setCheckboxGroup(CheckboxGroup) | Sets this check box's group to be the specified check box group.
setLabel(String) | Sets this check box's label to be the string argument.
setState(boolean) | Sets the state of this check box to the specified state.


 Checkbox.Checkbox

Checkbox.Checkbox

Syntax 1
public Checkbox()
Description
Creates a check box with no label. The state of this check box is set to "off," and it is not part of any check box group.

Syntax 2
public Checkbox( String label )
Parameters
label
a string label for this check box, or null for no label.
Description
Creates a check box with the specified label. The state of this check box is set to "off," and it is not part of any check box group.

Syntax 3
public Checkbox( String label, boolean state )
Parameters
label
a string label for this check box, or null for no label.
state
the initial state of this check box.
Description
Creates a check box with the specified label. The state of this check box is as specified by the state argument, and it is not part of any check box group.

Syntax 4
public Checkbox( String label, boolean state, CheckboxGroup group )
Parameters
label
a string label for this check box, or null for no label.
state
the initial state of this check box.
group
a check box group for this check box, or null for no group.
Description
Creates a check box with the specified label, in the specified check box group, and set to the specified state.

Syntax 5
public Checkbox( String label, CheckboxGroup group, boolean state )
Description
Constructs a Checkbox with the specified label, set to the specified state, and in the specified check box group.


 Checkbox.addItemListener

Checkbox.addItemListener

Syntax
public synchronized void addItemListener( ItemListener l )
Parameters
l
the item listener.
Description
Adds the specified item listener to receive item events from this check box.

See Also
ItemEvent, ItemListener, removeItemListener


 Checkbox.addNotify

Checkbox.addNotify

Syntax
public void addNotify()
Description
Creates the peer of the Checkbox. The peer allows you to change the look of the Checkbox without changing its functionality.

Overrides
addNotify in class Component
See Also
createCheckbox, getToolkit


 Checkbox.getCheckboxGroup

Checkbox.getCheckboxGroup

Syntax
public CheckboxGroup getCheckboxGroup()
Returns
this check box's group, or null if the check box is not part of a check box group.
Description
Determines this check box's group.

See Also
setCheckboxGroup


 Checkbox.getLabel

Checkbox.getLabel

Syntax
public String getLabel()
Returns
the label of this check box, or null if this check box has no label.
Description
Gets the label of this check box.

See Also
setLabel


 Checkbox.getSelectedObjects

Checkbox.getSelectedObjects

Syntax
public Object[] getSelectedObjects()
Description
Returns the an array (length 1) containing the checkbox label or null if the checkbox is not selected.

See Also
ItemSelectable


 Checkbox.getState

Checkbox.getState

Syntax
public boolean getState()
Returns
the state of this check box, as a boolean value.
Description
Determines whether this check box is in the "on" or "off" state. The boolean value true indicates the "on" state, and false indicates the "off" state.

See Also
setState


 Checkbox.paramString

Checkbox.paramString

Syntax
protected String paramString()
Returns
the parameter string of this check box.
Description
Returns the parameter string representing the state of this check box. This string is useful for debugging.

Overrides
paramString in class Component


 Checkbox.processEvent

Checkbox.processEvent

Syntax
protected void processEvent( AWTEvent e )
Parameters
e
the event.
Description
Processes events on this check box. If the event is an instance of ItemEvent, this method invokes the processItemEvent method. Otherwise, it calls its superclass's processEvent method.

Overrides
processEvent in class Component
See Also
ItemEvent, processItemEvent


 Checkbox.processItemEvent

Checkbox.processItemEvent

Syntax
protected void processItemEvent( ItemEvent e )
Parameters
e
the item event.
Description
Processes item events occurring on this check box by dispatching them to any registered ItemListener objects.

This method is not called unless item events are enabled for this component. Item events are enabled when one of the following occurs:

  • An ItemListener object is registered via addItemListener.
  • Item events are enabled via enableEvents.

See Also
ItemEvent, ItemListener, addItemListener, enableEvents


 Checkbox.removeItemListener

Checkbox.removeItemListener

Syntax
public synchronized void removeItemListener( ItemListener l )
Parameters
l
the item listener.
Description
Removes the specified item listener so that the item listener no longer receives item events from this check box.

See Also
ItemEvent, ItemListener, addItemListener


 Checkbox.setCheckboxGroup

Checkbox.setCheckboxGroup

Syntax
public void setCheckboxGroup( CheckboxGroup g )
Parameters
g
the new check box group, or null to remove this check box from any check box group.
Description
Sets this check box's group to be the specified check box group. If this check box is already in a different check box group, it is first taken out of that group.

See Also
getCheckboxGroup


 Checkbox.setLabel

Checkbox.setLabel

Syntax
public synchronized void setLabel( String label )
Parameters
label
a string to set as the new label, or null for no label.
Description
Sets this check box's label to be the string argument.

See Also
getLabel


 Checkbox.setState

Checkbox.setState

Syntax
public void setState( boolean state )
Parameters
state
the boolean state of the check box.
Description
Sets the state of this check box to the specified state. The boolean value true indicates the "on" state, and false indicates the "off" state.

See Also
getState


 Class CheckboxGroup

Class java.awt.CheckboxGroup

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.CheckboxGroup

public class CheckboxGroup
extends Object
implements Serializable

The CheckboxGroup class is used to group together a set of Checkbox buttons.

Exactly one check box button in a CheckboxGroup can be in the "on" state at any given time. Pushing any button sets its state to "on" and forces any other button that is in the "on" state into the "off" state.

The following code example produces a new check box group, with three check boxes:

 setLayout(new GridLayout(3, 1));
 CheckboxGroup cbg = new CheckboxGroup();
 add(new Checkbox("one", cbg, true));
 add(new Checkbox("two", cbg, false));
 add(new Checkbox("three", cbg, false));

This image depicts the check box group created by this example:

See Also:
Checkbox


 CheckboxGroup Members

CheckboxGroup Members

Class Overview | This Package | All Packages

Constructors
Name | Description
CheckboxGroup() | Creates a new instance of CheckboxGroup.

Methods
Name | Description
getCurrent() | Deprecated.
getSelectedCheckbox() | Gets the current choice from this check box group.
setCurrent(Checkbox) | Deprecated.
setSelectedCheckbox(Checkbox) | Sets the currently selected check box in this group to be the specified check box.
toString() | Returns a string representation of this check box group, including the value of its current selection.


 CheckboxGroup.CheckboxGroup

CheckboxGroup.CheckboxGroup

Syntax
public CheckboxGroup()
Description
Creates a new instance of CheckboxGroup.


 CheckboxGroup.getCurrent

CheckboxGroup.getCurrent

Syntax
public Checkbox getCurrent()
Description
Note: getCurrent() is deprecated. As of JDK version 1.1, replaced by getSelectedCheckbox().


 CheckboxGroup.getSelectedCheckbox

CheckboxGroup.getSelectedCheckbox

Syntax
public Checkbox getSelectedCheckbox()
Returns
the check box that is currently in the "on" state, or null.
Description
Gets the current choice from this check box group. The current choice is the check box in this group that is currently in the "on" state, or null if all check boxes in the group are off.

See Also
Checkbox, setSelectedCheckbox


 CheckboxGroup.setCurrent

CheckboxGroup.setCurrent

Syntax
public synchronized void setCurrent( Checkbox box )
Description
Note: setCurrent() is deprecated. As of JDK version 1.1, replaced by setSelectedCheckbox(Checkbox).


 CheckboxGroup.setSelectedCheckbox

CheckboxGroup.setSelectedCheckbox

Syntax
public synchronized void setSelectedCheckbox( Checkbox box )
Parameters
box
the Checkbox to set as the current selection.
Description
Sets the currently selected check box in this group to be the specified check box. This method sets the state of that check box to "on" and sets all other check boxes in the group to be off.

If the check box argument is null or belongs to a different check box group, then this method does nothing.

See Also
Checkbox, getSelectedCheckbox


 CheckboxGroup.toString

CheckboxGroup.toString

Syntax
public String toString()
Returns
a string representation of this check box group.
Description
Returns a string representation of this check box group, including the value of its current selection.

Overrides
toString in class Object


 Class CheckboxMenuItem

Class java.awt.CheckboxMenuItem

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.MenuComponent
           |
           +----java.awt.MenuItem
                   |
                   +----java.awt.CheckboxMenuItem

public class CheckboxMenuItem
extends MenuItem
implements ItemSelectable

This class represents a check box that can be included in a menu. Clicking on the check box in the menu changes its state from "on" to "off" or from "off" to "on."

The following picture depicts a menu which contains an instance of CheckBoxMenuItem:

The item labeled Check shows a check box menu item in its "off" state.

When a check box menu item is selected, AWT sends an item event to the item. Since the event is an instance of ItemEvent, the processEvent method examines the event and passes it along to processItemEvent. The latter method redirects the event to any ItemListener objects that have registered an interest in item events generated by this menu item.

See Also:
ItemEvent, ItemListener


 CheckboxMenuItem Members

CheckboxMenuItem Members

Class Overview | This Package | All Packages

Constructors
Name | Description
CheckboxMenuItem() | Create a check box menu item with an empty label.
CheckboxMenuItem(String) | Create a check box menu item with the specified label.
CheckboxMenuItem(String, boolean) | Create a check box menu item with the specified label and state.

Methods
Name | Description
addItemListener(ItemListener) | Adds the specified item listener to receive item events from this check box menu item.
addNotify() | Creates the peer of the checkbox item.
getSelectedObjects() | Returns the an array (length 1) containing the checkbox menu item label or null if the checkbox is not selected.
getState() | Determines whether the state of this check box menu item is "on" or "off."
paramString() | Returns the parameter string representing the state of this check box menu item.
processEvent(AWTEvent) | Processes events on this check box menu item.
processItemEvent(ItemEvent) | Processes item events occurring on this check box menu item by dispatching them to any registered ItemListener objects.
removeItemListener(ItemListener) | Removes the specified item listener so that it no longer receives item events from this check box menu item.
setState(boolean) | Sets this check box menu item to the specifed state.


 CheckboxMenuItem.CheckboxMenuItem

CheckboxMenuItem.CheckboxMenuItem

Syntax 1
public CheckboxMenuItem()
Description
Create a check box menu item with an empty label. The item's state is initially set to "off."

Syntax 2
public CheckboxMenuItem( String label )
Parameters
label
a string label for the check box menu item, or null for an unlabeled menu item.
Description
Create a check box menu item with the specified label. The item's state is initially set to "off."

Syntax 3
public CheckboxMenuItem( String label, boolean state )
Parameters
label
the button label.
state
the initial state of the menu item, where true indicates "on" and false indicates "off."
Description
Create a check box menu item with the specified label and state.


 CheckboxMenuItem.addItemListener

CheckboxMenuItem.addItemListener

Syntax
public synchronized void addItemListener( ItemListener l )
Parameters
l
the item listener.
Description
Adds the specified item listener to receive item events from this check box menu item.

See Also
ItemEvent, ItemListener, removeItemListener


 CheckboxMenuItem.addNotify

CheckboxMenuItem.addNotify

Syntax
public void addNotify()
Description
Creates the peer of the checkbox item. This peer allows us to change the look of the checkbox item without changing its functionality. Most applications do not call this method directly.

Overrides
addNotify in class MenuItem
See Also
createCheckboxMenuItem, getToolkit


 CheckboxMenuItem.getSelectedObjects

CheckboxMenuItem.getSelectedObjects

Syntax
public synchronized Object[] getSelectedObjects()
Description
Returns the an array (length 1) containing the checkbox menu item label or null if the checkbox is not selected.

See Also
ItemSelectable


 CheckboxMenuItem.getState

CheckboxMenuItem.getState

Syntax
public boolean getState()
Returns
the state of this check box menu item, where true indicates "on" and false indicates "off."
Description
Determines whether the state of this check box menu item is "on" or "off."

See Also
setState


 CheckboxMenuItem.paramString

CheckboxMenuItem.paramString

Syntax
public String paramString()
Returns
the parameter string of this check box menu item.
Description
Returns the parameter string representing the state of this check box menu item. This string is useful for debugging.

Overrides
paramString in class MenuItem


 CheckboxMenuItem.processEvent

CheckboxMenuItem.processEvent

Syntax
protected void processEvent( AWTEvent e )
Parameters
e
the event
Description
Processes events on this check box menu item. If the event is an instance of ItemEvent, this method invokes the processItemEvent method. If the event is not an item event, it invokes processEvent on the superclass.

Check box menu items currently support only item events.

Overrides
processEvent in class MenuItem
See Also
ItemEvent, processItemEvent


 CheckboxMenuItem.processItemEvent

CheckboxMenuItem.processItemEvent

Syntax
protected void processItemEvent( ItemEvent e )
Parameters
e
the item event.
Description
Processes item events occurring on this check box menu item by dispatching them to any registered ItemListener objects.

This method is not called unless item events are enabled for this menu item. Item events are enabled when one of the following occurs:

  • An ItemListener object is registered via addItemListener.
  • Item events are enabled via enableEvents.

See Also
ItemEvent, ItemListener, addItemListener, enableEvents


 CheckboxMenuItem.removeItemListener

CheckboxMenuItem.removeItemListener

Syntax
public synchronized void removeItemListener( ItemListener l )
Parameters
l
the item listener.
Description
Removes the specified item listener so that it no longer receives item events from this check box menu item.

See Also
ItemEvent, ItemListener, addItemListener


 CheckboxMenuItem.setState

CheckboxMenuItem.setState

Syntax
public synchronized void setState( boolean b )
Parameters
b
the boolean state of this check box menu item.
Description
Sets this check box menu item to the specifed state. The boolean value true indicates "on" while false indicates "off."

See Also
getState


 Class Choice

Class java.awt.Choice

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Choice

public class Choice
extends Component
implements ItemSelectable

The Choice class presents a pop-up menu of choices. The current choice is displayed as the title of the menu.

The following code example produces a pop-up menu:

 Choice ColorChooser = new Choice();
 ColorChooser.add("Green");
 ColorChooser.add("Red");
 ColorChooser.add("Blue");

After this choice menu has been added to a panel, it appears as follows in its normal state:

In the picture, "Green" is the current choice. Pushing the mouse button down on the object causes a menu to appear with the current choice highlighted.


 Choice Members

Choice Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Choice() | Creates a new choice menu.

Methods
Name | Description
add(String) | Adds an item to this Choice menu.
addItem(String) | Adds an item to this Choice.
addItemListener(ItemListener) | Adds the specified item listener to receive item events from this Choice menu.
addNotify() | Creates the Choice's peer.
countItems() | Deprecated.
getItem(int) | Gets the string at the specified index in this Choice menu.
getItemCount() | Returns the number of items in this Choice menu.
getSelectedIndex() | Returns the index of the currently selected item.
getSelectedItem() | Gets a representation of the current choice as a string.
getSelectedObjects() | Returns an array (length 1) containing the currently selected item.
insert(String, int) | Inserts the item into this choice at the specified position.
paramString() | Returns the parameter string representing the state of this choice menu.
processEvent(AWTEvent) | Processes events on this choice.
processItemEvent(ItemEvent) | Processes item events occurring on this Choice menu by dispatching them to any registered ItemListener objects.
remove(int) | Removes an item from the choice menu at the specified position.
remove(String) | Remove the first occurrence of item from the Choice menu.
removeAll() | Removes all items from the choice menu.
removeItemListener(ItemListener) | Removes the specified item listener so that it no longer receives item events from this Choice menu.
select(int) | Sets the selected item in this Choice menu to be the item at the specified position.
select(String) | Sets the selected item in this Choice menu to be the item whose name is equal to the specified string.


 Choice.Choice

Choice.Choice

Syntax
public Choice()
Description
Creates a new choice menu. The menu initially has no items in it.

By default, the first item added to the choice menu becomes the selected item, until a different selection is made by the user by calling one of the select methods.

See Also
select, select


 Choice.add

Choice.add

Syntax
public synchronized void add( String item )
Parameters
item
the item to be added
Description
Adds an item to this Choice menu.

Exceptions
NullPointerException if the item's value is null.


 Choice.addItem

Choice.addItem

Syntax
public synchronized void addItem( String item )
Parameters
item
the item to be added
Description
Adds an item to this Choice.

Exceptions
NullPointerException If the item's value is equal to null.


 Choice.addItemListener

Choice.addItemListener

Syntax
public synchronized void addItemListener( ItemListener l )
Parameters
l
the item listener.
Description
Adds the specified item listener to receive item events from this Choice menu.

See Also
ItemEvent, ItemListener, removeItemListener


 Choice.addNotify

Choice.addNotify

Syntax
public void addNotify()
Description
Creates the Choice's peer. This peer allows us to change the look of the Choice without changing its functionality.

Overrides
addNotify in class Component
See Also
createChoice, getToolkit


 Choice.countItems

Choice.countItems

Syntax
public int countItems()
Description
Note: countItems() is deprecated. As of JDK version 1.1, replaced by getItemCount().


 Choice.getItem

Choice.getItem

Syntax
public String getItem( int index )
Parameters
index
the index at which to begin.
Description
Gets the string at the specified index in this Choice menu.

See Also
getItemCount


 Choice.getItemCount

Choice.getItemCount

Syntax
public int getItemCount()
Description
Returns the number of items in this Choice menu.

See Also
getItem


 Choice.getSelectedIndex

Choice.getSelectedIndex

Syntax
public int getSelectedIndex()
Description
Returns the index of the currently selected item.

See Also
getSelectedItem


 Choice.getSelectedItem

Choice.getSelectedItem

Syntax
public synchronized String getSelectedItem()
Returns
a string representation of the currently selected item in this choice menu.
Description
Gets a representation of the current choice as a string.

See Also
getSelectedIndex


 Choice.getSelectedObjects

Choice.getSelectedObjects

Syntax
public synchronized Object[] getSelectedObjects()
Description
Returns an array (length 1) containing the currently selected item. If this choice has no items, returns null.

See Also
ItemSelectable


 Choice.insert

Choice.insert

Syntax
public synchronized void insert( String item, int index )
Parameters
item
the item to be inserted
index
the position at which the item should be inserted
Description
Inserts the item into this choice at the specified position.

Exceptions
IllegalArgumentException if index is less than 0.


 Choice.paramString

Choice.paramString

Syntax
protected String paramString()
Returns
the parameter string of this Choice menu.
Description
Returns the parameter string representing the state of this choice menu. This string is useful for debugging.

Overrides
paramString in class Component


 Choice.processEvent

Choice.processEvent

Syntax
protected void processEvent( AWTEvent e )
Parameters
e
the event.
Description
Processes events on this choice. If the event is an instance of ItemEvent, it invokes the processItemEvent method. Otherwise, it calls its superclass's processEvent method.

Overrides
processEvent in class Component
See Also
ItemEvent, processItemEvent


 Choice.processItemEvent

Choice.processItemEvent

Syntax
protected void processItemEvent( ItemEvent e )
Parameters
e
the item event.
Description
Processes item events occurring on this Choice menu by dispatching them to any registered ItemListener objects.

This method is not called unless item events are enabled for this component. Item events are enabled when one of the following occurs:

  • An ItemListener object is registered via addItemListener.
  • Item events are enabled via enableEvents.

See Also
ItemEvent, ItemListener, addItemListener, enableEvents


 Choice.remove

Choice.remove

Syntax 1
public synchronized void remove( String item )
Parameters
item
the item to remove from this Choice menu.
Description
Remove the first occurrence of item from the Choice menu.

Exceptions
IllegalArgumentException if the item doesn't exist in the choice menu.

Syntax 2
public synchronized void remove( int position )
Parameters
position
the position of the item.
Description
Removes an item from the choice menu at the specified position.


 Choice.removeAll

Choice.removeAll

Syntax
public synchronized void removeAll()
Description
Removes all items from the choice menu.

See Also
remove


 Choice.removeItemListener

Choice.removeItemListener

Syntax
public synchronized void removeItemListener( ItemListener l )
Parameters
l
the item listener.
Description
Removes the specified item listener so that it no longer receives item events from this Choice menu.

See Also
ItemEvent, ItemListener, addItemListener


 Choice.select

Choice.select

Syntax 1
public synchronized void select( int pos )
Parameters
pos
the positon of the selected item.
Description
Sets the selected item in this Choice menu to be the item at the specified position.

Exceptions
IllegalArgumentException if the specified position is invalid.
See Also
getSelectedItem, getSelectedIndex

Syntax 2
public synchronized void select( String str )
Parameters
str
the specified string
Description
Sets the selected item in this Choice menu to be the item whose name is equal to the specified string. If more than one item matches (is equal to) the specified string, the one with the smallest index is selected.

See Also
getSelectedItem, getSelectedIndex


 Class Color

Class java.awt.Color

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Color

public class Color
extends Object
implements Serializable

This class encapsulates colors using the RGB format. In RGB format, the red, blue, and green components of a color are each represented by an integer in the range 0-255. The value 0 indicates no contribution from this primary color. The value 255 indicates the maximum intensity of this color component.

Although the Color class is based on the three-component RGB model, the class provides a set of convenience methods for converting between RGB and HSB colors. For a definition of the RGB and HSB color models, see Foley, van Dam, Feiner, and Hughes, Computer Graphics: Principles and Practice.


 Color Members

Color Members

Class Overview | This Package | All Packages

Fields
Name | Description
black | The color black.
blue | The color blue.
cyan | The color cyan.
darkGray | The color dark gray.
gray | The color gray.
green | The color green.
lightGray | The color light gray.
magenta | The color magneta.
orange | The color orange.
pink | The color pink.
red | The color red.
white | The color white.
yellow | The color yellow.

Constructors
Name | Description
Color(float, float, float) | Creates a color with the specified red, green, and blue values, where each of the values is in the range 0.0-1.0.
Color(int) | Creates a color with the specified RGB value, where the red component is in bits 16-23 of the argument, the green component is in bits 8-15 of the argument, and the blue component is in bits 0-7.
Color(int, int, int) | Creates a color with the specified red, green, and blue components.

Methods
Name | Description
brighter() | Creates a brighter version of this color.
darker() | Creates a darker version of this color.
decode(String) | Converts a string to an integer and returns the specified color.
equals(Object) | Determines whether another object is equal to this color.
getBlue() | Gets the blue component of this color.
getColor(String) | Finds a color in the system properties.
getColor(String, Color) | Finds a color in the system properties.
getColor(String, int) | Finds a color in the system properties.
getGreen() | Gets the green component of this color.
getHSBColor(float, float, float) | Creates a Color object based on values supplied for the HSB color model.
getRed() | Gets the red component of this color.
getRGB() | Gets the RGB value representing the color in the default RGB ColorModel.
hashCode() | Computes the hash code for this color.
HSBtoRGB(float, float, float) | Converts the components of a color, as specified by the HSB model, to an equivalent set of values for the RGB model.
RGBtoHSB(int, int, int, float[]) | Converts the components of a color, as specified by the RGB model, to an equivalent set of values for hue, saturation, and brightness, the three components of the HSB model.
toString() | Creates a string that represents this color and indicates the values of its RGB components.


 Color.black

Color.black

Syntax
public static final Color black
Description
The color black.


 Color.blue

Color.blue

Syntax
public static final Color blue
Description
The color blue.


 Color.cyan

Color.cyan

Syntax
public static final Color cyan
Description
The color cyan.


 Color.darkGray

Color.darkGray

Syntax
public static final Color darkGray
Description
The color dark gray.


 Color.gray

Color.gray

Syntax
public static final Color gray
Description
The color gray.


 Color.green

Color.green

Syntax
public static final Color green
Description
The color green.


 Color.lightGray

Color.lightGray

Syntax
public static final Color lightGray
Description
The color light gray.


 Color.magenta

Color.magenta

Syntax
public static final Color magenta
Description
The color magneta.


 Color.orange

Color.orange

Syntax
public static final Color orange
Description
The color orange.


 Color.pink

Color.pink

Syntax
public static final Color pink
Description
The color pink.


 Color.red

Color.red

Syntax
public static final Color red
Description
The color red.


 Color.white

Color.white

Syntax
public static final Color white
Description
The color white.


 Color.yellow

Color.yellow

Syntax
public static final Color yellow
Description
The color yellow.


 Color.Color

Color.Color

Syntax 1
public Color( int r, int g, int b )
Parameters
r
the red component.
g
the green component.
b
the blue component.
Description
Creates a color with the specified red, green, and blue components. The three arguments must each be in the range 0-255.

The actual color used in rendering depends on finding the best match given the color space available for a given output device.

See Also
getRed, getGreen, getBlue, getRGB

Syntax 2
public Color( int rgb )
Parameters
rgb
an integer giving the red, green, and blue components.
Description
Creates a color with the specified RGB value, where the red component is in bits 16-23 of the argument, the green component is in bits 8-15 of the argument, and the blue component is in bits 0-7. The value zero indicates no contribution from the primary color component.

The actual color used in rendering depends on finding the best match given the color space available for a given output device.

See Also
getRGBdefault, getRed, getGreen, getBlue, getRGB

Syntax 3
public Color( float r, float g, float b )
Parameters
r
the red component
g
the red component
b
the red component
Description
Creates a color with the specified red, green, and blue values, where each of the values is in the range 0.0-1.0. The value 0.0 indicates no contribution from the primary color component. The value 1.0 indicates the maximum intensity of the primary color component.

The actual color used in rendering depends on finding the best match given the color space available for a given output device.

See Also
getRed, getGreen, getBlue, getRGB


 Color.brighter

Color.brighter

Syntax
public Color brighter()
Returns
a new Color object, a brighter version of this color.
Description
Creates a brighter version of this color.

This method applies an arbitrary scale factor to each of the three RGB components of the color to create a brighter version of the same color. Although brighter and darker are inverse operations, the results of a series of invocations of these two methods may be inconsistent because of rounding errors.

See Also
darker


 Color.darker

Color.darker

Syntax
public Color darker()
Returns
a new Color object, a darker version of this color.
Description
Creates a darker version of this color.

This method applies an arbitrary scale factor to each of the three RGB components of the color to create a darker version of the same color. Although brighter and darker are inverse operations, the results of a series of invocations of these two methods may be inconsistent because of rounding errors.

See Also
brighter


 Color.decode

Color.decode

Syntax
public static Color decode( String nm ) throws NumberFormatException
Parameters
nm
a string that represents a color as a 24-bit integer.
Returns
the new color
Description
Converts a string to an integer and returns the specified color. This method handles string formats that are used to represent octal and hexidecimal numbers.

Exceptions
NumberFormatException if the specified string cannot be interpreted as a decimal, octal, or hexidecimal integer.
See Also
decode


 Color.equals

Color.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the object to compare with.
Returns
true if the objects are the same; false otherwise.
Description
Determines whether another object is equal to this color.

The result is true if and only if the argument is not null and is a Color object that has the same red, green, and blue values as this object.

Overrides
equals in class Object


 Color.getBlue

Color.getBlue

Syntax
public int getBlue()
Returns
the blue component of this color.
Description
Gets the blue component of this color. The result is an integer in the range 0 to 255.

See Also
getRGB


 Color.getColor

Color.getColor

Syntax 1
public static Color getColor( String nm )
Parameters
nm
the name of the color property
Returns
the color value of the property.
Description
Finds a color in the system properties.

The argument is treated as the name of a system property to be obtained. The string value of this property is then interpreted as an integer which is then converted to a color.

If the specified property is not found, or could not be parsed as an integer, then null is returned.

See Also
getProperty, getInteger, Color

Syntax 2
public static Color getColor( String nm, Color v )
Parameters
nm
the name of the color property
v
the default color value.
Returns
the color value of the property.
Description
Finds a color in the system properties.

The first argument is treated as the name of a system property to be obtained. The string value of this property is then interpreted as an integer which is then converted to a color.

If the specified property is not found, or cannot be parsed as an integer, then the color specified by the second argument is returned instead.

See Also
getProperty, getInteger, Color

Syntax 3
public static Color getColor( String nm, int v )
Parameters
nm
the name of the color property.
v
the default color value, as an integer.
Returns
the color value of the property.
Description
Finds a color in the system properties.

The first argument is treated as the name of a system property to be obtained. The string value of this property is then interpreted as an integer which is then converted to a color.

If the specified property is not found, or could not be parsed as an integer, then the integer value v is used instead, and is converted to a color.

See Also
getProperty, getInteger, Color


 Color.getGreen

Color.getGreen

Syntax
public int getGreen()
Returns
the green component of this color.
Description
Gets the green component of this color. The result is an integer in the range 0 to 255.

See Also
getRGB


 Color.getHSBColor

Color.getHSBColor

Syntax
public static Color getHSBColor( float h, float s, float b )
Parameters
h
the hue component.
s
the saturation of the color.
b
the brightness of the color.
Returns
a Color object with the specified hue, saturation, and brightness.
Description
Creates a Color object based on values supplied for the HSB color model.

Each of the three components should be a floating-point value between zero and one (a number in the range 0.0 ≤ h, s, b ≤ 1.0).


 Color.getRed

Color.getRed

Syntax
public int getRed()
Returns
the red component of this color.
Description
Gets the red component of this color. The result is an integer in the range 0 to 255.

See Also
getRGB


 Color.getRGB

Color.getRGB

Syntax
public int getRGB()
Description
Gets the RGB value representing the color in the default RGB ColorModel. The red, green, and blue components of the color are each scaled to be a value between 0 (abscence of the color) and 255 (complete saturation). Bits 24-31 of the returned integer are 0xff, bits 16-23 are the red value, bit 8-15 are the green value, and bits 0-7 are the blue value.

See Also
getRGBdefault, getRed, getGreen, getBlue


 Color.hashCode

Color.hashCode

Syntax
public int hashCode()
Returns
a hash code value for this object.
Description
Computes the hash code for this color.

Overrides
hashCode in class Object


 Color.HSBtoRGB

Color.HSBtoRGB

Syntax
public static int HSBtoRGB( float hue, float saturation, float brightness )
Parameters
hue
the hue component of the color.
saturation
the saturation of the color.
brightness
the brightness of the color.
Returns
the RGB value of the color with the indicated hue, saturation, and brightness.
Description
Converts the components of a color, as specified by the HSB model, to an equivalent set of values for the RGB model.

The integer that is returned by HSBtoRGB encodes the value of a color in bits 0&endash;23 of an integer value, the same format used by the method getRGB. This integer can be supplied as an argument to the Color constructor that takes a single integer argument.

See Also
getRGB, Color


 Color.RGBtoHSB

Color.RGBtoHSB

Syntax
public static float[] RGBtoHSB( int r, int g, int b, float hsbvals[] )
Parameters
r
the red component of the color.
g
the green component of the color.
b
the blue component of the color.
hsbvals
the array to be used to return the three HSB values, or null.
Returns
an array of three elements containing the hue, saturation, and brightness (in that order), of the color with the indicated red, green, and blue components.
Description
Converts the components of a color, as specified by the RGB model, to an equivalent set of values for hue, saturation, and brightness, the three components of the HSB model.

If the hsbvals argument is null, then a new array is allocated to return the result. Otherwise, the method returns the array hsbvals, with the values put into that array.

See Also
getRGB, Color


 Color.toString

Color.toString

Syntax
public String toString()
Returns
a representation of this color as a String object.
Description
Creates a string that represents this color and indicates the values of its RGB components.

Overrides
toString in class Object


 Class Component

Class java.awt.Component

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component

public abstract class Component
extends Object
implements ImageObserver, MenuContainer, Serializable

A component is an object having a graphical representation that can be displayed on the screen and that can interact with the user. Examples of components are the buttons, checkboxes, and scrollbars of a typical graphical user interface.

The Component class is the abstract superclass of the nonmenu-related Abstract Window Toolkit components. Class Component can also be extended directly to create a lightweight component. A lightweight component is a component that is not associated with a native opaque window.


 Component Members

Component Members

Class Overview | This Package | All Packages

Fields
Name | Description
BOTTOM_ALIGNMENT | Ease-of-use constant for getAlignmentY.
CENTER_ALIGNMENT | Ease-of-use constant for getAlignmentY and getAlignmentX().
LEFT_ALIGNMENT | Ease-of-use constant for getAlignmentX.
RIGHT_ALIGNMENT | Ease-of-use constant for getAlignmentX.
TOP_ALIGNMENT | Ease-of-use constant for getAlignmentY.

Constructors
Name | Description
Component() | Constructs a new component.

Methods
Name | Description
action(Event, Object) | Deprecated.
add(PopupMenu) | Adds the specified popup menu to the component.
addComponentListener(ComponentListener) | Adds the specified component listener to receive component events from this component.
addFocusListener(FocusListener) | Adds the specified focus listener to receive focus events from this component.
addKeyListener(KeyListener) | Adds the specified key listener to receive key events from this component.
addMouseListener(MouseListener) | Adds the specified mouse listener to receive mouse events from this component.
addMouseMotionListener(MouseMotionListener) | Adds the specified mouse motion listener to receive mouse motion events from this component.
addNotify() | Notifies this component that it has been added to a container and if a peer is required, it should be created.
bounds() | Deprecated.
checkImage(Image, ImageObserver) | Returns the status of the construction of a screen representation of the specified image.
checkImage(Image, int, int, ImageObserver) | Returns the status of the construction of a screen representation of the specified image.
contains(int, int) | Checks whether this component "contains" the specified point, where x and y are defined to be relative to the coordinate system of this component.
contains(Point) | Checks whether this component "contains" the specified point, where the point's x and y coordinates are defined to be relative to the coordinate system of this component.
createImage(ImageProducer) | Creates an image from the specified image producer.
createImage(int, int) | Creates an off-screen drawable image to be used for double buffering.
deliverEvent(Event) | Deprecated.
disable() | Deprecated.
disableEvents(long) | Disables the events defined by the specified event mask parameter from being delivered to this component.
dispatchEvent(AWTEvent) | Dispatches an event to this component or one of its sub components.
doLayout() | Prompts the layout manager to lay out this component.
enable() | Deprecated.
enable(boolean) | Deprecated.
enableEvents(long) | Enables the events defined by the specified event mask parameter to be delivered to this component.
getAlignmentX() | Returns the alignment along the x axis.
getAlignmentY() | Returns the alignment along the y axis.
getBackground() | Gets the background color of this component.
getBounds() | Gets the bounds of this component in the form of a Rectangle object.
getColorModel() | Gets the instance of ColorModel used to display the component on the output device.
getComponentAt(int, int) | Determines if this component or one of its immediate subcomponents contains the (x, y) location, and if so, returns the containing component.
getComponentAt(Point) | Returns the component or subcomponent that contains the specified point.
getCursor() | Gets the cursor set on this component.
getFont() | Gets the font of this component.
getFontMetrics(Font) | Gets the font metrics for the specified font.
getForeground() | Gets the foreground color of this component.
getGraphics() | Creates a graphics context for this component.
getLocale() | Gets the locale of this component.
getLocation() | Gets the location of this component in the form of a point specifying the component's top-left corner.
getLocationOnScreen() | Gets the location of this component in the form of a point specifying the component's top-left corner in the screen's coordinate space.
getMaximumSize() | Gets the maximum size of this component.
getMinimumSize() | Gets the mininimum size of this component.
getName() | Gets the name of the component.
getParent() | Gets the parent of this component.
getPeer() | Deprecated.
getPreferredSize() | Gets the preferred size of this component.
getSize() | Returns the size of this component in the form of a Dimension object.
getToolkit() | Gets the toolkit of this component.
getTreeLock() | Gets this component's locking object (the object that owns the thread sychronization monitor) for AWT component-tree and layout operations.
gotFocus(Event, Object) | Deprecated.
handleEvent(Event) | Deprecated.
hide() | Deprecated.
imageUpdate(Image, int, int, int, int, int) | Repaints the component when the image has changed.
inside(int, int) | Deprecated.
invalidate() | Invalidates this component.
isEnabled() | Determines whether this component is enabled.
isFocusTraversable() | Returns the value of a flag that indicates whether this component can be traversed using Tab or Shift-Tab keyboard focus traversal.
isShowing() | Determines whether this component is showing on screen.
isValid() | Determines whether this component is valid.
isVisible() | Determines whether this component is visible.
keyDown(Event, int) | Deprecated.
keyUp(Event, int) | Deprecated.
layout() | Deprecated.
list() | Prints a listing of this component to the standard system output stream System.out.
list(PrintStream) | Prints a listing of this component to the specified output stream.
list(PrintStream, int) | Prints out a list, starting at the specified indention, to the specified print stream.
list(PrintWriter) | Prints a listing to the specified print writer.
list(PrintWriter, int) | Prints out a list, starting at the specified indention, to the specified print writer.
locate(int, int) | Deprecated.
location() | Deprecated.
lostFocus(Event, Object) | Deprecated.
minimumSize() | Deprecated.
mouseDown(Event, int, int) | Deprecated.
mouseDrag(Event, int, int) | Deprecated.
mouseEnter(Event, int, int) | Deprecated.
mouseExit(Event, int, int) | Deprecated.
mouseMove(Event, int, int) | Deprecated.
mouseUp(Event, int, int) | Deprecated.
move(int, int) | Deprecated.
nextFocus() | Deprecated.
paint(Graphics) | Paints this component.
paintAll(Graphics) | Paints this component and all of its subcomponents.
paramString() | Returns the parameter string representing the state of this component.
postEvent(Event) | Deprecated.
preferredSize() | Deprecated.
prepareImage(Image, ImageObserver) | Prepares an image for rendering on this component.
prepareImage(Image, int, int, ImageObserver) | Prepares an image for rendering on this component at the specified width and height.
print(Graphics) | Prints this component.
printAll(Graphics) | Prints this component and all of its subcomponents.
processComponentEvent(ComponentEvent) | Processes component events occurring on this component by dispatching them to any registered ComponentListener objects.
processEvent(AWTEvent) | Processes events occurring on this component.
processFocusEvent(FocusEvent) | Processes focus events occurring on this component by dispatching them to any registered FocusListener objects.
processKeyEvent(KeyEvent) | Processes key events occurring on this component by dispatching them to any registered KeyListener objects.
processMouseEvent(MouseEvent) | Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects.
processMouseMotionEvent(MouseEvent) | Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListener objects.
remove(MenuComponent) | Removes the specified popup menu from the component.
removeComponentListener(ComponentListener) | Removes the specified component listener so that it no longer receives component events from this component.
removeFocusListener(FocusListener) | Removes the specified focus listener so that it no longer receives focus events from this component.
removeKeyListener(KeyListener) | Removes the specified key listener so that it no longer receives key events from this component.
removeMouseListener(MouseListener) | Removes the specified mouse listener so that it no longer receives mouse events from this component.
removeMouseMotionListener(MouseMotionListener) | Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component.
removeNotify() | Notifies this component that it has been removed from its container and if a peers exists, it destroys it.
repaint() | Repaints this component.
repaint(int, int, int, int) | Repaints the specified rectangle of this component.
repaint(long) | Repaints the component.
repaint(long, int, int, int, int) | Repaints the specified rectangle of this component within tm milliseconds.
requestFocus() | Requests that this component get the input focus.
reshape(int, int, int, int) | Deprecated.
resize(Dimension) | Deprecated.
resize(int, int) | Deprecated.
setBackground(Color) | Sets the background color of this component.
setBounds(int, int, int, int) | Moves and resizes this component.
setBounds(Rectangle) | Moves and resizes this component to conform to the new bounding rectangle r.
setCursor(Cursor) | Set the cursor image to a predefined cursor.
setEnabled(boolean) | Enables or disables this component, depending on the value of the parameter b.
setFont(Font) | Sets the font of this component.
setForeground(Color) | Sets the foreground color of this component.
setLocale(Locale) | Sets the locale of this component.
setLocation(int, int) | Moves this component to a new location.
setLocation(Point) | Moves this component to a new location.
setName(String) | Sets the name of the component to the specified string.
setSize(Dimension) | Resizes this component so that it has width d.width and height d.height.
setSize(int, int) | Resizes this component so that it has width width and height.
setVisible(boolean) | Shows or hides this component depending on the value of parameter b.
show() | Deprecated.
show(boolean) | Deprecated.
size() | Deprecated.
toString() | Returns a string representation of this component and its values.
transferFocus() | Transfers the focus to the next component.
update(Graphics) | Updates this component.
validate() | Ensures that this component has a valid layout.


 Component.BOTTOM_ALIGNMENT

Component.BOTTOM_ALIGNMENT

Syntax
public static final float BOTTOM_ALIGNMENT
Description
Ease-of-use constant for getAlignmentY. Specifies an alignment to the bottom of the component.

See Also
getAlignmentY


 Component.CENTER_ALIGNMENT

Component.CENTER_ALIGNMENT

Syntax
public static final float CENTER_ALIGNMENT
Description
Ease-of-use constant for getAlignmentY and getAlignmentX. Specifies an alignment to the center of the component

See Also
getAlignmentX, getAlignmentY


 Component.LEFT_ALIGNMENT

Component.LEFT_ALIGNMENT

Syntax
public static final float LEFT_ALIGNMENT
Description
Ease-of-use constant for getAlignmentX. Specifies an alignment to the left side of the component.

See Also
getAlignmentX


 Component.RIGHT_ALIGNMENT

Component.RIGHT_ALIGNMENT

Syntax
public static final float RIGHT_ALIGNMENT
Description
Ease-of-use constant for getAlignmentX. Specifies an alignment to the right side of the component.

See Also
getAlignmentX


 Component.TOP_ALIGNMENT

Component.TOP_ALIGNMENT

Syntax
public static final float TOP_ALIGNMENT
Description
Ease-of-use constant for getAlignmentY(). Specifies an alignment to the top of the component.

See Also
getAlignmentY


 Component.Component

Component.Component

Syntax
protected Component()
Description
Constructs a new component. Class Component can be extended directly to create a lightweight component that does not utilize an opaque native window. A lightweight component must be hosted by a native container somewhere higher up in the component tree (for example, by a Frame object).


 Component.action

Component.action

Syntax
public boolean action( Event evt, Object what )
Description
Note: action() is deprecated. As of JDK version 1.1, should register this component as ActionListener on component which fires action events.


 Component.add

Component.add

Syntax
public synchronized void add( PopupMenu popup )
Parameters
popup
the popup menu to be added to the component.
Description
Adds the specified popup menu to the component.

See Also
remove


 Component.addComponentListener

Component.addComponentListener

Syntax
public synchronized void addComponentListener( ComponentListener l )
Parameters
l
the component listener.
Description
Adds the specified component listener to receive component events from this component.

See Also
ComponentEvent, ComponentListener, removeComponentListener


 Component.addFocusListener

Component.addFocusListener

Syntax
public synchronized void addFocusListener( FocusListener l )
Parameters
l
the focus listener.
Description
Adds the specified focus listener to receive focus events from this component.

See Also
FocusEvent, FocusListener, removeFocusListener


 Component.addKeyListener

Component.addKeyListener

Syntax
public synchronized void addKeyListener( KeyListener l )
Parameters
l
the key listener.
Description
Adds the specified key listener to receive key events from this component.

See Also
KeyEvent, KeyListener, removeKeyListener


 Component.addMouseListener

Component.addMouseListener

Syntax
public synchronized void addMouseListener( MouseListener l )
Parameters
l
the mouse listener.
Description
Adds the specified mouse listener to receive mouse events from this component.

See Also
MouseEvent, MouseListener, removeMouseListener


 Component.addMouseMotionListener

Component.addMouseMotionListener

Syntax
public synchronized void addMouseMotionListener( MouseMotionListener l )
Parameters
l
the mouse motion listener.
Description
Adds the specified mouse motion listener to receive mouse motion events from this component.

See Also
MouseMotionEvent, MouseMotionListener, removeMouseMotionListener


 Component.addNotify

Component.addNotify

Syntax
public void addNotify()
Description
Notifies this component that it has been added to a container and if a peer is required, it should be created. This method should be called by Container.add, and not by user code directly.

See Also
removeNotify


 Component.bounds

Component.bounds

Syntax
public Rectangle bounds()
Description
Note: bounds() is deprecated. As of JDK version 1.1, replaced by getBounds().


 Component.checkImage

Component.checkImage

Syntax 1
public int checkImage( Image image, ImageObserver observer )
Parameters
image
the Image object whose status is being checked.
observer
the ImageObserver object to be notified as the image is being prepared.
Returns
the bitwise inclusive OR of ImageObserver flags indicating what information about the image is currently available.
Description
Returns the status of the construction of a screen representation of the specified image.

This method does not cause the image to begin loading. An application must use the prepareImage method to force the loading of an image.

Information on the flags returned by this method can be found with the discussion of the ImageObserver interface.

See Also
prepareImage, checkImage, ImageObserver

Syntax 2
public int checkImage( Image image, int width, int height, ImageObserver observer )
Parameters
image
the Image object whose status is being checked.
width
the width of the scaled version whose status is to be checked.
height
the height of the scaled version whose status is to be checked.
observer
the ImageObserver object to be notified as the image is being prepared.
Returns
the bitwise inclusive OR of ImageObserver flags indicating what information about the image is currently available.
Description
Returns the status of the construction of a screen representation of the specified image.

This method does not cause the image to begin loading. An application must use the prepareImage method to force the loading of an image.

The checkImage method of Component calls its peer's checkImage method to calculate the flags. If this component does not yet have a peer, the component's toolkit's checkImage method is called instead.

Information on the flags returned by this method can be found with the discussion of the ImageObserver interface.

See Also
prepareImage, checkImage, _top_


 Component.contains

Component.contains

Syntax 1
public boolean contains( int x, int y )
Parameters
x
the x coordinate of the point.
y
the y coordinate of the point.
Description
Checks whether this component "contains" the specified point, where x and y are defined to be relative to the coordinate system of this component.

See Also
getComponentAt

Syntax 2
public boolean contains( Point p )
Parameters
p
the point.
Description
Checks whether this component "contains" the specified point, where the point's x and y coordinates are defined to be relative to the coordinate system of this component.

See Also
getComponentAt


 Component.createImage

Component.createImage

Syntax 1
public Image createImage( ImageProducer producer )
Parameters
producer
the image producer
Returns
the image produced.
Description
Creates an image from the specified image producer.

Syntax 2
public Image createImage( int width, int height )
Parameters
width
the specified width.
height
the specified height.
Returns
an off-screen drawable image, which can be used for double buffering.
Description
Creates an off-screen drawable image to be used for double buffering.


 Component.deliverEvent

Component.deliverEvent

Syntax
public void deliverEvent( Event e )
Description
Note: deliverEvent() is deprecated. As of JDK version 1.1, replaced by dispatchEvent(AWTEvent e).


 Component.disable

Component.disable

Syntax
public void disable()
Description
Note: disable() is deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).


 Component.disableEvents

Component.disableEvents

Syntax
protected final void disableEvents( long eventsToDisable )
Parameters
eventsToDisable
the event mask defining the event types
Description
Disables the events defined by the specified event mask parameter from being delivered to this component.

See Also
enableEvents


 Component.dispatchEvent

Component.dispatchEvent

Syntax
public final void dispatchEvent( AWTEvent e )
Parameters
e
the event
Description
Dispatches an event to this component or one of its sub components.


 Component.doLayout

Component.doLayout

Syntax
public void doLayout()
Description
Prompts the layout manager to lay out this component. This is usually called when the component (more specifically, container) is validated.

See Also
validate, LayoutManager


 Component.enable

Component.enable

Syntax 1
public void enable()
Description
Note: enable() is deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).

Syntax 2
public void enable( boolean b )
Description
Note: enable() is deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).


 Component.enableEvents

Component.enableEvents

Syntax
protected final void enableEvents( long eventsToEnable )
Parameters
eventsToEnable
the event mask defining the event types.
Description
Enables the events defined by the specified event mask parameter to be delivered to this component.

Event types are automatically enabled when a listener for that event type is added to the component.

This method only needs to be invoked by subclasses of Component which desire to have the specified event types delivered to processEvent regardless of whether or not a listener is registered.

See Also
processEvent, disableEvents


 Component.getAlignmentX

Component.getAlignmentX

Syntax
public float getAlignmentX()
Description
Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.


 Component.getAlignmentY

Component.getAlignmentY

Syntax
public float getAlignmentY()
Description
Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.


 Component.getBackground

Component.getBackground

Syntax
public Color getBackground()
Returns
This component's background color. If this component does not have a background color, the background color of its parent is returned.
Description
Gets the background color of this component.

See Also
setBackground


 Component.getBounds

Component.getBounds

Syntax
public Rectangle getBounds()
Returns
A rectangle indicating this component's bounds.
Description
Gets the bounds of this component in the form of a Rectangle object. The bounds specify this component's width, height, and location relative to its parent.

See Also
setBounds, getLocation, getSize


 Component.getColorModel

Component.getColorModel

Syntax
public ColorModel getColorModel()
Returns
The color model used by this component.
Description
Gets the instance of ColorModel used to display the component on the output device.

See Also
ColorModel, getColorModel, getColorModel


 Component.getComponentAt

Component.getComponentAt

Syntax 1
public Component getComponentAt( int x, int y )
Parameters
x
the x coordinate.
y
the y coordinate.
Returns
the component or subcomponent that contains the (x, y) location; null if the location is outside this component.
Description
Determines if this component or one of its immediate subcomponents contains the (x, y) location, and if so, returns the containing component. This method only looks one level deep. If the point (x, y) is inside a subcomponent that itself has subcomponents, it does not go looking down the subcomponent tree.

The locate method of Component simply returns the component itself if the (x, y) coordinate location is inside its bounding box, and null otherwise.

See Also
contains

Syntax 2
public Component getComponentAt( Point p )
Parameters
p
the point.
Description
Returns the component or subcomponent that contains the specified point.

See Also
contains


 Component.getCursor

Component.getCursor

Syntax
public Cursor getCursor()
Returns
The cursor for this component.
Description
Gets the cursor set on this component.

See Also
setCursor, Cursor


 Component.getFont

Component.getFont

Syntax
public Font getFont()
Returns
This component's font. If a font has not been set for this component, the font of its parent is returned.
Description
Gets the font of this component.

See Also
setFont


 Component.getFontMetrics

Component.getFontMetrics

Syntax
public FontMetrics getFontMetrics( Font font )
Parameters
font
The font for which font metrics is to be obtained.
font
the font.
Returns
The font metrics for font.
Description
Gets the font metrics for the specified font.

See Also
getFont, getPeer, getFontMetrics, getFontMetrics


 Component.getForeground

Component.getForeground

Syntax
public Color getForeground()
Returns
This component's foreground color. If this component does not have a foreground color, the foreground color of its parent is returned.
Description
Gets the foreground color of this component.

See Also
java.awt.Component#setForeground


 Component.getGraphics

Component.getGraphics

Syntax
public Graphics getGraphics()
Returns
A graphics context for this component, or null if it has none.
Description
Creates a graphics context for this component. This method will return null if this component is currently not on the screen.

See Also
paint


 Component.getLocale

Component.getLocale

Syntax
public Locale getLocale()
Returns
This component's locale. If this component does not have a locale, the locale of its parent is returned.
Description
Gets the locale of this component.

Exceptions
IllegalComponentStateException If the Component does not have its own locale and has not yet been added to a containment hierarchy such that the locale can be determined from the containing parent.
See Also
setLocale


 Component.getLocation

Component.getLocation

Syntax
public Point getLocation()
Returns
An instance of Point representing the top-left corner of the component's bounds in the coordinate space of the component's parent.
Description
Gets the location of this component in the form of a point specifying the component's top-left corner. The location will be relative to the parent's coordinate space.

See Also
setLocation, getLocationOnScreen


 Component.getLocationOnScreen

Component.getLocationOnScreen

Syntax
public Point getLocationOnScreen()
Returns
An instance of Point representing the top-left corner of the component's bounds in the coordinate space of the screen.
Description
Gets the location of this component in the form of a point specifying the component's top-left corner in the screen's coordinate space.

See Also
setLocation, getLocation


 Component.getMaximumSize

Component.getMaximumSize

Syntax
public Dimension getMaximumSize()
Returns
A dimension object indicating this component's maximum size.
Description
Gets the maximum size of this component.

See Also
getMinimumSize, getPreferredSize, LayoutManager


 Component.getMinimumSize

Component.getMinimumSize

Syntax
public Dimension getMinimumSize()
Returns
A dimension object indicating this component's minimum size.
Description
Gets the mininimum size of this component.

See Also
getPreferredSize, awtLayoutManager


 Component.getName

Component.getName

Syntax
public String getName()
Returns
This component's name.
Description
Gets the name of the component.

See Also
setName


 Component.getParent

Component.getParent

Syntax
public Container getParent()
Returns
The parent container of this component.
Description
Gets the parent of this component.


 Component.getPeer

Component.getPeer

Syntax
public ComponentPeer getPeer()
Description
Note: getPeer() is deprecated. As of JDK version 1.1, programs should not directly manipulate peers.


 Component.getPreferredSize

Component.getPreferredSize

Syntax
public Dimension getPreferredSize()
Returns
A dimension object indicating this component's preferred size.
Description
Gets the preferred size of this component.

See Also
getMinimumSize, LayoutManager


 Component.getSize

Component.getSize

Syntax
public Dimension getSize()
Returns
A Dimension object that indicates the size of this component.
Description
Returns the size of this component in the form of a Dimension object. The height field of the Dimension object contains this component's height, and the width field of the Dimension object contains this component's width.

See Also
setSize


 Component.getToolkit

Component.getToolkit

Syntax
public Toolkit getToolkit()
Returns
The toolkit of this component.
Description
Gets the toolkit of this component. Note that the frame that contains a component controls which toolkit is used by that component. Therefore if the component is moved from one frame to another, the toolkit it uses may change.


 Component.getTreeLock

Component.getTreeLock

Syntax
public final Object getTreeLock()
Returns
This component's locking object.
Description
Gets this component's locking object (the object that owns the thread sychronization monitor) for AWT component-tree and layout operations.


 Component.gotFocus

Component.gotFocus

Syntax
public boolean gotFocus( Event evt, Object what )
Description
Note: gotFocus() is deprecated. As of JDK version 1.1, replaced by processFocusEvent(FocusEvent).


 Component.handleEvent

Component.handleEvent

Syntax
public boolean handleEvent( Event evt )
Description
Note: handleEvent() is deprecated. As of JDK version 1.1 replaced by processEvent(AWTEvent).


 Component.hide

Component.hide

Syntax
public void hide()
Description
Note: hide() is deprecated. As of JDK version 1.1, replaced by setVisible(boolean).


 Component.imageUpdate

Component.imageUpdate

Syntax
public boolean imageUpdate( Image img, int flags, int x, int y, int w, int h )
Parameters
img
the image being observed.
infoflags
see imageUpdate for more information.
x
the x coordinate.
y
the y coordinate.
width
the width.
height
the height.
Returns
true if the flags indicate that the image is completely loaded; false otherwise.
Description
Repaints the component when the image has changed. This imageUpdate method of an ImageObserver is called when more information about an image which had been previously requested using an asynchronous routine such as the drawImage method of Graphics becomes available. See the definition of imageUpdate for more information on this method and its arguments.

The imageUpdate method of Component incrementally draws an image on the component as more of the bits of the image are available.

If the system property awt.image.incrementalDraw is missing or has the value true, the image is incrementally drawn, If the system property has any other value, then the image is not drawn until it has been completely loaded.

Also, if incremental drawing is in effect, the value of the system property awt.image.redrawrate is interpreted as an integer to give the maximum redraw rate, in milliseconds. If the system property is missing or cannot be interpreted as an integer, the redraw rate is once every 100ms.

The interpretation of the x, y, width, and height arguments depends on the value of the infoflags argument.

See Also
ImageObserver, drawImage, drawImage, drawImage, drawImage, imageUpdate


 Component.inside

Component.inside

Syntax
public boolean inside( int x, int y )
Description
Note: inside() is deprecated. As of JDK version 1.1, replaced by contains(int, int).


 Component.invalidate

Component.invalidate

Syntax
public void invalidate()
Description
Invalidates this component. This component and all parents above it are marked as needing to be laid out. This method can be called often, so it needs to execute quickly.

See Also
validate, doLayout, LayoutManager


 Component.isEnabled

Component.isEnabled

Syntax
public boolean isEnabled()
Returns
true if the component is enabled; false otherwise.
Description
Determines whether this component is enabled. An enabled component can respond to user input and generate events. Components are enabled initially by default. A component may be enabled or disabled by calling its setEnabled method.

See Also
setEnabled


 Component.isFocusTraversable

Component.isFocusTraversable

Syntax
public boolean isFocusTraversable()
Returns
true if this component is focus-traverable; false otherwise.
Description
Returns the value of a flag that indicates whether this component can be traversed using Tab or Shift-Tab keyboard focus traversal. If this method returns "false", this component may still request the keyboard focus using requestFocus(), but it will not automatically be assigned focus during tab traversal.


 Component.isShowing

Component.isShowing

Syntax
public boolean isShowing()
Returns
true if the component is showing; false otherwise.
Description
Determines whether this component is showing on screen. This means that the component must be visible, and it must be in a container that is visible and showing.

See Also
setVisible


 Component.isValid

Component.isValid

Syntax
public boolean isValid()
Returns
true if the component is valid; false otherwise.
Description
Determines whether this component is valid. Components are invalidated when they are first shown on the screen.

See Also
validate, invalidate


 Component.isVisible

Component.isVisible

Syntax
public boolean isVisible()
Returns
true if the component is visible; false otherwise.
Description
Determines whether this component is visible. Components are initially visible, with the exception of top level components such as Frame objects.

See Also
setVisible


 Component.keyDown

Component.keyDown

Syntax
public boolean keyDown( Event evt, int key )
Description
Note: keyDown() is deprecated. As of JDK version 1.1, replaced by processKeyEvent(KeyEvent).


 Component.keyUp

Component.keyUp

Syntax
public boolean keyUp( Event evt, int key )
Description
Note: keyUp() is deprecated. As of JDK version 1.1, replaced by processKeyEvent(KeyEvent).


 Component.layout

Component.layout

Syntax
public void layout()
Description
Note: layout() is deprecated. As of JDK version 1.1, replaced by doLayout().


 Component.list

Component.list

Syntax 1
public void list()
Description
Prints a listing of this component to the standard system output stream System.out.

See Also
out

Syntax 2
public void list( PrintStream out )
Parameters
out
a print stream.
Description
Prints a listing of this component to the specified output stream.

Syntax 3
public void list( PrintStream out, int indent )
Parameters
out
a print stream.
indent
number of spaces to indent.
Description
Prints out a list, starting at the specified indention, to the specified print stream.

See Also
println

Syntax 4
public void list( PrintWriter out )
Parameters
out
The print writer to print to.
Description
Prints a listing to the specified print writer.

Syntax 5
public void list( PrintWriter out, int indent )
Parameters
out
The print writer to print to.
indent
The number of spaces to indent.
Description
Prints out a list, starting at the specified indention, to the specified print writer.

See Also
println


 Component.locate

Component.locate

Syntax
public Component locate( int x, int y )
Description
Note: locate() is deprecated. As of JDK version 1.1, replaced by getComponentAt(int, int).


 Component.location

Component.location

Syntax
public Point location()
Description
Note: location() is deprecated. As of JDK version 1.1, replaced by getLocation().


 Component.lostFocus

Component.lostFocus

Syntax
public boolean lostFocus( Event evt, Object what )
Description
Note: lostFocus() is deprecated. As of JDK version 1.1, replaced by processFocusEvent(FocusEvent).


 Component.minimumSize

Component.minimumSize

Syntax
public Dimension minimumSize()
Description
Note: minimumSize() is deprecated. As of JDK version 1.1, replaced by getMinimumSize().


 Component.mouseDown

Component.mouseDown

Syntax
public boolean mouseDown( Event evt, int x, int y )
Description
Note: mouseDown() is deprecated. As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).


 Component.mouseDrag

Component.mouseDrag

Syntax
public boolean mouseDrag( Event evt, int x, int y )
Description
Note: mouseDrag() is deprecated. As of JDK version 1.1, replaced by processMouseMotionEvent(MouseEvent).


 Component.mouseEnter

Component.mouseEnter

Syntax
public boolean mouseEnter( Event evt, int x, int y )
Description
Note: mouseEnter() is deprecated. As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).


 Component.mouseExit

Component.mouseExit

Syntax
public boolean mouseExit( Event evt, int x, int y )
Description
Note: mouseExit() is deprecated. As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).


 Component.mouseMove

Component.mouseMove

Syntax
public boolean mouseMove( Event evt, int x, int y )
Description
Note: mouseMove() is deprecated. As of JDK version 1.1, replaced by processMouseMotionEvent(MouseEvent).


 Component.mouseUp

Component.mouseUp

Syntax
public boolean mouseUp( Event evt, int x, int y )
Description
Note: mouseUp() is deprecated. As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).


 Component.move

Component.move

Syntax
public void move( int x, int y )
Description
Note: move() is deprecated. As of JDK version 1.1, replaced by setLocation(int, int).


 Component.nextFocus

Component.nextFocus

Syntax
public void nextFocus()
Description
Note: nextFocus() is deprecated. As of JDK version 1.1, replaced by transferFocus().


 Component.paint

Component.paint

Syntax
public void paint( Graphics g )
Parameters
g
The graphics context to use for painting.
Description
Paints this component. This method is called when the contents of the component should be painted in response to the component first being shown or damage needing repair. The clip rectangle in the Graphics parameter will be set to the area which needs to be painted.

See Also
update


 Component.paintAll

Component.paintAll

Syntax
public void paintAll( Graphics g )
Parameters
g
the graphics context to use for painting.
Description
Paints this component and all of its subcomponents.

The origin of the graphics context, its (0, 0) coordinate point, is the top-left corner of this component. The clipping region of the graphics context is the bounding rectangle of this component.

See Also
paint


 Component.paramString

Component.paramString

Syntax
protected String paramString()
Returns
the parameter string of this component.
Description
Returns the parameter string representing the state of this component. This string is useful for debugging.


 Component.postEvent

Component.postEvent

Syntax
public boolean postEvent( Event e )
Description
Note: postEvent() is deprecated. As of JDK version 1.1, replaced by dispatchEvent(AWTEvent).


 Component.preferredSize

Component.preferredSize

Syntax
public Dimension preferredSize()
Description
Note: preferredSize() is deprecated. As of JDK version 1.1, replaced by getPreferredSize().


 Component.prepareImage

Component.prepareImage

Syntax 1
public boolean prepareImage( Image image, ImageObserver observer )
Parameters
image
the Image for which to prepare a screen representation.
observer
the ImageObserver object to be notified as the image is being prepared.
Returns
true if the image has already been fully prepared; false otherwise.
Description
Prepares an image for rendering on this component. The image data is downloaded asynchronously in another thread and the appropriate screen representation of the image is generated.

Syntax 2
public boolean prepareImage( Image image, int width, int height, ImageObserver observer )
Parameters
image
the instance of Image for which to prepare a screen representation.
width
the width of the desired screen representation.
height
the height of the desired screen representation.
observer
the ImageObserver object to be notified as the image is being prepared.
Returns
true if the image has already been fully prepared; false otherwise.
Description
Prepares an image for rendering on this component at the specified width and height.

The image data is downloaded asynchronously in another thread, and an appropriately scaled screen representation of the image is generated.

See Also
ImageObserver


 Component.print

Component.print

Syntax
public void print( Graphics g )
Parameters
g
the graphics context to use for printing.
Description
Prints this component. Applications should override this method for components that must do special processing before being printed or should be printed differently than they are painted.

The default implementation of this method calls the paint method.

The origin of the graphics context, its (0, 0) coordinate point, is the top-left corner of this component. The clipping region of the graphics context is the bounding rectangle of this component.

See Also
paint


 Component.printAll

Component.printAll

Syntax
public void printAll( Graphics g )
Parameters
g
the graphics context to use for printing.
Description
Prints this component and all of its subcomponents.

The origin of the graphics context, its (0, 0) coordinate point, is the top-left corner of this component. The clipping region of the graphics context is the bounding rectangle of this component.

See Also
print


 Component.processComponentEvent

Component.processComponentEvent

Syntax
protected void processComponentEvent( ComponentEvent e )
Parameters
e
the component event.
Description
Processes component events occurring on this component by dispatching them to any registered ComponentListener objects.

This method is not called unless component events are enabled for this component. Component events are enabled when one of the following occurs:

  • A ComponentListener object is registered via addComponentListener.
  • Component events are enabled via enableEvents.

See Also
ComponentEvent, ComponentListener, addComponentListener, enableEvents


 Component.processEvent

Component.processEvent

Syntax
protected void processEvent( AWTEvent e )
Parameters
e
the event.
Description
Processes events occurring on this component. By default this method calls the appropriate process<event type>Event method for the given class of event.

See Also
processComponentEvent, processFocusEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent


 Component.processFocusEvent

Component.processFocusEvent

Syntax
protected void processFocusEvent( FocusEvent e )
Parameters
e
the focus event.
Description
Processes focus events occurring on this component by dispatching them to any registered FocusListener objects.

This method is not called unless focus events are enabled for this component. Focus events are enabled when one of the following occurs:

  • A FocusListener object is registered via addFocusListener.
  • Focus events are enabled via enableEvents.

See Also
FocusEvent, FocusListener, addFocusListener, enableEvents


 Component.processKeyEvent

Component.processKeyEvent

Syntax
protected void processKeyEvent( KeyEvent e )
Parameters
e
the key event.
Description
Processes key events occurring on this component by dispatching them to any registered KeyListener objects.

This method is not called unless key events are enabled for this component. Key events are enabled when one of the following occurs:

  • A KeyListener object is registered via addKeyListener.
  • Key events are enabled via enableEvents.

See Also
KeyEvent, KeyListener, addKeyListener, enableEvents


 Component.processMouseEvent

Component.processMouseEvent

Syntax
protected void processMouseEvent( MouseEvent e )
Parameters
e
the mouse event.
Description
Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects.

This method is not called unless mouse events are enabled for this component. Mouse events are enabled when one of the following occurs:

  • A MouseListener object is registered via addMouseListener.
  • Mouse events are enabled via enableEvents.

See Also
MouseEvent, MouseListener, addMouseListener, enableEvents


 Component.processMouseMotionEvent

Component.processMouseMotionEvent

Syntax
protected void processMouseMotionEvent( MouseEvent e )
Parameters
e
the mouse motion event.
Description
Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListener objects.

This method is not called unless mouse motion events are enabled for this component. Mouse motion events are enabled when one of the following occurs:

  • A MouseMotionListener object is registered via addMouseMotionListener.
  • Mouse motion events are enabled via enableEvents.

See Also
MouseMotionEvent, MouseMotionListener, addMouseMotionListener, enableEvents


 Component.remove

Component.remove

Syntax
public synchronized void remove( MenuComponent popup )
Parameters
popup
the popup menu to be removed.
Description
Removes the specified popup menu from the component.

See Also
add


 Component.removeComponentListener

Component.removeComponentListener

Syntax
public synchronized void removeComponentListener( ComponentListener l )
Parameters
l
the component listener.
Description
Removes the specified component listener so that it no longer receives component events from this component.

See Also
ComponentEvent, ComponentListener, addComponentListener


 Component.removeFocusListener

Component.removeFocusListener

Syntax
public synchronized void removeFocusListener( FocusListener l )
Parameters
l
the focus listener.
Description
Removes the specified focus listener so that it no longer receives focus events from this component.

See Also
FocusEvent, FocusListener, addFocusListener


 Component.removeKeyListener

Component.removeKeyListener

Syntax
public synchronized void removeKeyListener( KeyListener l )
Parameters
l
the key listener.
Description
Removes the specified key listener so that it no longer receives key events from this component.

See Also
KeyEvent, KeyListener, addKeyListener


 Component.removeMouseListener

Component.removeMouseListener

Syntax
public synchronized void removeMouseListener( MouseListener l )
Parameters
l
the mouse listener.
Description
Removes the specified mouse listener so that it no longer receives mouse events from this component.

See Also
MouseEvent, MouseListener, addMouseListener


 Component.removeMouseMotionListener

Component.removeMouseMotionListener

Syntax
public synchronized void removeMouseMotionListener( MouseMotionListener l )
Parameters
l
the mouse motion listener.
Description
Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component.

See Also
MouseMotionEvent, MouseMotionListener, addMouseMotionListener


 Component.removeNotify

Component.removeNotify

Syntax
public void removeNotify()
Description
Notifies this component that it has been removed from its container and if a peers exists, it destroys it. This method should be called by Container.remove, and not by user code directly.

See Also
addNotify


 Component.repaint

Component.repaint

Syntax 1
public void repaint()
Description
Repaints this component.

This method causes a call to this component's update method as soon as possible.

See Also
update

Syntax 2
public void repaint( long tm )
Parameters
tm
maximum time in milliseconds before update
Description
Repaints the component. This will result in a call to update within tm milliseconds.

See Also
paint, update

Syntax 3
public void repaint( int x, int y, int width, int height )
Parameters
x
the x coordinate.
y
the y coordinate.
width
the width.
height
the height.
Description
Repaints the specified rectangle of this component.

This method causes a call to this component's update method as soon as possible.

See Also
update

Syntax 4
public void repaint( long tm, int x, int y, int width, int height )
Parameters
tm
maximum time in milliseconds before update.
x
the x coordinate.
y
the y coordinate.
width
the width.
height
the height.
Description
Repaints the specified rectangle of this component within tm milliseconds.

This method causes a call to this component's update method.

See Also
update


 Component.requestFocus

Component.requestFocus

Syntax
public void requestFocus()
Description
Requests that this component get the input focus.

This component's gotFocus method is called when this method is successful. The component must be visible on the screen for this request to be granted

See Also
FocusEvent, addFocusListener, processFocusEvent, isFocusTraversable


 Component.reshape

Component.reshape

Syntax
public void reshape( int x, int y, int width, int height )
Description
Note: reshape() is deprecated. As of JDK version 1.1, replaced by setBounds(int, int, int, int).


 Component.resize

Component.resize

Syntax 1
public void resize( int width, int height )
Description
Note: resize() is deprecated. As of JDK version 1.1, replaced by setSize(int, int).

Syntax 2
public void resize( Dimension d )
Description
Note: resize() is deprecated. As of JDK version 1.1, replaced by setSize(Dimension).


 Component.setBackground

Component.setBackground

Syntax
public void setBackground( Color c )
Parameters
c
The color to become this component's background color.
Description
Sets the background color of this component.

See Also
getBackground


 Component.setBounds

Component.setBounds

Syntax 1
public void setBounds( int x, int y, int width, int height )
Parameters
x
The new x-coordinate of this component.
y
The new y-coordinate of this component.
width
The new width of this component.
height
The new height of this component.
Description
Moves and resizes this component. The new location of the top-left corner is specified by x and y, and the new size is specified by width and height.

See Also
getBounds, setLocation, setLocation, setSize, setSize

Syntax 2
public void setBounds( Rectangle r )
Parameters
r
The new bounding rectangle for this component.
Description
Moves and resizes this component to conform to the new bounding rectangle r. This component's new position is specified by r.x and r.y, and its new size is specified by r.width and r.height.

See Also
getBounds, setLocation, setLocation, setSize, setSize


 Component.setCursor

Component.setCursor

Syntax
public synchronized void setCursor( Cursor cursor )
Parameters
cursor
One of the constants defined by the Cursor class.
Description
Set the cursor image to a predefined cursor.

See Also
getCursor, Cursor


 Component.setEnabled

Component.setEnabled

Syntax
public void setEnabled( boolean b )
Parameters
b
If true, this component is enabled; otherwise this component is disabled.
Description
Enables or disables this component, depending on the value of the parameter b. An enabled component can respond to user input and generate events. Components are enabled initially by default.

See Also
isEnabled


 Component.setFont

Component.setFont

Syntax
public synchronized void setFont( Font f )
Parameters
f
The font to become this component's font.
Description
Sets the font of this component.

See Also
getFont


 Component.setForeground

Component.setForeground

Syntax
public void setForeground( Color c )
Parameters
c
The color to become this component's foreground color.
Description
Sets the foreground color of this component.

See Also
getForeground


 Component.setLocale

Component.setLocale

Syntax
public void setLocale( Locale l )
Parameters
l
The locale to become this component's locale.
Description
Sets the locale of this component.

See Also
getLocale


 Component.setLocation

Component.setLocation

Syntax 1
public void setLocation( int x, int y )
Parameters
x
The x-coordinate of the new location's top-left corner in the parent's coordinate space.
y
The y-coordinate of the new location's top-left corner in the parent's coordinate space.
Description
Moves this component to a new location. The top-left corner of the new location is specified by the x and y parameters in the coordinate space of this component's parent.

See Also
getLocation, setBounds

Syntax 2
public void setLocation( Point p )
Parameters
p
The point defining the top-left corner of the new location, given in the coordinate space of this component's parent.
Description
Moves this component to a new location. The top-left corner of the new location is specified by point p. Point p is given in the parent's coordinate space.

See Also
getLocation, setBounds


 Component.setName

Component.setName

Syntax
public void setName( String name )
Parameters
name
The string that is to be this component's name.
Description
Sets the name of the component to the specified string.

See Also
getName


 Component.setSize

Component.setSize

Syntax 1
public void setSize( int width, int height )
Parameters
width
The new width of this component in pixels.
height
The new height of this component in pixels.
Description
Resizes this component so that it has width width and height.

See Also
getSize, setBounds

Syntax 2
public void setSize( Dimension d )
Parameters
d
The dimension specifying the new size of this component.
Description
Resizes this component so that it has width d.width and height d.height.

See Also
setSize, setBounds


 Component.setVisible

Component.setVisible

Syntax
public void setVisible( boolean b )
Parameters
b
If true, shows this component; otherwise, hides this component.
Description
Shows or hides this component depending on the value of parameter b.

See Also
isVisible


 Component.show

Component.show

Syntax 1
public void show()
Description
Note: show() is deprecated. As of JDK version 1.1, replaced by setVisible(boolean).

Syntax 2
public void show( boolean b )
Description
Note: show() is deprecated. As of JDK version 1.1, replaced by setVisible(boolean).


 Component.size

Component.size

Syntax
public Dimension size()
Description
Note: size() is deprecated. As of JDK version 1.1, replaced by getSize().


 Component.toString

Component.toString

Syntax
public String toString()
Returns
a string representation of this component.
Description
Returns a string representation of this component and its values.

Overrides
toString in class Object


 Component.transferFocus

Component.transferFocus

Syntax
public void transferFocus()
Description
Transfers the focus to the next component.

See Also
requestFocus, gotFocus


 Component.update

Component.update

Syntax
public void update( Graphics g )
Parameters
g
the specified context to use for updating.
Description
Updates this component.

The AWT calls the update method in response to a call to repaint. The appearance of the component on the screen has not changed since the last call to update or paint. You can assume that the background is not cleared.

The updatemethod of Component does the following:

  • Clears this component by filling it with the background color.
  • Sets the color of the graphics context to be the foreground color of this component.
  • Calls this component's paint method to completely redraw this component.

The origin of the graphics context, its (0, 0) coordinate point, is the top-left corner of this component. The clipping region of the graphics context is the bounding rectangle of this component.

See Also
paint, repaint


 Component.validate

Component.validate

Syntax
public void validate()
Description
Ensures that this component has a valid layout. This method is primarily intended to operate on instances of Container.

See Also
invalidate, doLayout, LayoutManager, validate


 Class Container

Class java.awt.Container

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container

public abstract class Container
extends Component

A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT components.

Components added to a container are tracked in a list. The order of the list will define the components' front-to-back stacking order within the container. If no index is specified when adding a component to a container, it will be added to the end of the list (and hence to the bottom of the stacking order).

See Also:
add, getComponent, LayoutManager


 Container Members

Container Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Container() | Constructs a new Container.

Methods
Name | Description
add(Component) | Adds the specified component to the end of this container.
add(Component, int) | Adds the specified component to this container at the given position.
add(Component, Object) | Adds the specified component to the end of this container.
add(Component, Object, int) | Adds the specified component to this container with the specified constraints at the specified index.
add(String, Component) | Adds the specified component to this container.
addContainerListener(ContainerListener) | Adds the specified container listener to receive container events from this container.
addImpl(Component, Object, int) | Adds the specified component to this container at the specified index.
addNotify() | Notifies the container to create a peer.
countComponents() | Deprecated.
deliverEvent(Event) | Deprecated.
doLayout() | Causes this container to lay out its components.
getAlignmentX() | Returns the alignment along the x axis.
getAlignmentY() | Returns the alignment along the y axis.
getComponent(int) | Gets the nth component in this container.
getComponentAt(int, int) | Locates the component that contains the x,y position.
getComponentAt(Point) | Gets the component that contains the specified point.
getComponentCount() | Gets the number of components in this panel.
getComponents() | Gets all the components in this container.
getInsets() | Determines the insets of this container, which indicate the size of the container's border.
getLayout() | Gets the layout manager for this container.
getMaximumSize() | Returns the maximum size of this container.
getMinimumSize() | Returns the minimum size of this container.
getPreferredSize() | Returns the preferred size of this container.
insets() | Deprecated.
invalidate() | Invalidates the container.
isAncestorOf(Component) | Checks if the component is contained in the component hierarchy of this container.
layout() | Deprecated.
list(PrintStream, int) | Prints a listing of this container to the specified output stream.
list(PrintWriter, int) | Prints out a list, starting at the specified indention, to the specified print writer.
locate(int, int) | Deprecated.
minimumSize() | Deprecated.
paint(Graphics) | Paints the container.
paintComponents(Graphics) | Paints each of the components in this container.
paramString() | Returns the parameter string representing the state of this container.
preferredSize() | Deprecated.
print(Graphics) | Prints the container.
printComponents(Graphics) | Prints each of the components in this container.
processContainerEvent(ContainerEvent) | Processes container events occurring on this container by dispatching them to any registered ContainerListener objects.
processEvent(AWTEvent) | Processes events on this container.
remove(Component) | Removes the specified component from this container.
remove(int) | Removes the component, specified by index, from this container.
removeAll() | Removes all the components from this container.
removeContainerListener(ContainerListener) | Removes the specified container listener so it no longer receives container events from this container.
removeNotify() | Notifies this container and all of its subcomponents to remove their peers.
setLayout(LayoutManager) | Sets the layout manager for this container.
validate() | Validates this container and all of its subcomponents.
validateTree() | Recursively descends the container tree and recomputes the layout for any subtrees marked as needing it (those marked as invalid).


 Container.Container

Container.Container

Syntax
protected Container()
Description
Constructs a new Container. Containers can be extended directly, but are lightweight in this case and must be contained by a parent somewhere higher up in the component tree that is native. (such as Frame for example).


 Container.add

Container.add

Syntax 1
public Component add( Component comp )
Parameters
comp
the component to be added.
Returns
the component argument.
Description
Adds the specified component to the end of this container.

Syntax 2
public Component add( String name, Component comp )
Description
Adds the specified component to this container. It is strongly advised to use the 1.1 method, add(Component, Object), in place of this method.

Syntax 3
public Component add( Component comp, int index )
Parameters
comp
the component to be added.
index
the position at which to insert the component, or -1 to insert the component at the end.
Returns
the component comp
Description
Adds the specified component to this container at the given position.

See Also
remove

Syntax 4
public void add( Component comp, Object constraints )
Parameters
comp
the component to be added
constraints
an object expressing layout contraints for this component
Description
Adds the specified component to the end of this container. Also notifies the layout manager to add the component to this container's layout using the specified constraints object.

See Also
LayoutManager

Syntax 5
public void add( Component comp, Object constraints, int index )
Parameters
comp
the component to be added
constraints
an object expressing layout contraints for this
index
the position in the container's list at which to insert the component. -1 means insert at the end. component
Description
Adds the specified component to this container with the specified constraints at the specified index. Also notifies the layout manager to add the component to the this container's layout using the specified constraints object.

See Also
remove, LayoutManager


 Container.addContainerListener

Container.addContainerListener

Syntax
public synchronized void addContainerListener( ContainerListener l )
Parameters
l
the container listener
Description
Adds the specified container listener to receive container events from this container.


 Container.addImpl

Container.addImpl

Syntax
protected void addImpl( Component comp, Object constraints, int index )
Parameters
comp
the component to be added.
constraints
an object expressing layout contraints for this component.
index
the position in the container's list at which to insert the component, where -1 means insert at the end.
Description
Adds the specified component to this container at the specified index. This method also notifies the layout manager to add the component to this container's layout using the specified constraints object.

This is the method to override if a program needs to track every add request to a container. An overriding method should usually include a call to the superclass's version of the method:

super.addImpl(comp, constraints, index)

See Also
add, add, add, LayoutManager


 Container.addNotify

Container.addNotify

Syntax
public void addNotify()
Description
Notifies the container to create a peer. It will also notify the components contained in this container. This method should be called by Container.add, and not by user code directly.

Overrides
addNotify in class Component
See Also
removeNotify


 Container.countComponents

Container.countComponents

Syntax
public int countComponents()
Description
Note: countComponents() is deprecated. As of JDK version 1.1, replaced by getComponentCount().


 Container.deliverEvent

Container.deliverEvent

Syntax
public void deliverEvent( Event e )
Description
Note: deliverEvent() is deprecated. As of JDK version 1.1, replaced by dispatchEvent(AWTEvent e)

Overrides
deliverEvent in class Component


 Container.doLayout

Container.doLayout

Syntax
public void doLayout()
Description
Causes this container to lay out its components. Most programs should not call this method directly, but should invoke the validate method instead.

Overrides
doLayout in class Component
See Also
layoutContainer, setLayout, validate


 Container.getAlignmentX

Container.getAlignmentX

Syntax
public float getAlignmentX()
Description
Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.

Overrides
getAlignmentX in class Component


 Container.getAlignmentY

Container.getAlignmentY

Syntax
public float getAlignmentY()
Description
Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.

Overrides
getAlignmentY in class Component


 Container.getComponent

Container.getComponent

Syntax
public Component getComponent( int n )
Parameters
n
the index of the component to get.
Returns
the nth component in this container.
Description
Gets the nth component in this container.

Exceptions
ArrayIndexOutOfBoundsException if the nth value does not exist.


 Container.getComponentAt

Container.getComponentAt

Syntax
public Component getComponentAt( int x, int y )
Parameters
x
the x coordinate
y
the y coordinate
Returns
null if the component does not contain the position. If there is no child component at the requested point and the point is within the bounds of the container the container itself is returned; otherwise the top-most child is returned.
Description
Locates the component that contains the x,y position. The top-most child component is returned in the case where there is overlap in the components. This is determined by finding the component closest to the index 0 that claims to contain the given point via Component.contains().

Overrides
getComponentAt in class Component
See Also
contains


 Container.getComponentAt

Container.getComponentAt

Syntax
public Component getComponentAt( Point p )
Parameters
p
the point.
Returns
returns the component that contains the point, or null if the component does not contain the point.
Description
Gets the component that contains the specified point.

Overrides
getComponentAt in class Component
See Also
contains


 Container.getComponentCount

Container.getComponentCount

Syntax
public int getComponentCount()
Returns
the number of components in this panel.
Description
Gets the number of components in this panel.

See Also
getComponent


 Container.getComponents

Container.getComponents

Syntax
public Component[] getComponents()
Returns
an array of all the components in this container.
Description
Gets all the components in this container.


 Container.getInsets

Container.getInsets

Syntax
public Insets getInsets()
Returns
the insets of this container.
Description
Determines the insets of this container, which indicate the size of the container's border.

A Frame object, for example, has a top inset that corresponds to the height of the frame's title bar.

See Also
Insets, LayoutManager


 Container.getLayout

Container.getLayout

Syntax
public LayoutManager getLayout()
Description
Gets the layout manager for this container.

See Also
doLayout, setLayout


 Container.getMaximumSize

Container.getMaximumSize

Syntax
public Dimension getMaximumSize()
Description
Returns the maximum size of this container.

Overrides
getMaximumSize in class Component
See Also
getPreferredSize


 Container.getMinimumSize

Container.getMinimumSize

Syntax
public Dimension getMinimumSize()
Returns
an instance of Dimension that represents the minimum size of this container.
Description
Returns the minimum size of this container.

Overrides
getMinimumSize in class Component
See Also
getPreferredSize, getLayout, minimumLayoutSize, getMinimumSize


 Container.getPreferredSize

Container.getPreferredSize

Syntax
public Dimension getPreferredSize()
Returns
an instance of Dimension that represents the preferred size of this container.
Description
Returns the preferred size of this container.

Overrides
getPreferredSize in class Component
See Also
getMinimumSize, getLayout, preferredLayoutSize, getPreferredSize


 Container.insets

Container.insets

Syntax
public Insets insets()
Description
Note: insets() is deprecated. As of JDK version 1.1, replaced by getInsets().


 Container.invalidate

Container.invalidate

Syntax
public void invalidate()
Description
Invalidates the container. The container and all parents above it are marked as needing to be laid out. This method can be called often, so it needs to execute quickly.

Overrides
invalidate in class Component
See Also
validate, layout, LayoutManager


 Container.isAncestorOf

Container.isAncestorOf

Syntax
public boolean isAncestorOf( Component c )
Parameters
c
the component
Returns
true if it is an ancestor; true otherwise.
Description
Checks if the component is contained in the component hierarchy of this container.


 Container.layout

Container.layout

Syntax
public void layout()
Description
Note: layout() is deprecated. As of JDK version 1.1, replaced by doLayout().

Overrides
layout in class Component


 Container.list

Container.list

Syntax 1
public void list( PrintStream out, int indent )
Parameters
out
a print stream.
indent
the number of spaces to indent.
Description
Prints a listing of this container to the specified output stream. The listing starts at the specified indentation.

Overrides
list in class Component
See Also
list

Syntax 2
public void list( PrintWriter out, int indent )
Description
Prints out a list, starting at the specified indention, to the specified print writer.

Overrides
list in class Component


 Container.locate

Container.locate

Syntax
public Component locate( int x, int y )
Description
Note: locate() is deprecated. As of JDK version 1.1, replaced by getComponentAt(int, int).

Overrides
locate in class Component


 Container.minimumSize

Container.minimumSize

Syntax
public Dimension minimumSize()
Description
Note: minimumSize() is deprecated. As of JDK version 1.1, replaced by getMinimumSize().

Overrides
minimumSize in class Component


 Container.paint

Container.paint

Syntax
public void paint( Graphics g )
Parameters
g
the specified Graphics window
Description
Paints the container. This forwards the paint to any lightweight components that are children of this container. If this method is reimplemented, super.paint(g) should be called so that lightweight components are properly rendered. If a child component is entirely clipped by the current clipping setting in g, paint() will not be forwarded to that child.

Overrides
paint in class Component
See Also
update


 Container.paintComponents

Container.paintComponents

Syntax
public void paintComponents( Graphics g )
Parameters
g
the graphics context.
Description
Paints each of the components in this container.

See Also
paint, paintAll


 Container.paramString

Container.paramString

Syntax
protected String paramString()
Returns
the parameter string of this container.
Description
Returns the parameter string representing the state of this container. This string is useful for debugging.

Overrides
paramString in class Component


 Container.preferredSize

Container.preferredSize

Syntax
public Dimension preferredSize()
Description
Note: preferredSize() is deprecated. As of JDK version 1.1, replaced by getPreferredSize().

Overrides
preferredSize in class Component


 Container.print

Container.print

Syntax
public void print( Graphics g )
Parameters
g
the specified Graphics window
Description
Prints the container. This forwards the print to any lightweight components that are children of this container. If this method is reimplemented, super.print(g) should be called so that lightweight components are properly rendered. If a child component is entirely clipped by the current clipping setting in g, print() will not be forwarded to that child.

Overrides
print in class Component
See Also
update


 Container.printComponents

Container.printComponents

Syntax
public void printComponents( Graphics g )
Parameters
g
the graphics context.
Description
Prints each of the components in this container.

See Also
print, printAll


 Container.processContainerEvent

Container.processContainerEvent

Syntax
protected void processContainerEvent( ContainerEvent e )
Parameters
e
the container event
Description
Processes container events occurring on this container by dispatching them to any registered ContainerListener objects. NOTE: This method will not be called unless container events are enabled for this component; this happens when one of the following occurs: a) A ContainerListener object is registered via addContainerListener() b) Container events are enabled via enableEvents()

See Also
enableEvents


 Container.processEvent

Container.processEvent

Syntax
protected void processEvent( AWTEvent e )
Parameters
e
the event
Description
Processes events on this container. If the event is a ContainerEvent, it invokes the processContainerEvent method, else it invokes its superclass's processEvent.

Overrides
processEvent in class Component


 Container.remove

Container.remove

Syntax 1
public void remove( int index )
Parameters
index
the index of the component to be removed.
Description
Removes the component, specified by index, from this container.

See Also
add

Syntax 2
public void remove( Component comp )
Parameters
comp
the component to be removed
Description
Removes the specified component from this container.

See Also
add


 Container.removeAll

Container.removeAll

Syntax
public void removeAll()
Description
Removes all the components from this container.

See Also
add, remove


 Container.removeContainerListener

Container.removeContainerListener

Syntax
public void removeContainerListener( ContainerListener l )
Parameters
l
the container listener
Description
Removes the specified container listener so it no longer receives container events from this container.


 Container.removeNotify

Container.removeNotify

Syntax
public void removeNotify()
Description
Notifies this container and all of its subcomponents to remove their peers. This method should be invoked by the container's remove method, and not directly by user code.

Overrides
removeNotify in class Component
See Also
remove, remove


 Container.setLayout

Container.setLayout

Syntax
public void setLayout( LayoutManager mgr )
Parameters
mgr
the specified layout manager
Description
Sets the layout manager for this container.

See Also
doLayout, getLayout


 Container.validate

Container.validate

Syntax
public void validate()
Description
Validates this container and all of its subcomponents.

AWT uses validate to cause a container to lay out its subcomponents again after the components it contains have been added to or modified.

Overrides
validate in class Component
See Also
validate, invalidate


 Container.validateTree

Container.validateTree

Syntax
protected void validateTree()
Description
Recursively descends the container tree and recomputes the layout for any subtrees marked as needing it (those marked as invalid). Synchronization should be provided by the method that calls this one: validate.


 Class Cursor

Class java.awt.Cursor

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Cursor

public class Cursor
extends Object
implements Serializable

A class to encapsulate the bitmap representation of the mouse cursor.

See Also:
setCursor


 Cursor Members

Cursor Members

Class Overview | This Package | All Packages

Fields
Name | Description
CROSSHAIR_CURSOR | The crosshair cursor type.
DEFAULT_CURSOR | The default cursor type (gets set if no cursor is defined).
E_RESIZE_CURSOR | The east-resize cursor type.
HAND_CURSOR | The hand cursor type.
MOVE_CURSOR | The move cursor type.
N_RESIZE_CURSOR | The north-resize cursor type.
NE_RESIZE_CURSOR | The north-east-resize cursor type.
NW_RESIZE_CURSOR | The north-west-resize cursor type.
predefined |
S_RESIZE_CURSOR | The south-resize cursor type.
SE_RESIZE_CURSOR | The south-east-resize cursor type.
SW_RESIZE_CURSOR | The south-west-resize cursor type.
TEXT_CURSOR | The text cursor type.
W_RESIZE_CURSOR | The west-resize cursor type.
WAIT_CURSOR | The wait cursor type.

Constructors
Name | Description
Cursor(int) | Creates a new cursor object with the specified type.

Methods
Name | Description
getDefaultCursor() | Return the system default cursor.
getPredefinedCursor(int) | Returns a cursor object with the specified predefined type.
getType() | Returns the type for this cursor.


 Cursor.CROSSHAIR_CURSOR

Cursor.CROSSHAIR_CURSOR

Syntax
public static final int CROSSHAIR_CURSOR
Description
The crosshair cursor type.


 Cursor.DEFAULT_CURSOR

Cursor.DEFAULT_CURSOR

Syntax
public static final int DEFAULT_CURSOR
Description
The default cursor type (gets set if no cursor is defined).


 Cursor.E_RESIZE_CURSOR

Cursor.E_RESIZE_CURSOR

Syntax
public static final int E_RESIZE_CURSOR
Description
The east-resize cursor type.


 Cursor.HAND_CURSOR

Cursor.HAND_CURSOR

Syntax
public static final int HAND_CURSOR
Description
The hand cursor type.


 Cursor.MOVE_CURSOR

Cursor.MOVE_CURSOR

Syntax
public static final int MOVE_CURSOR
Description
The move cursor type.


 Cursor.N_RESIZE_CURSOR

Cursor.N_RESIZE_CURSOR

Syntax
public static final int N_RESIZE_CURSOR
Description
The north-resize cursor type.


 Cursor.NE_RESIZE_CURSOR

Cursor.NE_RESIZE_CURSOR

Syntax
public static final int NE_RESIZE_CURSOR
Description
The north-east-resize cursor type.


 Cursor.NW_RESIZE_CURSOR

Cursor.NW_RESIZE_CURSOR

Syntax
public static final int NW_RESIZE_CURSOR
Description
The north-west-resize cursor type.


 Cursor.predefined

Cursor.predefined

Syntax
protected static Cursor predefined[]


 Cursor.S_RESIZE_CURSOR

Cursor.S_RESIZE_CURSOR

Syntax
public static final int S_RESIZE_CURSOR
Description
The south-resize cursor type.


 Cursor.SE_RESIZE_CURSOR

Cursor.SE_RESIZE_CURSOR

Syntax
public static final int SE_RESIZE_CURSOR
Description
The south-east-resize cursor type.


 Cursor.SW_RESIZE_CURSOR

Cursor.SW_RESIZE_CURSOR

Syntax
public static final int SW_RESIZE_CURSOR
Description
The south-west-resize cursor type.


 Cursor.TEXT_CURSOR

Cursor.TEXT_CURSOR

Syntax
public static final int TEXT_CURSOR
Description
The text cursor type.


 Cursor.W_RESIZE_CURSOR

Cursor.W_RESIZE_CURSOR

Syntax
public static final int W_RESIZE_CURSOR
Description
The west-resize cursor type.


 Cursor.WAIT_CURSOR

Cursor.WAIT_CURSOR

Syntax
public static final int WAIT_CURSOR
Description
The wait cursor type.


 Cursor.Cursor

Cursor.Cursor

Syntax
public Cursor( int type )
Parameters
type
the type of cursor
Description
Creates a new cursor object with the specified type.


 Cursor.getDefaultCursor

Cursor.getDefaultCursor

Syntax
public static Cursor getDefaultCursor()
Description
Return the system default cursor.


 Cursor.getPredefinedCursor

Cursor.getPredefinedCursor

Syntax
public static Cursor getPredefinedCursor( int type )
Parameters
type
the type of predefined cursor
Description
Returns a cursor object with the specified predefined type.


 Cursor.getType

Cursor.getType

Syntax
public int getType()
Description
Returns the type for this cursor.


 Class Dialog

Class java.awt.Dialog

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Window
                           |
                           +----java.awt.Dialog

public class Dialog
extends Window

A class that produces a dialog - a window that takes input from the user. The default layout for a dialog is BorderLayout.

Dialogs are capable of generating the following window events: WindowOpened, WindowClosing, WindowClosed, WindowActivated, WindowDeactivated.

See Also:
WindowEvent, addWindowListener


 Dialog Members

Dialog Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Dialog(Frame) | Constructs an initially invisible Dialog with an empty title.
Dialog(Frame, boolean) | Constructs an initially invisible Dialog with an empty title.
Dialog(Frame, String) | Constructs an initially invisible Dialog with a title.
Dialog(Frame, String, boolean) | Constructs an initially invisible Dialog with a title.

Methods
Name | Description
addNotify() | Creates the dialog's peer.
getTitle() | Gets the title of the dialog.
isModal() | Indicates whether the dialog is modal.
isResizable() | Indicates whether this dialog window is resizable.
paramString() | Returns the parameter string representing the state of this dialog window.
setModal(boolean) | Specifies whether this dialog is modal.
setResizable(boolean) | Sets the resizable flag.
setTitle(String) | Sets the title of the Dialog.
show() | Shows the dialog.


 Dialog.Dialog

Dialog.Dialog

Syntax 1
public Dialog( Frame parent )
Parameters
parent
the owner of the dialog
Description
Constructs an initially invisible Dialog with an empty title.

See Also
setSize, setVisible

Syntax 2
public Dialog( Frame parent, boolean modal )
Parameters
parent
the owner of the dialog
modal
if true, dialog blocks input to the parent window when shown
Description
Constructs an initially invisible Dialog with an empty title. A modal Dialog grabs all the input to the parent frame from the user.

Syntax 3
public Dialog( Frame parent, String title )
Parameters
parent
the owner of the dialog
title
the title of the dialog
Description
Constructs an initially invisible Dialog with a title.

See Also
setSize, setVisible

Syntax 4
public Dialog( Frame parent, String title, boolean modal )
Parameters
parent
the owner of the dialog
title
the title of the dialog
modal
if true, dialog blocks input to the parent window when shown
Description
Constructs an initially invisible Dialog with a title. A modal Dialog grabs all the input to the parent frame from the user.

See Also
setSize, setVisible


 Dialog.addNotify

Dialog.addNotify

Syntax
public void addNotify()
Description
Creates the dialog's peer. The peer allows us to change the appearance of the frame without changing its functionality.

Overrides
addNotify in class Window


 Dialog.getTitle

Dialog.getTitle

Syntax
public String getTitle()
Returns
the title of this dialog window.
Description
Gets the title of the dialog.

See Also
setTitle


 Dialog.isModal

Dialog.isModal

Syntax
public boolean isModal()
Returns
true if this dialog window is modal; false otherwise.
Description
Indicates whether the dialog is modal. A modal dialog grabs all input from the user.

See Also
setModal


 Dialog.isResizable

Dialog.isResizable

Syntax
public boolean isResizable()
Returns
true if the user can resize the dialog; false otherwise.
Description
Indicates whether this dialog window is resizable.

See Also
setResizable


 Dialog.paramString

Dialog.paramString

Syntax
protected String paramString()
Returns
the parameter string of this dialog window.
Description
Returns the parameter string representing the state of this dialog window. This string is useful for debugging.

Overrides
paramString in class Container


 Dialog.setModal

Dialog.setModal

Syntax
public void setModal( boolean b )
Description
Specifies whether this dialog is modal. A modal Dialog grabs all the input to the parent frame from the user.

See Also
isModal


 Dialog.setResizable

Dialog.setResizable

Syntax
public synchronized void setResizable( boolean resizable )
Parameters
resizable
true if the user can resize this dialog; false otherwise.
Description
Sets the resizable flag.

See Also
isResizable


 Dialog.setTitle

Dialog.setTitle

Syntax
public synchronized void setTitle( String title )
Parameters
title
the new title being given to the dialog
Description
Sets the title of the Dialog.

See Also
getTitle


 Dialog.show

Dialog.show

Syntax
public void show()
Description
Shows the dialog. This will bring the dialog to the front if the dialog is already visible. If the dialog is modal, this call will block input to the parent window until the dialog is taken down by calling hide or dispose. It is permissible to show modal dialogs from the event dispatching thread because the toolkit will ensure that another dispatching thread will run while the one which invoked show is blocked.

Overrides
show in class Window
See Also
hide


 Class Dimension

Class java.awt.Dimension

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Dimension

public class Dimension
extends Object
implements Serializable

The Dimension class encapsulates the width and height of a component in a single object. The class is associated with certain properties of components. Several methods defined by the Component class and the LayoutManager interface return a Dimension object.

Normally the values of width and height are non-negative integers. The constructors that allow you to create a dimension do not prevent you from setting a negative value for these properties. If the value of width or height is negative, the behavior of some methods defined by other objects is undefined.

See Also:
Component, LayoutManager


 Dimension Members

Dimension Members

Class Overview | This Package | All Packages

Fields
Name | Description
height | The height dimension.
width | The width dimension.

Constructors
Name | Description
Dimension() | Creates an instance of Dimension with a width of zero and a height of zero.
Dimension(Dimension) | Creates an instance of Dimension whose width and height are the same as for the specified dimension.
Dimension(int, int) | Constructs a Dimension and initializes it to the specified width and specified height.

Methods
Name | Description
equals(Object) | Checks whether two dimension objects have equal values.
getSize() | Gets the size of this Dimension object.
setSize(Dimension) | Set the size of this Dimension object to the specified size.
setSize(int, int) | Set the size of this Dimension object to the specified width and height.
toString() | Returns a string that represents this Dimension object's values.


 Dimension.height

Dimension.height

Syntax
public int height
Description
The height dimension.


 Dimension.width

Dimension.width

Syntax
public int width
Description
The width dimension.


 Dimension.Dimension

Dimension.Dimension

Syntax 1
public Dimension()
Description
Creates an instance of Dimension with a width of zero and a height of zero.

Syntax 2
public Dimension( Dimension d )
Parameters
d
the specified dimension for the width and height values.
Description
Creates an instance of Dimension whose width and height are the same as for the specified dimension.

Syntax 3
public Dimension( int width, int height )
Parameters
width
the specified width dimension
height
the specified height dimension
Description
Constructs a Dimension and initializes it to the specified width and specified height.


 Dimension.equals

Dimension.equals

Syntax
public boolean equals( Object obj )
Description
Checks whether two dimension objects have equal values.

Overrides
equals in class Object


 Dimension.getSize

Dimension.getSize

Syntax
public Dimension getSize()
Returns
the size of this dimension, a new instance of Dimension with the same width and height.
Description
Gets the size of this Dimension object. This method is included for completeness, to parallel the getSize method defined by Component.

See Also
setSize, getSize


 Dimension.setSize

Dimension.setSize

Syntax 1
public void setSize( Dimension d )
Parameters
d
the new size for this Dimension object.
Description
Set the size of this Dimension object to the specified size. This method is included for completeness, to parallel the setSize method defined by Component.

See Also
getSize, setSize

Syntax 2
public void setSize( int width, int height )
Parameters
width
the new width for this Dimension object.
height
the new height for this Dimension object.
Description
Set the size of this Dimension object to the specified width and height. This method is included for completeness, to parallel the setSize method defined by Component.

See Also
getSize, setSize


 Dimension.toString

Dimension.toString

Syntax
public String toString()
Returns
a string representation of this dimension, including the values of width and height.
Description
Returns a string that represents this Dimension object's values.

Overrides
toString in class Object


 Class Event

Class java.awt.Event

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Event

public class Event
extends Object
implements Serializable

Event is a platform-independent class that encapsulates events from the platform's Graphical User Interface in the Java 1.0 event model. In Java 1.1 and later versions, the Event class is maintained only for backwards compatibilty. The information in this class description is provided to assist programmers in converting Java 1.0 programs to the new event model.

In the Java 1.0 event model, an event contains an id field that indicates what type of event it is and which other Event variables are relevant for the event.

For keyboard events, key contains a value indicating which key was activated, and modifiers contains the modifiers for that event. For the KEY_PRESS and KEY_RELEASE event ids, the value of key is the unicode character code for the key. For KEY_ACTION and KEY_ACTION_RELEASE, the value of key is one of the defined action-key identifiers in the Event class (PGUP, PGDN, F1, F2, etc).


 Event Members

Event Members

Class Overview | This Package | All Packages

Fields
Name | Description
ACTION_EVENT | This event indicates that the user wants some action to occur.
ALT_MASK | This flag indicates that the Alt key was down when the event occurred.
arg | An arbitrary argument of the event.
BACK_SPACE | The BackSpace key.
CAPS_LOCK | The Caps Lock key, a non-ASCII action key.
clickCount | For MOUSE_DOWN events, this field indicates the number of consecutive clicks.
CTRL_MASK | This flag indicates that the Control key was down when the event occurred.
DELETE | The Delete key.
DOWN | The Down Arrow key, a non-ASCII action key.
END | The End key, a non-ASCII action key.
ENTER | The Enter key.
ESCAPE | The Escape key.
evt | The next event.
F1 | The F1 function key, a non-ASCII action key.
F10 | The F10 function key, a non-ASCII action key.
F11 | The F11 function key, a non-ASCII action key.
F12 | The F12 function key, a non-ASCII action key.
F2 | The F2 function key, a non-ASCII action key.
F3 | The F3 function key, a non-ASCII action key.
F4 | The F4 function key, a non-ASCII action key.
F5 | The F5 function key, a non-ASCII action key.
F6 | The F6 function key, a non-ASCII action key.
F7 | The F7 function key, a non-ASCII action key.
F8 | The F8 function key, a non-ASCII action key.
F9 | The F9 function key, a non-ASCII action key.
GOT_FOCUS | A component gained the focus.
HOME | The Home key, a non-ASCII action key.
id | Indicates which type of event the event is, and which other Event variables are relevant for the event.
INSERT | The Insert key, a non-ASCII action key.
key | The key code of the key that was pressed in a keyboard event.
KEY_ACTION | The user has pressed a non-ASCII action key.
KEY_ACTION_RELEASE | The user has released a non-ASCII action key.
KEY_PRESS | The user has pressed a normal key.
KEY_RELEASE | The user has released a normal key.
LEFT | The Left Arrow key, a non-ASCII action key.
LIST_DESELECT | An item in a list has been deselected.
LIST_SELECT | An item in a list has been selected.
LOAD_FILE | A file loading event.
LOST_FOCUS | A component lost the focus.
META_MASK | This flag indicates that the Meta key was down when the event occurred.
modifiers | The state of the modifier keys.
MOUSE_DOWN | The user has pressed the mouse button.
MOUSE_DRAG | The user has moved the mouse with a button pressed.
MOUSE_ENTER | The mouse has entered a component.
MOUSE_EXIT | The mouse has exited a component.
MOUSE_MOVE | The mouse has moved with no button pressed.
MOUSE_UP | The user has released the mouse button.
NUM_LOCK | The Num Lock key, a non-ASCII action key.
PAUSE | The Pause key, a non-ASCII action key.
PGDN | The Page Down key, a non-ASCII action key.
PGUP | The Page Up key, a non-ASCII action key.
PRINT_SCREEN | The Print Screen key, a non-ASCII action key.
RIGHT | The Right Arrow key, a non-ASCII action key.
SAVE_FILE | A file saving event.
SCROLL_ABSOLUTE | The user has moved the bubble (thumb) in a scroll bar, moving to an "absolute" position, rather than to an offset from the last postion.
SCROLL_BEGIN | The scroll begin event.
SCROLL_END | The scroll end event.
SCROLL_LINE_DOWN | The user has activated the line down area of a scroll bar.
SCROLL_LINE_UP | The user has activated the line up area of a scroll bar.
SCROLL_LOCK | The Scroll Lock key, a non-ASCII action key.
SCROLL_PAGE_DOWN | The user has activated the page down area of a scroll bar.
SCROLL_PAGE_UP | The user has activated the page up area of a scroll bar.
SHIFT_MASK | This flag indicates that the Shift key was down when the event occurred.
TAB | The Tab key.
target | The target component.
UP | The Up Arrow key, a non-ASCII action key.
when | The time stamp.
WINDOW_DEICONIFY | The user has asked the window manager to de-iconify the window.
WINDOW_DESTROY | The user has asked the window manager to kill the window.
WINDOW_EXPOSE | The user has asked the window manager to expose the window.
WINDOW_ICONIFY | The user has asked the window manager to iconify the window.
WINDOW_MOVED | The user has asked the window manager to move the window.
x | The x coordinate of the event.
y | The y coordinate of the event.

Constructors
Name | Description
Event(Object, int, Object) | Creates an instance of Event with the specified target component, event type, and argument.
Event(Object, long, int, int, int, int, int) | Creates an instance of Event, with the specified target component, time stamp, event type, x and y coordinates, keyboard key, state of the modifier keys, and an argument set to null.
Event(Object, long, int, int, int, int, int, Object) | Creates an instance of Event with the specified target component, time stamp, event type, x and y coordinates, keyboard key, state of the modifier keys, and argument.

Methods
Name | Description
controlDown() | Checks if the Control key is down.
metaDown() | Checks if the Meta key is down.
paramString() | Returns the parameter string representing this event.
shiftDown() | Checks if the Shift key is down.
toString() | Returns a representation of this event's values as a string.
translate(int, int) | Translates this event so that its x and y coordinates are increased by dx and dy, respectively.


 Event.ACTION_EVENT

Event.ACTION_EVENT

Syntax
public static final int ACTION_EVENT
Description
This event indicates that the user wants some action to occur.


 Event.ALT_MASK

Event.ALT_MASK

Syntax
public static final int ALT_MASK
Description
This flag indicates that the Alt key was down when the event occurred. For mouse events, this flag indicates that the middle mouse button was pressed or released.


 Event.arg

Event.arg

Syntax
public Object arg
Description
An arbitrary argument of the event. The value of this field depends on the type of event.


 Event.BACK_SPACE

Event.BACK_SPACE

Syntax
public static final int BACK_SPACE
Description
The BackSpace key.


 Event.CAPS_LOCK

Event.CAPS_LOCK

Syntax
public static final int CAPS_LOCK
Description
The Caps Lock key, a non-ASCII action key.


 Event.clickCount

Event.clickCount

Syntax
public int clickCount
Description
For MOUSE_DOWN events, this field indicates the number of consecutive clicks. For other events, its value is 0.


 Event.CTRL_MASK

Event.CTRL_MASK

Syntax
public static final int CTRL_MASK
Description
This flag indicates that the Control key was down when the event occurred.


 Event.DELETE

Event.DELETE

Syntax
public static final int DELETE
Description
The Delete key.


 Event.DOWN

Event.DOWN

Syntax
public static final int DOWN
Description
The Down Arrow key, a non-ASCII action key.


 Event.END

Event.END

Syntax
public static final int END
Description
The End key, a non-ASCII action key.


 Event.ENTER

Event.ENTER

Syntax
public static final int ENTER
Description
The Enter key.


 Event.ESCAPE

Event.ESCAPE

Syntax
public static final int ESCAPE
Description
The Escape key.


 Event.evt

Event.evt

Syntax
public Event evt
Description
The next event. This field is set when putting events into a linked list.


 Event.F1

Event.F1

Syntax
public static final int F1
Description
The F1 function key, a non-ASCII action key.


 Event.F10

Event.F10

Syntax
public static final int F10
Description
The F10 function key, a non-ASCII action key.


 Event.F11

Event.F11

Syntax
public static final int F11
Description
The F11 function key, a non-ASCII action key.


 Event.F12

Event.F12

Syntax
public static final int F12
Description
The F12 function key, a non-ASCII action key.


 Event.F2

Event.F2

Syntax
public static final int F2
Description
The F2 function key, a non-ASCII action key.


 Event.F3

Event.F3

Syntax
public static final int F3
Description
The F3 function key, a non-ASCII action key.


 Event.F4

Event.F4

Syntax
public static final int F4
Description
The F4 function key, a non-ASCII action key.


 Event.F5

Event.F5

Syntax
public static final int F5
Description
The F5 function key, a non-ASCII action key.


 Event.F6

Event.F6

Syntax
public static final int F6
Description
The F6 function key, a non-ASCII action key.


 Event.F7

Event.F7

Syntax
public static final int F7
Description
The F7 function key, a non-ASCII action key.


 Event.F8

Event.F8

Syntax
public static final int F8
Description
The F8 function key, a non-ASCII action key.


 Event.F9

Event.F9

Syntax
public static final int F9
Description
The F9 function key, a non-ASCII action key.


 Event.GOT_FOCUS

Event.GOT_FOCUS

Syntax
public static final int GOT_FOCUS
Description
A component gained the focus.


 Event.HOME

Event.HOME

Syntax
public static final int HOME
Description
The Home key, a non-ASCII action key.


 Event.id

Event.id

Syntax
public int id
Description
Indicates which type of event the event is, and which other Event variables are relevant for the event.


 Event.INSERT

Event.INSERT

Syntax
public static final int INSERT
Description
The Insert key, a non-ASCII action key.


 Event.key

Event.key

Syntax
public int key
Description
The key code of the key that was pressed in a keyboard event.


 Event.KEY_ACTION

Event.KEY_ACTION

Syntax
public static final int KEY_ACTION
Description
The user has pressed a non-ASCII action key. The key field contains a value that indicates that the event occurred on one of the action keys, which comprise the 12 function keys, the arrow (cursor) keys, Page Up, Page Down, Home, End, Print Screen, Scroll Lock, Caps Lock, Num Lock, Pause, and Insert.


 Event.KEY_ACTION_RELEASE

Event.KEY_ACTION_RELEASE

Syntax
public static final int KEY_ACTION_RELEASE
Description
The user has released a non-ASCII action key. The key field contains a value that indicates that the event occurred on one of the action keys, which comprise the 12 function keys, the arrow (cursor) keys, Page Up, Page Down, Home, End, Print Screen, Scroll Lock, Caps Lock, Num Lock, Pause, and Insert.


 Event.KEY_PRESS

Event.KEY_PRESS

Syntax
public static final int KEY_PRESS
Description
The user has pressed a normal key.


 Event.KEY_RELEASE

Event.KEY_RELEASE

Syntax
public static final int KEY_RELEASE
Description
The user has released a normal key.


 Event.LEFT

Event.LEFT

Syntax
public static final int LEFT
Description
The Left Arrow key, a non-ASCII action key.


 Event.LIST_DESELECT

Event.LIST_DESELECT

Syntax
public static final int LIST_DESELECT
Description
An item in a list has been deselected.


 Event.LIST_SELECT

Event.LIST_SELECT

Syntax
public static final int LIST_SELECT
Description
An item in a list has been selected.


 Event.LOAD_FILE

Event.LOAD_FILE

Syntax
public static final int LOAD_FILE
Description
A file loading event.


 Event.LOST_FOCUS

Event.LOST_FOCUS

Syntax
public static final int LOST_FOCUS
Description
A component lost the focus.


 Event.META_MASK

Event.META_MASK

Syntax
public static final int META_MASK
Description
This flag indicates that the Meta key was down when the event occurred. For mouse events, this flag indicates that the right button was pressed or released.


 Event.modifiers

Event.modifiers

Syntax
public int modifiers
Description
The state of the modifier keys.


 Event.MOUSE_DOWN

Event.MOUSE_DOWN

Syntax
public static final int MOUSE_DOWN
Description
The user has pressed the mouse button. The ALT_MASK flag indicates that the middle button has been pressed. The META_MASKflag indicates that the right button has been pressed.

See Also
ALT_MASK, META_MASK


 Event.MOUSE_DRAG

Event.MOUSE_DRAG

Syntax
public static final int MOUSE_DRAG
Description
The user has moved the mouse with a button pressed. The ALT_MASK flag indicates that the middle button is being pressed. The META_MASK flag indicates that the right button is being pressed.

See Also
ALT_MASK, META_MASK


 Event.MOUSE_ENTER

Event.MOUSE_ENTER

Syntax
public static final int MOUSE_ENTER
Description
The mouse has entered a component.


 Event.MOUSE_EXIT

Event.MOUSE_EXIT

Syntax
public static final int MOUSE_EXIT
Description
The mouse has exited a component.


 Event.MOUSE_MOVE

Event.MOUSE_MOVE

Syntax
public static final int MOUSE_MOVE
Description
The mouse has moved with no button pressed.


 Event.MOUSE_UP

Event.MOUSE_UP

Syntax
public static final int MOUSE_UP
Description
The user has released the mouse button. The ALT_MASK flag indicates that the middle button has been released. The META_MASKflag indicates that the right button has been released.

See Also
ALT_MASK, META_MASK


 Event.NUM_LOCK

Event.NUM_LOCK

Syntax
public static final int NUM_LOCK
Description
The Num Lock key, a non-ASCII action key.


 Event.PAUSE

Event.PAUSE

Syntax
public static final int PAUSE
Description
The Pause key, a non-ASCII action key.


 Event.PGDN

Event.PGDN

Syntax
public static final int PGDN
Description
The Page Down key, a non-ASCII action key.


 Event.PGUP

Event.PGUP

Syntax
public static final int PGUP
Description
The Page Up key, a non-ASCII action key.


 Event.PRINT_SCREEN

Event.PRINT_SCREEN

Syntax
public static final int PRINT_SCREEN
Description
The Print Screen key, a non-ASCII action key.


 Event.RIGHT

Event.RIGHT

Syntax
public static final int RIGHT
Description
The Right Arrow key, a non-ASCII action key.


 Event.SAVE_FILE

Event.SAVE_FILE

Syntax
public static final int SAVE_FILE
Description
A file saving event.


 Event.SCROLL_ABSOLUTE

Event.SCROLL_ABSOLUTE

Syntax
public static final int SCROLL_ABSOLUTE
Description
The user has moved the bubble (thumb) in a scroll bar, moving to an "absolute" position, rather than to an offset from the last postion.


 Event.SCROLL_BEGIN

Event.SCROLL_BEGIN

Syntax
public static final int SCROLL_BEGIN
Description
The scroll begin event.


 Event.SCROLL_END

Event.SCROLL_END

Syntax
public static final int SCROLL_END
Description
The scroll end event.


 Event.SCROLL_LINE_DOWN

Event.SCROLL_LINE_DOWN

Syntax
public static final int SCROLL_LINE_DOWN
Description
The user has activated the line down area of a scroll bar.


 Event.SCROLL_LINE_UP

Event.SCROLL_LINE_UP

Syntax
public static final int SCROLL_LINE_UP
Description
The user has activated the line up area of a scroll bar.


 Event.SCROLL_LOCK

Event.SCROLL_LOCK

Syntax
public static final int SCROLL_LOCK
Description
The Scroll Lock key, a non-ASCII action key.


 Event.SCROLL_PAGE_DOWN

Event.SCROLL_PAGE_DOWN

Syntax
public static final int SCROLL_PAGE_DOWN
Description
The user has activated the page down area of a scroll bar.


 Event.SCROLL_PAGE_UP

Event.SCROLL_PAGE_UP

Syntax
public static final int SCROLL_PAGE_UP
Description
The user has activated the page up area of a scroll bar.


 Event.SHIFT_MASK

Event.SHIFT_MASK

Syntax
public static final int SHIFT_MASK
Description
This flag indicates that the Shift key was down when the event occurred.


 Event.TAB

Event.TAB

Syntax
public static final int TAB
Description
The Tab key.


 Event.target

Event.target

Syntax
public Object target
Description
The target component. This indicates the component over which the event occurred or with which the event is associated.


 Event.UP

Event.UP

Syntax
public static final int UP
Description
The Up Arrow key, a non-ASCII action key.


 Event.when

Event.when

Syntax
public long when
Description
The time stamp.


 Event.WINDOW_DEICONIFY

Event.WINDOW_DEICONIFY

Syntax
public static final int WINDOW_DEICONIFY
Description
The user has asked the window manager to de-iconify the window.


 Event.WINDOW_DESTROY

Event.WINDOW_DESTROY

Syntax
public static final int WINDOW_DESTROY
Description
The user has asked the window manager to kill the window.


 Event.WINDOW_EXPOSE

Event.WINDOW_EXPOSE

Syntax
public static final int WINDOW_EXPOSE
Description
The user has asked the window manager to expose the window.


 Event.WINDOW_ICONIFY

Event.WINDOW_ICONIFY

Syntax
public static final int WINDOW_ICONIFY
Description
The user has asked the window manager to iconify the window.


 Event.WINDOW_MOVED

Event.WINDOW_MOVED

Syntax
public static final int WINDOW_MOVED
Description
The user has asked the window manager to move the window.


 Event.x

Event.x

Syntax
public int x
Description
The x coordinate of the event.


 Event.y

Event.y

Syntax
public int y
Description
The y coordinate of the event.


 Event.Event

Event.Event

Syntax 1
public Event( Object target, long when, int id, int x, int y, int key, int modifiers, Object arg )
Parameters
target
the target component.
when
the time stamp.
id
the event type.
x
the x coordinate.
y
the y coordinate.
key
the key pressed in a keyboard event.
modifiers
the state of the modifier keys.
arg
the specified argument.
Description
Creates an instance of Event with the specified target component, time stamp, event type, x and y coordinates, keyboard key, state of the modifier keys, and argument.

Syntax 2
public Event( Object target, long when, int id, int x, int y, int key, int modifiers )
Parameters
target
the target component.
when
the time stamp.
id
the event type.
x
the x coordinate.
y
the y coordinate.
key
the key pressed in a keyboard event.
modifiers
the state of the modifier keys.
Description
Creates an instance of Event, with the specified target component, time stamp, event type, x and y coordinates, keyboard key, state of the modifier keys, and an argument set to null.

Syntax 3
public Event( Object target, int id, Object arg )
Parameters
target
the target component.
id
the event type.
arg
the specified argument.
Description
Creates an instance of Event with the specified target component, event type, and argument.


 Event.controlDown

Event.controlDown

Syntax
public boolean controlDown()
Returns
true if the key is down; false otherwise.
Description
Checks if the Control key is down.

See Also
modifiers, shiftDown, metaDown


 Event.metaDown

Event.metaDown

Syntax
public boolean metaDown()
Returns
true if the key is down; false otherwise.
Description
Checks if the Meta key is down.

See Also
modifiers, shiftDown, controlDown


 Event.paramString

Event.paramString

Syntax
protected String paramString()
Returns
the parameter string of this event.
Description
Returns the parameter string representing this event. This string is useful for debugging.


 Event.shiftDown

Event.shiftDown

Syntax
public boolean shiftDown()
Returns
true if the key is down; false otherwise.
Description
Checks if the Shift key is down.

See Also
modifiers, controlDown, metaDown


 Event.toString

Event.toString

Syntax
public String toString()
Returns
a string that represents the event and the values of its member fields.
Description
Returns a representation of this event's values as a string.

Overrides
toString in class Object
See Also
paramString


 Event.translate

Event.translate

Syntax
public void translate( int x, int y )
Parameters
dx
the distance to translate the x coordinate.
dy
the distance to translate the y coordinate.
Description
Translates this event so that its x and y coordinates are increased by dx and dy, respectively.

This method translates an event relative to the given component. This involves, at a minimum, translating the coordinates into the local coordinate system of the given component. It may also involve translating a region in the case of an expose event.


 Class EventQueue

Class java.awt.EventQueue

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.EventQueue

public class EventQueue
extends Object

EventQueue is a platform-independent class that queues events, both from the underlying peer classes and from trusted application classes. There is only one EventQueue for the system.


 EventQueue Members

EventQueue Members

Class Overview | This Package | All Packages

Constructors
Name | Description
EventQueue() |

Methods
Name | Description
getNextEvent() | Remove an event from the queue and return it.
peekEvent() | Return the first event without removing it.
peekEvent(int) |
postEvent(AWTEvent) | Post a 1.1-style event to the EventQueue.


 EventQueue.EventQueue

EventQueue.EventQueue

Syntax
public EventQueue()


 EventQueue.getNextEvent

EventQueue.getNextEvent

Syntax
public synchronized AWTEvent getNextEvent() throws InterruptedException
Returns
the next AWTEvent
Description
Remove an event from the queue and return it. This method will block until an event has been posted by another thread.

Exceptions
InterruptedException if another thread has interrupted this thread.


 EventQueue.peekEvent

EventQueue.peekEvent

Syntax 1
public synchronized AWTEvent peekEvent()
Returns
the first event, which is either an instance of java.awt.Event or java.awt.AWTEvent.
Description
Return the first event without removing it.

Syntax 2
public synchronized AWTEvent peekEvent( int id )


 EventQueue.postEvent

EventQueue.postEvent

Syntax
public synchronized void postEvent( AWTEvent theEvent )
Parameters
theEvent
an instance of java.awt.AWTEvent, or a subclass of it.
Description
Post a 1.1-style event to the EventQueue.


 Class FileDialog

Class java.awt.FileDialog

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Window
                           |
                           +----java.awt.Dialog
                                   |
                                   +----java.awt.FileDialog

public class FileDialog
extends Dialog

The FileDialog class displays a dialog window from which the user can select a file.

Since it is a modal dialog, when the application calls its show method to display the dialog, it blocks the rest of the application until the user has chosen a file.

See Also:
show


 FileDialog Members

FileDialog Members

Class Overview | This Package | All Packages

Fields
Name | Description
LOAD | This constant value indicates that the purpose of the file dialog window is to locate a file from which to read.
SAVE | This constant value indicates that the purpose of the file dialog window is to locate a file to which to write.

Constructors
Name | Description
FileDialog(Frame) | Creates a file dialog for loading a file.
FileDialog(Frame, String) | Creates a file dialog window with the specified title for loading a file.
FileDialog(Frame, String, int) | Creates a file dialog window with the specified title for loading or saving a file.

Methods
Name | Description
addNotify() | Creates the file dialog's peer.
getDirectory() | Gets the directory of this file dialog.
getFile() | Gets the selected file of this file dialog.
getFilenameFilter() | Determines this file dialog's filename filter.
getMode() | Indicates whether this file dialog box is for loading from a file or for saving to a file.
paramString() | Returns the parameter string representing the state of this file dialog window.
setDirectory(String) | Sets the directory of this file dialog window to be the specified directory.
setFile(String) | Sets the selected file for this file dialog window to be the specified file.
setFilenameFilter(FilenameFilter) | Sets the filename filter for this file dialog window to the specified filter.
setMode(int) | Sets the mode of the file dialog.


 FileDialog.LOAD

FileDialog.LOAD

Syntax
public static final int LOAD
Description
This constant value indicates that the purpose of the file dialog window is to locate a file from which to read.


 FileDialog.SAVE

FileDialog.SAVE

Syntax
public static final int SAVE
Description
This constant value indicates that the purpose of the file dialog window is to locate a file to which to write.


 FileDialog.FileDialog

FileDialog.FileDialog

Syntax 1
public FileDialog( Frame parent )
Parameters
parent
the owner of the dialog
Description
Creates a file dialog for loading a file. The title of the file dialog is initially empty.

Syntax 2
public FileDialog( Frame parent, String title )
Parameters
parent
the owner of the dialog.
title
the title of the dialog.
Description
Creates a file dialog window with the specified title for loading a file. The files shown are those in the current directory.

Syntax 3
public FileDialog( Frame parent, String title, int mode )
Parameters
parent
the owner of the dialog.
title
the title of the dialog.
mode
the mode of the dialog.
Description
Creates a file dialog window with the specified title for loading or saving a file.

If the value of mode is LOAD, then the file dialog is finding a file to read. If the value of mode is SAVE, the file dialog is finding a place to write a file.

See Also
LOAD, SAVE


 FileDialog.addNotify

FileDialog.addNotify

Syntax
public void addNotify()
Description
Creates the file dialog's peer. The peer allows us to change the look of the file dialog without changing its functionality.

Overrides
addNotify in class Dialog


 FileDialog.getDirectory

FileDialog.getDirectory

Syntax
public String getDirectory()
Returns
the directory of this file dialog.
Description
Gets the directory of this file dialog.

See Also
setDirectory


 FileDialog.getFile

FileDialog.getFile

Syntax
public String getFile()
Returns
the currently selected file of this file dialog window, or null if none is selected.
Description
Gets the selected file of this file dialog.

See Also
setFile


 FileDialog.getFilenameFilter

FileDialog.getFilenameFilter

Syntax
public FilenameFilter getFilenameFilter()
Returns
this file dialog's filename filter.
Description
Determines this file dialog's filename filter. A filename filter allows the user to specify which files appear in the file dialog window.

See Also
FilenameFilter, setFilenameFilter


 FileDialog.getMode

FileDialog.getMode

Syntax
public int getMode()
Returns
the mode of this file dialog window, either FileDialog.LOAD or FileDialog.SAVE.
Description
Indicates whether this file dialog box is for loading from a file or for saving to a file.

See Also
LOAD, SAVE, setMode


 FileDialog.paramString

FileDialog.paramString

Syntax
protected String paramString()
Returns
the parameter string of this file dialog window.
Description
Returns the parameter string representing the state of this file dialog window. This string is useful for debugging.

Overrides
paramString in class Dialog


 FileDialog.setDirectory

FileDialog.setDirectory

Syntax
public synchronized void setDirectory( String dir )
Parameters
dir
the specific directory.
Description
Sets the directory of this file dialog window to be the specified directory.

See Also
getDirectory


 FileDialog.setFile

FileDialog.setFile

Syntax
public synchronized void setFile( String file )
Parameters
file
the file being set.
Description
Sets the selected file for this file dialog window to be the specified file. This file becomes the default file if it is set before the file dialog window is first shown.

See Also
getFile


 FileDialog.setFilenameFilter

FileDialog.setFilenameFilter

Syntax
public synchronized void setFilenameFilter( FilenameFilter filter )
Parameters
filter
the specified filter.
Description
Sets the filename filter for this file dialog window to the specified filter.

See Also
FilenameFilter, getFilenameFilter


 FileDialog.setMode

FileDialog.setMode

Syntax
public void setMode( int mode )
Parameters
mode
the mode for this file dialog, either FileDialog.LOAD or FileDialog.SAVE.
Description
Sets the mode of the file dialog.

Exceptions
IllegalArgumentException if an illegal file dialog mode is used.
See Also
LOAD, SAVE, getMode


 Class FlowLayout

Class java.awt.FlowLayout

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.FlowLayout

public class FlowLayout
extends Object
implements LayoutManager, Serializable

A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. Flow layouts are typically used to arrange buttons in a panel. It will arrange buttons left to right until no more buttons fit on the same line. Each line is centered.

For example, the following picture shows an applet using the flow layout manager (its default layout manager) to position three buttons:

Graphic of Layout for Three Buttons

Here is the code for this applet:

 import java.awt.*;
 import java.applet.Applet;
 public class myButtons extends Applet {
     Button button1, button2, button3;
     public void init() {
         button1 = new Button("Ok");
         button2 = new Button("Open");
         button3 = new Button("Close");
         add(button1);
         add(button2);
         add(button3);
     }
 }

A flow layout lets each component assume its natural (preferred) size.


 FlowLayout Members

FlowLayout Members

Class Overview | This Package | All Packages

Fields
Name | Description
CENTER | This value indicates that each row of components should be centered.
LEFT | This value indicates that each row of components should be left-justified.
RIGHT | This value indicates that each row of components should be right-justified.

Constructors
Name | Description
FlowLayout() | Constructs a new Flow Layout with a centered alignment and a default 5-unit horizontal and vertical gap.
FlowLayout(int) | Constructs a new Flow Layout with the specified alignment and a default 5-unit horizontal and vertical gap.
FlowLayout(int, int, int) | Creates a new flow layout manager with the indicated alignment and the indicated horizontal and vertical gaps.

Methods
Name | Description
addLayoutComponent(String, Component) | Adds the specified component to the layout.
getAlignment() | Gets the alignment for this layout.
getHgap() | Gets the horizontal gap between components.
getVgap() | Gets the vertical gap between components.
layoutContainer(Container) | Lays out the container.
minimumLayoutSize(Container) | Returns the minimum dimensions needed to layout the components contained in the specified target container.
preferredLayoutSize(Container) | Returns the preferred dimensions for this layout given the components in the specified target container.
removeLayoutComponent(Component) | Removes the specified component from the layout.
setAlignment(int) | Sets the alignment for this layout.
setHgap(int) | Sets the horizontal gap between components.
setVgap(int) | Sets the vertical gap between components.
toString() | Returns a string representation of this FlowLayout object and its values.


 FlowLayout.CENTER

FlowLayout.CENTER

Syntax
public static final int CENTER
Description
This value indicates that each row of components should be centered.


 FlowLayout.LEFT

FlowLayout.LEFT

Syntax
public static final int LEFT
Description
This value indicates that each row of components should be left-justified.


 FlowLayout.RIGHT

FlowLayout.RIGHT

Syntax
public static final int RIGHT
Description
This value indicates that each row of components should be right-justified.


 FlowLayout.FlowLayout

FlowLayout.FlowLayout

Syntax 1
public FlowLayout()
Description
Constructs a new Flow Layout with a centered alignment and a default 5-unit horizontal and vertical gap.

Syntax 2
public FlowLayout( int align )
Parameters
align
the alignment value
Description
Constructs a new Flow Layout with the specified alignment and a default 5-unit horizontal and vertical gap. The value of the alignment argument must be one of FlowLayout.LEFT, FlowLayout.RIGHT, or FlowLayout.CENTER.

Syntax 3
public FlowLayout( int align, int hgap, int vgap )
Parameters
align
the alignment value.
hgap
the horizontal gap between components.
vgap
the vertical gap between components.
Description
Creates a new flow layout manager with the indicated alignment and the indicated horizontal and vertical gaps.

The value of the alignment argument must be one of FlowLayout.LEFT, FlowLayout.RIGHT, or FlowLayout.CENTER.


 FlowLayout.addLayoutComponent

FlowLayout.addLayoutComponent

Syntax
public void addLayoutComponent( String name, Component comp )
Parameters
name
the name of the component
comp
the component to be added
Description
Adds the specified component to the layout. Not used by this class.


 FlowLayout.getAlignment

FlowLayout.getAlignment

Syntax
public int getAlignment()
Returns
the alignment value for this layout.
Description
Gets the alignment for this layout. Possible values are FlowLayout.LEFT, FlowLayout.RIGHT, or FlowLayout.CENTER.

See Also
setAlignment


 FlowLayout.getHgap

FlowLayout.getHgap

Syntax
public int getHgap()
Returns
the horizontal gap between components.
Description
Gets the horizontal gap between components.

See Also
setHgap


 FlowLayout.getVgap

FlowLayout.getVgap

Syntax
public int getVgap()
Returns
the vertical gap between components.
Description
Gets the vertical gap between components.

See Also
setVgap


 FlowLayout.layoutContainer

FlowLayout.layoutContainer

Syntax
public void layoutContainer( Container target )
Parameters
target
the specified component being laid out.
Description
Lays out the container. This method lets each component take its preferred size by reshaping the components in the target container in order to satisfy the constraints of this FlowLayout object.

See Also
Container, doLayout


 FlowLayout.minimumLayoutSize

FlowLayout.minimumLayoutSize

Syntax
public Dimension minimumLayoutSize( Container target )
Parameters
target
the component which needs to be laid out
Returns
the minimum dimensions to lay out the subcomponents of the specified container.
Description
Returns the minimum dimensions needed to layout the components contained in the specified target container.

See Also
preferredLayoutSize, Container, doLayout


 FlowLayout.preferredLayoutSize

FlowLayout.preferredLayoutSize

Syntax
public Dimension preferredLayoutSize( Container target )
Parameters
target
the component which needs to be laid out
Returns
the preferred dimensions to lay out the subcomponents of the specified container.
Description
Returns the preferred dimensions for this layout given the components in the specified target container.

See Also
Container, minimumLayoutSize, getPreferredSize


 FlowLayout.removeLayoutComponent

FlowLayout.removeLayoutComponent

Syntax
public void removeLayoutComponent( Component comp )
Parameters
comp
the component to remove
Description
Removes the specified component from the layout. Not used by this class.

See Also
removeAll


 FlowLayout.setAlignment

FlowLayout.setAlignment

Syntax
public void setAlignment( int align )
Parameters
align
the alignment value.
Description
Sets the alignment for this layout. Possible values are FlowLayout.LEFT, FlowLayout.RIGHT, and FlowLayout.CENTER.

See Also
getAlignment


 FlowLayout.setHgap

FlowLayout.setHgap

Syntax
public void setHgap( int hgap )
Parameters
hgap
the horizontal gap between components
Description
Sets the horizontal gap between components.

See Also
getHgap


 FlowLayout.setVgap

FlowLayout.setVgap

Syntax
public void setVgap( int vgap )
Parameters
vgap
the vertical gap between components
Description
Sets the vertical gap between components.

See Also
getVgap


 FlowLayout.toString

FlowLayout.toString

Syntax
public String toString()
Returns
a string representation of this layout.
Description
Returns a string representation of this FlowLayout object and its values.

Overrides
toString in class Object


 Class Font

Class java.awt.Font

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Font

public class Font
extends Object
implements Serializable

A class that produces font objects.


 Font Members

Font Members

Class Overview | This Package | All Packages

Fields
Name | Description
BOLD | The bold style constant.
ITALIC | The italicized style constant.
name | The logical name of this font.
PLAIN | The plain style constant.
size | The point size of this font.
style | The style of the font.

Constructors
Name | Description
Font(String, int, int) | Creates a new font with the specified name, style and point size.

Methods
Name | Description
decode(String) | Gets the specified font using the name passed in.
equals(Object) | Compares this object to the specifed object.
getFamily() | Gets the platform specific family name of the font.
getFont(String) | Gets a font from the system properties list.
getFont(String, Font) | Gets the specified font from the system properties list.
getName() | Gets the logical name of the font.
getPeer() | Gets the peer of the font.
getSize() | Gets the point size of the font.
getStyle() | Gets the style of the font.
hashCode() | Returns a hashcode for this font.
isBold() | Indicates whether the font's style is bold.
isItalic() | Indicates whether the font's style is italic.
isPlain() | Indicates whether the font's style is plain.
toString() | Converts this object to a String representation.


 Font.BOLD

Font.BOLD

Syntax
public static final int BOLD
Description
The bold style constant. This style can be combined with the other style constants for mixed styles.


 Font.ITALIC

Font.ITALIC

Syntax
public static final int ITALIC
Description
The italicized style constant. This style can be combined with the other style constants for mixed styles.


 Font.name

Font.name

Syntax
protected String name
Description
The logical name of this font.


 Font.PLAIN

Font.PLAIN

Syntax
public static final int PLAIN
Description
The plain style constant. This style can be combined with the other style constants for mixed styles.


 Font.size

Font.size

Syntax
protected int size
Description
The point size of this font.


 Font.style

Font.style

Syntax
protected int style
Description
The style of the font. This is the sum of the constants PLAIN, BOLD, or ITALIC.


 Font.Font

Font.Font

Syntax
public Font( String name, int style, int size )
Parameters
name
the font name
style
the constant style used
size
the point size of the font
Description
Creates a new font with the specified name, style and point size.

See Also
getFontList


 Font.decode

Font.decode

Syntax
public static Font decode( String str )
Parameters
str
the name
Description
Gets the specified font using the name passed in.


 Font.equals

Font.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the object to compare this font with.
Returns
true if the objects are equal; false otherwise.
Description
Compares this object to the specifed object. The result is true if and only if the argument is not null and is a Font object with the same name, style, and point size as this font.

Overrides
equals in class Object


 Font.getFamily

Font.getFamily

Syntax
public String getFamily()
Returns
a string, the platform specific family name.
Description
Gets the platform specific family name of the font. Use the getName method to get the logical name of the font.

See Also
getName


 Font.getFont

Font.getFont

Syntax
public static Font getFont( String nm )
Parameters
nm
the property name
Description
Gets a font from the system properties list.

See Also
getFont


 Font.getFont

Font.getFont

Syntax
public static Font getFont( String nm, Font font )
Parameters
nm
the property name
font
a default font to return if property nm is not defined
Returns
the Font value of the property.
Description
Gets the specified font from the system properties list. The first argument is treated as the name of a system property to be obtained as if by the method System.getProperty. The string value of this property is then interpreted as a font.

The property value should be one of the following forms:

  • fontname-style-pointsize
  • fontname-pointsize
  • fontname-style
  • fontname
where style is one of the three strings "BOLD", "BOLDITALIC", or "ITALIC", and point size is a decimal representation of the point size.

The default style is PLAIN. The default point size is 12.

If the specified property is not found, the font argument is returned instead.


 Font.getName

Font.getName

Syntax
public String getName()
Returns
a string, the logical name of the font.
Description
Gets the logical name of the font.

See Also
getFamily


 Font.getPeer

Font.getPeer

Syntax
public FontPeer getPeer()
Returns
the peer of the font.
Description
Gets the peer of the font.


 Font.getSize

Font.getSize

Syntax
public int getSize()
Returns
the point size of this font.
Description
Gets the point size of the font.


 Font.getStyle

Font.getStyle

Syntax
public int getStyle()
Returns
the style of this font.
Description
Gets the style of the font.

See Also
isPlain, isBold, isItalic


 Font.hashCode

Font.hashCode

Syntax
public int hashCode()
Returns
a hashcode value for this font.
Description
Returns a hashcode for this font.

Overrides
hashCode in class Object


 Font.isBold

Font.isBold

Syntax
public boolean isBold()
Returns
true if the font is bold; false otherwise.
Description
Indicates whether the font's style is bold.

See Also
getStyle


 Font.isItalic

Font.isItalic

Syntax
public boolean isItalic()
Returns
true if the font is italic; false otherwise.
Description
Indicates whether the font's style is italic.

See Also
getStyle


 Font.isPlain

Font.isPlain

Syntax
public boolean isPlain()
Returns
true if the font is neither bold nor italic; false otherwise.
Description
Indicates whether the font's style is plain.

See Also
getStyle


 Font.toString

Font.toString

Syntax
public String toString()
Returns
a string representation of this object
Description
Converts this object to a String representation.

Overrides
toString in class Object


 Class FontMetrics

Class java.awt.FontMetrics

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.FontMetrics

public abstract class FontMetrics
extends Object
implements Serializable

A font metrics object, which gives information about the rendering of a particular font on a particular screen. Note that the implementations of these methods are inefficient, they are usually overridden with more efficient toolkit-specific implementations.

Note to subclassers: Since many of these methods form closed mutually recursive loops, you must take care that you implement at least one of the methods in each such loop in order to prevent infinite recursion when your subclass is used. In particular, the following is the minimal suggested set of methods to override in order to ensure correctness and prevent infinite recursion (though other subsets are equally feasible):

  • getAscent()
  • getDescent()
  • getLeading()
  • getMaxAdvance()
  • charWidth(char ch)
  • charsWidth(char data[], int off, int len)

When an application asks AWT to place a character at the position (x, y), the character is placed so that its reference point (shown as the dot in the accompanying image) is put at that position. The reference point specifies a horizontal line called the baseline of the character. In normal printing, the baselines of characters should align.

In addition, every character in a font has an ascent, a descent, and an advance width. The ascent is the amount by which the character ascends above the baseline. The descent is the amount by which the character descends below the baseline. The advance width indicates the position at which AWT should place the next character.

If the current character is placed with its reference point at the position (x, y), and the character's advance width is w, then the following character is placed with its reference point at the position (x + w, y). The advance width is often the same as the width of character's bounding box, but need not be so. In particular, oblique and italic fonts often have characters whose top-right corner extends slightly beyond the advance width.

An array of characters or a string can also have an ascent, a descent, and an advance width. The ascent of the array is the maximum ascent of any character in the array. The descent is the maximum descent of any character in the array. The advance width is the sum of the advance widths of each of the characters in the array.

See Also:
Font


 FontMetrics Members

FontMetrics Members

Class Overview | This Package | All Packages

Fields
Name | Description
font | The actual font.

Constructors
Name | Description
FontMetrics(Font) | Creates a new FontMetrics object for finding out height and width information about the specified font and specific character glyphs in that font.

Methods
Name | Description
bytesWidth(byte[], int, int) | Returns the total advance width for showing the specified array of bytes in this Font.
charsWidth(char[], int, int) | Returns the total advance width for showing the specified array of characters in this Font.
charWidth(char) | Returns the advance width of the specified character in this Font.
charWidth(int) | Returns the advance width of the specified character in this Font.
getAscent() | Determines the font ascent of the font described by this font metric.
getDescent() | Determines the font descent of the font described by this font metric.
getFont() | Gets the font described by this font metric.
getHeight() | Gets the standard height of a line of text in this font.
getLeading() | Determines the standard leading of the font described by this font metric.
getMaxAdvance() | Gets the maximum advance width of any character in this Font.
getMaxAscent() | Determines the maximum ascent of the font described by this font metric.
getMaxDecent() | For backward compatibility only. Deprecated.
getMaxDescent() | Determines the maximum descent of the font described by this font metric.
getWidths() | Gets the advance widths of the first 256 characters in the Font.
stringWidth(String) | Returns the total advance width for showing the specified String in this Font.
toString() | Returns a representation of this FontMetric object's values as a string.


 FontMetrics.font

FontMetrics.font

Syntax
protected Font font
Description
The actual font.

See Also
getFont


 FontMetrics.FontMetrics

FontMetrics.FontMetrics

Syntax
protected FontMetrics( Font font )
Parameters
font
the font
Description
Creates a new FontMetrics object for finding out height and width information about the specified font and specific character glyphs in that font.

See Also
Font


 FontMetrics.bytesWidth

FontMetrics.bytesWidth

Syntax
public int bytesWidth( byte data[], int off, int len )
Parameters
data
the array of bytes to be measured
off
the start offset of the bytes in the array
len
the number of bytes to be measured from the array
Returns
the advance width of the subarray of the specified byte array in the font described by this font metric.
Description
Returns the total advance width for showing the specified array of bytes in this Font. The advance width is the amount by which the current point is moved from one character to the next in a line of text.

See Also
charsWidth, stringWidth


 FontMetrics.charsWidth

FontMetrics.charsWidth

Syntax
public int charsWidth( char data[], int off, int len )
Parameters
data
the array of characters to be measured
off
the start offset of the characters in the array
len
the number of characters to be measured from the array
Returns
the advance width of the subarray of the specified char array in the font described by this font metric.
Description
Returns the total advance width for showing the specified array of characters in this Font. The advance width is the amount by which the current point is moved from one character to the next in a line of text.

See Also
charWidth, charWidth, bytesWidth, stringWidth


 FontMetrics.charWidth

FontMetrics.charWidth

Syntax 1
public int charWidth( int ch )
Parameters
ch
the character to be measured
Returns
the advance width of the specified char in the font described by this font metric.
Description
Returns the advance width of the specified character in this Font. The advance width is the amount by which the current point is moved from one character to the next in a line of text.

See Also
charsWidth, stringWidth

Syntax 2
public int charWidth( char ch )
Parameters
ch
the character to be measured
Returns
the advance width of the specified char > in the font described by this font metric.
Description
Returns the advance width of the specified character in this Font. The advance width is the amount by which the current point is moved from one character to the next in a line of text.

See Also
charsWidth, stringWidth


 FontMetrics.getAscent

FontMetrics.getAscent

Syntax
public int getAscent()
Returns
the font ascent of the font.
Description
Determines the font ascent of the font described by this font metric. The font ascent is the distance from the font's baseline to the top of most alphanumeric characters. Some characters in the font may extend above the font ascent line.

See Also
getMaxAscent


 FontMetrics.getDescent

FontMetrics.getDescent

Syntax
public int getDescent()
Returns
the font descent of the font.
Description
Determines the font descent of the font described by this font metric. The font descent is the distance from the font's baseline to the bottom of most alphanumeric characters with descenders. Some characters in the font may extend below the font descent line.

See Also
getMaxDescent


 FontMetrics.getFont

FontMetrics.getFont

Syntax
public Font getFont()
Returns
the font described by this font metric.
Description
Gets the font described by this font metric.


 FontMetrics.getHeight

FontMetrics.getHeight

Syntax
public int getHeight()
Returns
the standard height of the font.
Description
Gets the standard height of a line of text in this font. This is the distance between the baseline of adjacent lines of text. It is the sum of the leading + ascent + descent. There is no guarantee that lines of text spaced at this distance will be disjoint; such lines may overlap if some characters overshoot either the standard ascent or the standard descent metric.

See Also
getLeading, getAscent, getDescent


 FontMetrics.getLeading

FontMetrics.getLeading

Syntax
public int getLeading()
Returns
the standard leading of the font.
Description
Determines the standard leading of the font described by this font metric. The standard leading (interline spacing) is the logical amount of space to be reserved between the descent of one line of text and the ascent of the next line. The height metric is calculated to include this extra space.

See Also
getHeight, getAscent, getDescent


 FontMetrics.getMaxAdvance

FontMetrics.getMaxAdvance

Syntax
public int getMaxAdvance()
Returns
the maximum advance width of any character in the font, or -1 if the maximum advance width is not known.
Description
Gets the maximum advance width of any character in this Font. The advance width is the amount by which the current point is moved from one character to the next in a line of text.


 FontMetrics.getMaxAscent

FontMetrics.getMaxAscent

Syntax
public int getMaxAscent()
Returns
the maximum ascent of any character in the font.
Description
Determines the maximum ascent of the font described by this font metric. No character extends further above the font's baseline than this height.

See Also
getAscent


 FontMetrics.getMaxDecent

FontMetrics.getMaxDecent

Syntax
public int getMaxDecent()
Description
Note: getMaxDecent() is deprecated. As of JDK version 1.1.1, replaced by getMaxDescent().

For backward compatibility only.

See Also
getMaxDescent


 FontMetrics.getMaxDescent

FontMetrics.getMaxDescent

Syntax
public int getMaxDescent()
Returns
the maximum descent of any character in the font.
Description
Determines the maximum descent of the font described by this font metric. No character extends further below the font's baseline than this height.

See Also
getDescent


 FontMetrics.getWidths

FontMetrics.getWidths

Syntax
public int[] getWidths()
Returns
an array giving the advance widths of the characters in the font described by this font metric.
Description
Gets the advance widths of the first 256 characters in the Font. The advance width is the amount by which the current point is moved from one character to the next in a line of text.


 FontMetrics.stringWidth

FontMetrics.stringWidth

Syntax
public int stringWidth( String str )
Parameters
str
the String to be measured
Returns
the advance width of the specified string in the font described by this font metric.
Description
Returns the total advance width for showing the specified String in this Font. The advance width is the amount by which the current point is moved from one character to the next in a line of text.

See Also
bytesWidth, charsWidth


 FontMetrics.toString

FontMetrics.toString

Syntax
public String toString()
Returns
a string representation of this font metric.
Description
Returns a representation of this FontMetric object's values as a string.

Overrides
toString in class Object


 Class Frame

Class java.awt.Frame

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Window
                           |
                           +----java.awt.Frame

public class Frame
extends Window
implements MenuContainer

A Frame is a top-level window with a title and a border. The default layout for a frame is BorderLayout. Frames are capable of generating the following types of window events: WindowOpened, WindowClosing, WindowClosed, WindowIconified, WindowDeiconified, WindowActivated, WindowDeactivated.

See Also:
WindowEvent, addWindowListener


 Frame Members

Frame Members

Class Overview | This Package | All Packages

Fields
Name | Description
CROSSHAIR_CURSOR | Deprecated.
DEFAULT_CURSOR | Deprecated.
E_RESIZE_CURSOR | Deprecated.
HAND_CURSOR | Deprecated.
MOVE_CURSOR | Deprecated.
N_RESIZE_CURSOR | Deprecated.
NE_RESIZE_CURSOR | Deprecated.
NW_RESIZE_CURSOR | Deprecated.
S_RESIZE_CURSOR | Deprecated.
SE_RESIZE_CURSOR | Deprecated.
SW_RESIZE_CURSOR | Deprecated.
TEXT_CURSOR | Deprecated.
W_RESIZE_CURSOR | Deprecated.
WAIT_CURSOR | Deprecated.

Constructors
Name | Description
Frame() | Constructs a new instance of Frame that is initially invisible.
Frame(String) | Constructs a new, initially invisible Frame object with the specified title.

Methods
Name | Description
addNotify() | Creates the Frame's peer.
dispose() | Disposes of the Frame.
getCursorType() | Deprecated.
getIconImage() | Gets the icon image for this frame.
getMenuBar() | Gets the menu bar for this frame.
getTitle() | Gets the title of the frame.
isResizable() | Indicates whether this frame is resizable.
paramString() | Returns the parameter String of this Frame.
remove(MenuComponent) | Removes the specified menu bar from this frame.
setCursor(int) | Deprecated.
setIconImage(Image) | Sets the image to display when this frame is iconized.
setMenuBar(MenuBar) | Sets the menu bar for this frame to the specified menu bar.
setResizable(boolean) | Sets the resizable flag, which determines whether this frame is resizable.
setTitle(String) | Sets the title for this frame to the specified title.


 Frame.CROSSHAIR_CURSOR

Frame.CROSSHAIR_CURSOR

Syntax
public static final int CROSSHAIR_CURSOR
Description
Note: CROSSHAIR_CURSOR is deprecated. replaced by Cursor.CROSSHAIR_CURSOR.


 Frame.DEFAULT_CURSOR

Frame.DEFAULT_CURSOR

Syntax
public static final int DEFAULT_CURSOR
Description
Note: DEFAULT_CURSOR is deprecated. replaced by Cursor.DEFAULT_CURSOR.


 Frame.E_RESIZE_CURSOR

Frame.E_RESIZE_CURSOR

Syntax
public static final int E_RESIZE_CURSOR
Description
Note: E_RESIZE_CURSOR is deprecated. replaced by Cursor.E_RESIZE_CURSOR.


 Frame.HAND_CURSOR

Frame.HAND_CURSOR

Syntax
public static final int HAND_CURSOR
Description
Note: HAND_CURSOR is deprecated. replaced by Cursor.HAND_CURSOR.


 Frame.MOVE_CURSOR

Frame.MOVE_CURSOR

Syntax
public static final int MOVE_CURSOR
Description
Note: MOVE_CURSOR is deprecated. replaced by Cursor.MOVE_CURSOR.


 Frame.N_RESIZE_CURSOR

Frame.N_RESIZE_CURSOR

Syntax
public static final int N_RESIZE_CURSOR
Description
Note: N_RESIZE_CURSOR is deprecated. replaced by Cursor.N_RESIZE_CURSOR.


 Frame.NE_RESIZE_CURSOR

Frame.NE_RESIZE_CURSOR

Syntax
public static final int NE_RESIZE_CURSOR
Description
Note: NE_RESIZE_CURSOR is deprecated. replaced by Cursor.NE_RESIZE_CURSOR.


 Frame.NW_RESIZE_CURSOR

Frame.NW_RESIZE_CURSOR

Syntax
public static final int NW_RESIZE_CURSOR
Description
Note: NW_RESIZE_CURSOR is deprecated. replaced by Cursor.NW_RESIZE_CURSOR.


 Frame.S_RESIZE_CURSOR

Frame.S_RESIZE_CURSOR

Syntax
public static final int S_RESIZE_CURSOR
Description
Note: S_RESIZE_CURSOR is deprecated. replaced by Cursor.S_RESIZE_CURSOR.


 Frame.SE_RESIZE_CURSOR

Frame.SE_RESIZE_CURSOR

Syntax
public static final int SE_RESIZE_CURSOR
Description
Note: SE_RESIZE_CURSOR is deprecated. replaced by Cursor.SE_RESIZE_CURSOR.


 Frame.SW_RESIZE_CURSOR

Frame.SW_RESIZE_CURSOR

Syntax
public static final int SW_RESIZE_CURSOR
Description
Note: SW_RESIZE_CURSOR is deprecated. replaced by Cursor.SW_RESIZE_CURSOR.


 Frame.TEXT_CURSOR

Frame.TEXT_CURSOR

Syntax
public static final int TEXT_CURSOR
Description
Note: TEXT_CURSOR is deprecated. replaced by Cursor.TEXT_CURSOR.


 Frame.W_RESIZE_CURSOR

Frame.W_RESIZE_CURSOR

Syntax
public static final int W_RESIZE_CURSOR
Description
Note: W_RESIZE_CURSOR is deprecated. replaced by Cursor.W_RESIZE_CURSOR.


 Frame.WAIT_CURSOR

Frame.WAIT_CURSOR

Syntax
public static final int WAIT_CURSOR
Description
Note: WAIT_CURSOR is deprecated. replaced by Cursor.WAIT_CURSOR.


 Frame.Frame

Frame.Frame

Syntax 1
public Frame()
Description
Constructs a new instance of Frame that is initially invisible.

See Also
setSize, setVisible

Syntax 2
public Frame( String title )
Parameters
title
the title for the frame
Description
Constructs a new, initially invisible Frame object with the specified title.

See Also
setSize, setVisible


 Frame.addNotify

Frame.addNotify

Syntax
public void addNotify()
Description
Creates the Frame's peer. The peer allows us to change the look of the Frame without changing its functionality.

Overrides
addNotify in class Window


 Frame.dispose

Frame.dispose

Syntax
public synchronized void dispose()
Description
Disposes of the Frame. This method must be called to release the resources that are used for the frame. All components contained by the frame and all windows owned by the frame will also be destroyed.

Overrides
dispose in class Window


 Frame.getCursorType

Frame.getCursorType

Syntax
public int getCursorType()
Description
Note: getCursorType() is deprecated. As of JDK version 1.1, replaced by Component.getCursor().


 Frame.getIconImage

Frame.getIconImage

Syntax
public Image getIconImage()
Returns
the icon image for this frame, or null if this frame doesn't have an icon image.
Description
Gets the icon image for this frame.

See Also
setIconImage


 Frame.getMenuBar

Frame.getMenuBar

Syntax
public MenuBar getMenuBar()
Returns
the menu bar for this frame, or null if this frame doesn't have a menu bar.
Description
Gets the menu bar for this frame.

See Also
setMenuBar


 Frame.getTitle

Frame.getTitle

Syntax
public String getTitle()
Returns
the title of this frame, or null if this frame doesn't have a title.
Description
Gets the title of the frame.

See Also
setTitle


 Frame.isResizable

Frame.isResizable

Syntax
public boolean isResizable()
Returns
true if the user can resize this frame; false otherwise.
Description
Indicates whether this frame is resizable. By default, all frames are initially resizable.

See Also
setResizable


 Frame.paramString

Frame.paramString

Syntax
protected String paramString()
Description
Returns the parameter String of this Frame.

Overrides
paramString in class Container


 Frame.remove

Frame.remove

Syntax
public synchronized void remove( MenuComponent m )
Parameters
m
the menu component to remove.
Description
Removes the specified menu bar from this frame.

Overrides
remove in class Component


 Frame.setCursor

Frame.setCursor

Syntax
public synchronized void setCursor( int cursorType )
Description
Note: setCursor() is deprecated. As of JDK version 1.1, replaced by Component.setCursor(Cursor).


 Frame.setIconImage

Frame.setIconImage

Syntax
public synchronized void setIconImage( Image image )
Parameters
image
the icon image to be displayed
Description
Sets the image to display when this frame is iconized. Not all platforms support the concept of iconizing a window.

See Also
getIconImage


 Frame.setMenuBar

Frame.setMenuBar

Syntax
public synchronized void setMenuBar( MenuBar mb )
Parameters
mb
the menu bar being set
Description
Sets the menu bar for this frame to the specified menu bar.

See Also
getMenuBar


 Frame.setResizable

Frame.setResizable

Syntax
public synchronized void setResizable( boolean resizable )
Parameters
resizable
true if this frame is resizable; false otherwise.
Description
Sets the resizable flag, which determines whether this frame is resizable. By default, all frames are initially resizable.

See Also
isResizable


 Frame.setTitle

Frame.setTitle

Syntax
public synchronized void setTitle( String title )
Parameters
title
the specified title of this frame.
Description
Sets the title for this frame to the specified title.

See Also
getTitle


 Class Graphics

Class java.awt.Graphics

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Graphics

public abstract class Graphics
extends Object

The Graphics class is the abstract base class for all graphics contexts that allow an application to draw onto components that are realized on various devices, as well as onto off-screen images.

A Graphics object encapsulates state information needed for the basic rendering operations that Java supports. This state information includes the following properties:

  • The Component object on which to draw.
  • A translation origin for rendering and clipping coordinates.
  • The current clip.
  • The current color.
  • The current font.
  • The current logical pixel operation function (XOR or Paint).
  • The current XOR alternation color (see setXORMode).

Coordinates are infinitely thin and lie between the pixels of the output device. Operations which draw the outline of a figure operate by traversing an infinitely thin path between pixels with a pixel-sized pen that hangs down and to the right of the anchor point on the path. Operations which fill a figure operate by filling the interior of that infinitely thin path. Operations which render horizontal text render the ascending portion of character glyphs entirely above the baseline coordinate.

The graphics pen hangs down and to the right from the path it traverses. This has the following implications:

  • If you draw a figure that covers a given rectangle, that figure occupies one extra row of pixels on the right and bottom edges as compared to filling a figure that is bounded by that same rectangle.
  • If you draw a horizontal line along the same y coordinate as the baseline of a line of text, that line is drawn entirely below the text, except for any descenders.

All coordinates which appear as arguments to the methods of this Graphics object are considered relative to the translation origin of this Graphics object prior to the invocation of the method. All rendering operations modify only pixels which lie within the area bounded by both the current clip of the graphics context and the extents of the component used to create the Graphics object. All drawing or writing is done in the current color, using the current paint mode, and in the current font.

See Also:
Component, clipRect, setColor, setPaintMode, setXORMode, setFont


 Graphics Members

Graphics Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Graphics() | Constructs a new Graphics object.

Methods
Name | Description
clearRect(int, int, int, int) | Clears the specified rectangle by filling it with the background color of the current drawing surface.
clipRect(int, int, int, int) | Intersects the current clip with the specified rectangle.
copyArea(int, int, int, int, int, int) | Copies an area of the component by a distance specified by dx and dy.
create() | Creates a new Graphics object that is a copy of this Graphics object.
create(int, int, int, int) | Creates a new Graphics object based on this Graphics object, but with a new translation and clip area.
dispose() | Disposes of this graphics context and releases any system resources that it is using.
draw3DRect(int, int, int, int, boolean) | Draws a 3-D highlighted outline of the specified rectangle.
drawArc(int, int, int, int, int, int) | Draws the outline of a circular or elliptical arc covering the specified rectangle.
drawBytes(byte[], int, int, int, int) | Draws the text given by the specified byte array, using this graphics context's current font and color.
drawChars(char[], int, int, int, int) | Draws the text given by the specified character array, using this graphics context's current font and color.
drawImage(Image, int, int, Color, ImageObserver) | Draws as much of the specified image as is currently available.
drawImage(Image, int, int, ImageObserver) | Draws as much of the specified image as is currently available.
drawImage(Image, int, int, int, int, Color, ImageObserver) | Draws as much of the specified image as has already been scaled to fit inside the specified rectangle.
drawImage(Image, int, int, int, int, ImageObserver) | Draws as much of the specified image as has already been scaled to fit inside the specified rectangle.
drawImage(Image, int, int, int, int, int, int, int, int, Color, ImageObserver) | Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface.
drawImage(Image, int, int, int, int, int, int, int, int, ImageObserver) | Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface.
drawLine(int, int, int, int) | Draws a line, using the current color, between the points (x1, y1) and (x2, y2) in this graphics context's coordinate system.
drawOval(int, int, int, int) | Draws the outline of an oval.
drawPolygon(int[], int[], int) | Draws a closed polygon defined by arrays of x and y coordinates.
drawPolygon(Polygon) | Draws the outline of a polygon defined by the specified Polygon object.
drawPolyline(int[], int[], int) | Draws a sequence of connected lines defined by arrays of x and y coordinates.
drawRect(int, int, int, int) | Draws the outline of the specified rectangle.
drawRoundRect(int, int, int, int, int, int) | Draws an outlined round-cornered rectangle using this graphics context's current color.
drawString(String, int, int) | Draws the text given by the specified string, using this graphics context's current font and color.
fill3DRect(int, int, int, int, boolean) | Paints a 3-D highlighted rectangle filled with the current color.
fillArc(int, int, int, int, int, int) | Fills a circular or elliptical arc covering the specified rectangle.
fillOval(int, int, int, int) | Fills an oval bounded by the specified rectangle with the current color.
fillPolygon(int[], int[], int) | Fills a closed polygon defined by arrays of x and y coordinates.
fillPolygon(Polygon) | Fills the polygon defined by the specified Polygon object with the graphics context's current color.
fillRect(int, int, int, int) | Fills the specified rectangle.
fillRoundRect(int, int, int, int, int, int) | Fills the specified rounded corner rectangle with the current color.
finalize() | Disposes of this graphics context once it is no longer referenced.
getClip() | Gets the current clipping area.
getClipBounds() | Returns the bounding rectangle of the current clipping area.
getClipRect() | Deprecated.
getColor() | Gets this graphics context's current color.
getFont() | Gets the current font.
getFontMetrics() | Gets the font metrics of the current font.
getFontMetrics(Font) | Gets the font metrics for the specified font.
setClip(int, int, int, int) | Sets the current clip to the rectangle specified by the given coordinates.
setClip(Shape) | Sets the current clipping area to an arbitrary clip shape.
setColor(Color) | Sets this graphics context's current color to the specified color.
setFont(Font) | Sets this graphics context's font to the specified font.
setPaintMode() | Sets the paint mode of this graphics context to overwrite the destination with this graphics context's current color.
setXORMode(Color) | Sets the paint mode of this graphics context to alternate between this graphics context's current color and the new specified color.
toString() | Returns a String object representing this Graphics object's value.
translate(int, int) | Translates the origin of the graphics context to the point (x, y) in the current coordinate system.


 Graphics.Graphics

Graphics.Graphics

Syntax
protected Graphics()
Description
Constructs a new Graphics object. This constructor is the default contructor for a graphics context.

Since Graphics is an abstract class, applications cannot call this constructor directly. Graphics contexts are obtained from other graphics contexts or are created by calling getGraphics on a component.

See Also
create, getGraphics


 Graphics.clearRect

Graphics.clearRect

Syntax
public abstract void clearRect( int x, int y, int width, int height )
Parameters
x
the x coordinate of the rectangle to clear.
y
the y coordinate of the rectangle to clear.
width
the width of the rectangle to clear.
height
the height of the rectangle to clear.
Description
Clears the specified rectangle by filling it with the background color of the current drawing surface. This operation does not use the current paint mode.

Beginning with Java 1.1, the background color of offscreen images may be system dependent. Applications should use setColor followed by fillRect to ensure that an offscreen image is cleared to a specific color.

See Also
fillRect, drawRect, setColor, setPaintMode, setXORMode


 Graphics.clipRect

Graphics.clipRect

Syntax
public abstract void clipRect( int x, int y, int width, int height )
Parameters
x
the x coordinate of the rectangle to intersect the clip with
y
the y coordinate of the rectangle to intersect the clip with
width
the width of the rectangle to intersect the clip with
height
the height of the rectangle to intersect the clip with
Description
Intersects the current clip with the specified rectangle. The resulting clipping area is the intersection of the current clipping area and the specified rectangle. This method can only be used to make the current clip smaller. To set the current clip larger, use any of the setClip methods. Rendering operations have no effect outside of the clipping area.

See Also
setClip, setClip


 Graphics.copyArea

Graphics.copyArea

Syntax
public abstract void copyArea( int x, int y, int width, int height, int dx, int dy )
Parameters
x
the x coordinate of the source rectangle.
y
the y coordinate of the source rectangle.
width
the width of the source rectangle.
height
the height of the source rectangle.
dx
the horizontal distance to copy the pixels.
dy
the vertical distance to copy the pixels.
Description
Copies an area of the component by a distance specified by dx and dy. From the point specified by x and y, this method copies downwards and to the right. To copy an area of the component to the left or upwards, specify a negative value for dx or dy. If a portion of the source rectangle lies outside the bounds of the component, or is obscured by another window or component, copyArea will be unable to copy the associated pixels. The area that is omitted can be refreshed by calling the component's paint method.


 Graphics.create

Graphics.create

Syntax 1
public abstract Graphics create()
Returns
a new graphics context that is a copy of this graphics context.
Description
Creates a new Graphics object that is a copy of this Graphics object.

Syntax 2
public Graphics create( int x, int y, int width, int height )
Parameters
x
the x coordinate.
y
the y coordinate.
width
the width of the clipping rectangle.
height
the height of the clipping rectangle.
Returns
a new graphics context.
Description
Creates a new Graphics object based on this Graphics object, but with a new translation and clip area. The new Graphics object has its origin translated to the specified point (x, y). Its clip area is determined by the intersection of the original clip area with the specified rectangle. The arguments are all interpreted in the coordinate system of the original Graphics object. The new graphics context is identical to the original, except in two respects:

  • The new graphics context is translated by (x, y). That is to say, the point (0, 0) in the new graphics context is the same as (x, y) in the original graphics context.
  • The new graphics context has an additional clipping rectangle, in addition to whatever (translated) clipping rectangle it inherited from the original graphics context. The origin of the new clipping rectangle is at (0, 0), and its size is specified by the width and height arguments.

See Also
translate, clipRect


 Graphics.dispose

Graphics.dispose

Syntax
public abstract void dispose()
Description
Disposes of this graphics context and releases any system resources that it is using. A Graphics object cannot be used after disposehas been called.

When a Java program runs, a large number of Graphics objects can be created within a short time frame. Although the finalization process of the garbage collector also disposes of the same system resources, it is preferable to manually free the associated resources by calling this method rather than to rely on a finalization process which may not run to completion for a long period of time.

Graphics objects which are provided as arguments to the paint and update methods of components are automatically released by the system when those methods return. For efficiency, programmers should call dispose when finished using a Graphics object only if it was created directly from a component or another Graphics object.

See Also
finalize, paint, update, getGraphics, create


 Graphics.draw3DRect

Graphics.draw3DRect

Syntax
public void draw3DRect( int x, int y, int width, int height, boolean raised )
Parameters
x
the x coordinate of the rectangle to be drawn.
y
the y coordinate of the rectangle to be drawn.
width
the width of the rectangle to be drawn.
height
the height of the rectangle to be drawn.
raised
a boolean that determines whether the rectangle appears to be raised above the surface or sunk into the surface.
Description
Draws a 3-D highlighted outline of the specified rectangle. The edges of the rectangle are highlighted so that they appear to be beveled and lit from the upper left corner.

The colors used for the highlighting effect are determined based on the current color. The resulting rectangle covers an area that is width + 1 pixels wide by height + 1 pixels tall.

See Also
fill3DRect


 Graphics.drawArc

Graphics.drawArc

Syntax
public abstract void drawArc( int x, int y, int width, int height, int startAngle, int arcAngle )
Parameters
x
the x coordinate of the upper-left corner of the arc to be drawn.
y
the y coordinate of the upper-left corner of the arc to be drawn.
width
the width of the arc to be drawn.
height
the height of the arc to be drawn.
startAngle
the beginning angle.
arcAngle
the angular extent of the arc, relative to the start angle.
Description
Draws the outline of a circular or elliptical arc covering the specified rectangle.

The resulting arc begins at startAngle and extends for arcAngle degrees, using the current color. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.

The center of the arc is the center of the rectangle whose origin is (x, y) and whose size is specified by the width and height arguments.

The resulting arc covers an area width + 1 pixels wide by height + 1 pixels tall.

See Also
fillArc


 Graphics.drawBytes

Graphics.drawBytes

Syntax
public void drawBytes( byte data[], int offset, int length, int x, int y )
Parameters
data
the data to be drawn
offset
the start offset in the data
length
the number of bytes that are drawn
x
the x coordinate of the baseline of the text
y
the y coordinate of the baseline of the text
Description
Draws the text given by the specified byte array, using this graphics context's current font and color. The baseline of the first character is at position (x, y) in this graphics context's coordinate system.

See Also
drawChars, drawString


 Graphics.drawChars

Graphics.drawChars

Syntax
public void drawChars( char data[], int offset, int length, int x, int y )
Parameters
data
the array of characters to be drawn
offset
the start offset in the data
length
the number of characters to be drawn
x
the x coordinate of the baseline of the text
y
the y coordinate of the baseline of the text
Description
Draws the text given by the specified character array, using this graphics context's current font and color. The baseline of the first character is at position (x, y) in this graphics context's coordinate system.

See Also
drawBytes, drawString


 Graphics.drawImage

Graphics.drawImage

Syntax 1
public abstract boolean drawImage( Image img, int x, int y, ImageObserver observer )
Parameters
img
the specified image to be drawn.
x
the x coordinate.
y
the y coordinate.
observer
object to be notified as more of the image is converted.
Description
Draws as much of the specified image as is currently available. The image is drawn with its top-left corner at (x, y) in this graphics context's coordinate space. Transparent pixels in the image do not affect whatever pixels are already there.

This method returns immediately in all cases, even if the complete image has not yet been loaded, and it has not been dithered and converted for the current output device.

If the image has not yet been completely loaded, then drawImage returns false. As more of the image becomes available, the process that draws the image notifies the specified image observer.

See Also
Image, ImageObserver, imageUpdate

Syntax 2
public abstract boolean drawImage( Image img, int x, int y, int width, int height, ImageObserver observer )
Parameters
img
the specified image to be drawn.
x
the x coordinate.
y
the y coordinate.
width
the width of the rectangle.
height
the height of the rectangle.
observer
object to be notified as more of the image is converted.
Description
Draws as much of the specified image as has already been scaled to fit inside the specified rectangle.

The image is drawn inside the specified rectangle of this graphics context's coordinate space, and is scaled if necessary. Transparent pixels do not affect whatever pixels are already there.

This method returns immediately in all cases, even if the entire image has not yet been scaled, dithered, and converted for the current output device. If the current output representation is not yet complete, then drawImage returns false. As more of the image becomes available, the process that draws the image notifies the image observer by calling its imageUpdate method.

A scaled version of an image will not necessarily be available immediately just because an unscaled version of the image has been constructed for this output device. Each size of the image may be cached separately and generated from the original data in a separate image production sequence.

See Also
Image, ImageObserver, imageUpdate

Syntax 3
public abstract boolean drawImage( Image img, int x, int y, Color bgcolor, ImageObserver observer )
Parameters
img
the specified image to be drawn.
x
the x coordinate.
y
the y coordinate.
bgcolor
the background color to paint under the non-opaque portions of the image.
observer
object to be notified as more of the image is converted.
Description
Draws as much of the specified image as is currently available. The image is drawn with its top-left corner at (x, y) in this graphics context's coordinate space. Transparent pixels are drawn in the specified background color.

This operation is equivalent to filling a rectangle of the width and height of the specified image with the given color and then drawing the image on top of it, but possibly more efficient.

This method returns immediately in all cases, even if the complete image has not yet been loaded, and it has not been dithered and converted for the current output device.

If the image has not yet been completely loaded, then drawImage returns false. As more of the image becomes available, the process that draws the image notifies the specified image observer.

See Also
Image, ImageObserver, imageUpdate

Syntax 4
public abstract boolean drawImage( Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer )
Parameters
img
the specified image to be drawn.
x
the x coordinate.
y
the y coordinate.
width
the width of the rectangle.
height
the height of the rectangle.
bgcolor
the background color to paint under the non-opaque portions of the image.
observer
object to be notified as more of the image is converted.
Description
Draws as much of the specified image as has already been scaled to fit inside the specified rectangle.

The image is drawn inside the specified rectangle of this graphics context's coordinate space, and is scaled if necessary. Transparent pixels are drawn in the specified background color. This operation is equivalent to filling a rectangle of the width and height of the specified image with the given color and then drawing the image on top of it, but possibly more efficient.

This method returns immediately in all cases, even if the entire image has not yet been scaled, dithered, and converted for the current output device. If the current output representation is not yet complete then drawImage returns false. As more of the image becomes available, the process that draws the image notifies the specified image observer.

A scaled version of an image will not necessarily be available immediately just because an unscaled version of the image has been constructed for this output device. Each size of the image may be cached separately and generated from the original data in a separate image production sequence.

See Also
Image, ImageObserver, imageUpdate

Syntax 5
public abstract boolean drawImage( Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer )
Parameters
img
the specified image to be drawn
dx1
the x coordinate of the first corner of the destination rectangle.
dy1
the y coordinate of the first corner of the destination rectangle.
dx2
the x coordinate of the second corner of the destination rectangle.
dy2
the y coordinate of the second corner of the destination rectangle.
sx1
the x coordinate of the first corner of the source rectangle.
sy1
the y coordinate of the first corner of the source rectangle.
sx2
the x coordinate of the second corner of the source rectangle.
sy2
the y coordinate of the second corner of the source rectangle.
observer
object to be notified as more of the image is scaled and converted.
Description
Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface. Transparent pixels do not affect whatever pixels are already there.

This method returns immediately in all cases, even if the image area to be drawn has not yet been scaled, dithered, and converted for the current output device. If the current output representation is not yet complete then drawImage returns false. As more of the image becomes available, the process that draws the image notifies the specified image observer.

This method always uses the unscaled version of the image to render the scaled rectangle and performs the required scaling on the fly. It does not use a cached, scaled version of the image for this operation. Scaling of the image from source to destination is performed such that the first coordinate of the source rectangle is mapped to the first coordinate of the destination rectangle, and the second source coordinate is mapped to the second destination coordinate. The subimage is scaled and flipped as needed to preserve those mappings.

See Also
Image, ImageObserver, imageUpdate

Syntax 6
public abstract boolean drawImage( Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer )
Parameters
img
the specified image to be drawn
dx1
the x coordinate of the first corner of the destination rectangle.
dy1
the y coordinate of the first corner of the destination rectangle.
dx2
the x coordinate of the second corner of the destination rectangle.
dy2
the y coordinate of the second corner of the destination rectangle.
sx1
the x coordinate of the first corner of the source rectangle.
sy1
the y coordinate of the first corner of the source rectangle.
sx2
the x coordinate of the second corner of the source rectangle.
sy2
the y coordinate of the second corner of the source rectangle.
bgcolor
the background color to paint under the non-opaque portions of the image.
observer
object to be notified as more of the image is scaled and converted.
Description
Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface.

Transparent pixels are drawn in the specified background color. This operation is equivalent to filling a rectangle of the width and height of the specified image with the given color and then drawing the image on top of it, but possibly more efficient.

This method returns immediately in all cases, even if the image area to be drawn has not yet been scaled, dithered, and converted for the current output device. If the current output representation is not yet complete then drawImage returns false. As more of the image becomes available, the process that draws the image notifies the specified image observer.

This method always uses the unscaled version of the image to render the scaled rectangle and performs the required scaling on the fly. It does not use a cached, scaled version of the image for this operation. Scaling of the image from source to destination is performed such that the first coordinate of the source rectangle is mapped to the first coordinate of the destination rectangle, and the second source coordinate is mapped to the second destination coordinate. The subimage is scaled and flipped as needed to preserve those mappings.

See Also
Image, ImageObserver, imageUpdate


 Graphics.drawLine

Graphics.drawLine

Syntax
public abstract void drawLine( int x1, int y1, int x2, int y2 )
Parameters
x1
the first point's x coordinate.
y1
the first point's y coordinate.
x2
the second point's x coordinate.
y2
the second point's y coordinate.
Description
Draws a line, using the current color, between the points (x1, y1) and (x2, y2) in this graphics context's coordinate system.


 Graphics.drawOval

Graphics.drawOval

Syntax
public abstract void drawOval( int x, int y, int width, int height )
Parameters
x
the x coordinate of the upper left corner of the oval to be drawn.
y
the y coordinate of the upper left corner of the oval to be drawn.
width
the width of the oval to be drawn.
height
the height of the oval to be drawn.
Description
Draws the outline of an oval. The result is a circle or ellipse that fits within the rectangle specified by the x, y, width, and height arguments.

The oval covers an area that is width + 1 pixels wide and height + 1 pixels tall.

See Also
fillOval


 Graphics.drawPolygon

Graphics.drawPolygon

Syntax 1
public abstract void drawPolygon( int xPoints[], int yPoints[], int nPoints )
Parameters
xPoints
a an array of x coordinates.
yPoints
a an array of y coordinates.
nPoints
a the total number of points.
Description
Draws a closed polygon defined by arrays of x and y coordinates. Each pair of (x, y) coordinates defines a point.

This method draws the polygon defined by nPoint line segments, where the first nPoint - 1 line segments are line segments from (xPoints[i - 1], yPoints[i - 1]) to (xPoints[i], yPoints[i]), for 1 ≤ i ≤ nPoints. The figure is automatically closed by drawing a line connecting the final point to the first point, if those points are different.

See Also
fillPolygon, drawPolyline

Syntax 2
public void drawPolygon( Polygon p )
Parameters
p
the polygon to draw.
Description
Draws the outline of a polygon defined by the specified Polygon object.

See Also
fillPolygon, drawPolyline


 Graphics.drawPolyline

Graphics.drawPolyline

Syntax
public abstract void drawPolyline( int xPoints[], int yPoints[], int nPoints )
Parameters
xPoints
an array of x points
yPoints
an array of y points
nPoints
the total number of points
Description
Draws a sequence of connected lines defined by arrays of x and y coordinates. Each pair of (x, y) coordinates defines a point. The figure is not closed if the first point differs from the last point.

See Also
drawPolygon


 Graphics.drawRect

Graphics.drawRect

Syntax
public void drawRect( int x, int y, int width, int height )
Parameters
x
the x coordinate of the rectangle to be drawn.
y
the y coordinate of the rectangle to be drawn.
width
the width of the rectangle to be drawn.
height
the height of the rectangle to be drawn.
Description
Draws the outline of the specified rectangle. The left and right edges of the rectangle are at x and x + width. The top and bottom edges are at y and y + height. The rectangle is drawn using the graphics context's current color.

See Also
fillRect, clearRect


 Graphics.drawRoundRect

Graphics.drawRoundRect

Syntax
public abstract void drawRoundRect( int x, int y, int width, int height, int arcWidth, int arcHeight )
Parameters
x
the x coordinate of the rectangle to be drawn.
y
the y coordinate of the rectangle to be drawn.
width
the width of the rectangle to be drawn.
height
the height of the rectangle to be drawn.
arcWidth
the horizontal diameter of the arc at the four corners.
arcHeight
the vertical diameter of the arc at the four corners.
Description
Draws an outlined round-cornered rectangle using this graphics context's current color. The left and right edges of the rectangle are at x and x + width, respectively. The top and bottom edges of the rectangle are at y and y + height.

See Also
fillRoundRect


 Graphics.drawString

Graphics.drawString

Syntax
public abstract void drawString( String str, int x, int y )
Parameters
str
the string to be drawn.
x
the x coordinate.
y
the y coordinate.
Description
Draws the text given by the specified string, using this graphics context's current font and color. The baseline of the first character is at position (x, y) in this graphics context's coordinate system.

See Also
drawBytes, drawChars


 Graphics.fill3DRect

Graphics.fill3DRect

Syntax
public void fill3DRect( int x, int y, int width, int height, boolean raised )
Parameters
x
the x coordinate of the rectangle to be filled.
y
the y coordinate of the rectangle to be filled.
width
the width of the rectangle to be filled.
height
the height of the rectangle to be filled.
raised
a boolean value that determines whether the rectangle appears to be raised above the surface or etched into the surface.
Description
Paints a 3-D highlighted rectangle filled with the current color. The edges of the rectangle will be highlighted so that it appears as if the edges were beveled and lit from the upper left corner. The colors used for the highlighting effect will be determined from the current color.

See Also
draw3DRect


 Graphics.fillArc

Graphics.fillArc

Syntax
public abstract void fillArc( int x, int y, int width, int height, int startAngle, int arcAngle )
Parameters
x
the x coordinate of the upper-left corner of the arc to be filled.
y
the y coordinate of the upper-left corner of the arc to be filled.
width
the width of the arc to be filled.
height
the height of the arc to be filled.
startAngle
the beginning angle.
arcAngle
the angular extent of the arc, relative to the start angle.
Description
Fills a circular or elliptical arc covering the specified rectangle.

The resulting arc begins at startAngle and extends for arcAngle degrees. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.

The center of the arc is the center of the rectangle whose origin is (x, y) and whose size is specified by the width and height arguments.

The resulting arc covers an area width + 1 pixels wide by height + 1 pixels tall.

See Also
drawArc


 Graphics.fillOval

Graphics.fillOval

Syntax
public abstract void fillOval( int x, int y, int width, int height )
Parameters
x
the x coordinate of the upper left corner of the oval to be filled.
y
the y coordinate of the upper left corner of the oval to be filled.
width
the width of the oval to be filled.
height
the height of the oval to be filled.
Description
Fills an oval bounded by the specified rectangle with the current color.

See Also
drawOval


 Graphics.fillPolygon

Graphics.fillPolygon

Syntax 1
public abstract void fillPolygon( int xPoints[], int yPoints[], int nPoints )
Parameters
xPoints
a an array of x coordinates.
yPoints
a an array of y coordinates.
nPoints
a the total number of points.
Description
Fills a closed polygon defined by arrays of x and y coordinates.

This method draws the polygon defined by nPoint line segments, where the first nPoint - 1 line segments are line segments from (xPoints[i - 1], yPoints[i - 1]) to (xPoints[i], yPoints[i]), for 1 ≤ i ≤ nPoints. The figure is automatically closed by drawing a line connecting the final point to the first point, if those points are different.

The area inside the polygon is defined using an even-odd fill rule, also known as the alternating rule.

See Also
drawPolygon

Syntax 2
public void fillPolygon( Polygon p )
Parameters
p
the polygon to fill.
Description
Fills the polygon defined by the specified Polygon object with the graphics context's current color.

The area inside the polygon is defined using an even-odd fill rule, also known as the alternating rule.

See Also
drawPolygon


 Graphics.fillRect

Graphics.fillRect

Syntax
public abstract void fillRect( int x, int y, int width, int height )
Parameters
x
the x coordinate of the rectangle to be filled.
y
the y coordinate of the rectangle to be filled.
width
the width of the rectangle to be filled.
height
the height of the rectangle to be filled.
Description
Fills the specified rectangle. The left and right edges of the rectangle are at x and x + width - 1. The top and bottom edges are at y and y + height - 1. The resulting rectangle covers an area width pixels wide by height pixels tall. The rectangle is filled using the graphics context's current color.

See Also
fillRect, clearRect


 Graphics.fillRoundRect

Graphics.fillRoundRect

Syntax
public abstract void fillRoundRect( int x, int y, int width, int height, int arcWidth, int arcHeight )
Parameters
x
the x coordinate of the rectangle to be filled.
y
the y coordinate of the rectangle to be filled.
width
the width of the rectangle to be filled.
height
the height of the rectangle to be filled.
arcWidth
the horizontal diameter of the arc at the four corners.
arcHeight
the vertical diameter of the arc at the four corners.
Description
Fills the specified rounded corner rectangle with the current color. The left and right edges of the rectangle are at x and x + width - 1, respectively. The top and bottom edges of the rectangle are at y and y + height - 1.

See Also
drawRoundRect


 Graphics.finalize

Graphics.finalize

Syntax
public void finalize()
Description
Disposes of this graphics context once it is no longer referenced.

Overrides
finalize in class Object
See Also
dispose


 Graphics.getClip

Graphics.getClip

Syntax
public abstract Shape getClip()
Returns
a Shape object representing the current clipping area.
Description
Gets the current clipping area.

See Also
getClipBounds, clipRect, setClip, setClip


 Graphics.getClipBounds

Graphics.getClipBounds

Syntax
public abstract Rectangle getClipBounds()
Returns
the bounding rectangle of the current clipping area.
Description
Returns the bounding rectangle of the current clipping area. The coordinates in the rectangle are relative to the coordinate system origin of this graphics context.

See Also
getClip, clipRect, setClip, setClip


 Graphics.getClipRect

Graphics.getClipRect

Syntax
public Rectangle getClipRect()
Description
Note: getClipRect() is deprecated. As of JDK version 1.1, replaced by getClipBounds().


 Graphics.getColor

Graphics.getColor

Syntax
public abstract Color getColor()
Returns
this graphics context's current color.
Description
Gets this graphics context's current color.

See Also
Color, setColor


 Graphics.getFont

Graphics.getFont

Syntax
public abstract Font getFont()
Returns
this graphics context's current font.
Description
Gets the current font.

See Also
Font, setFont


 Graphics.getFontMetrics

Graphics.getFontMetrics

Syntax 1
public FontMetrics getFontMetrics()
Returns
the font metrics of this graphics context's current font.
Description
Gets the font metrics of the current font.

See Also
getFont, FontMetrics, getFontMetrics

Syntax 2
public abstract FontMetrics getFontMetrics( Font f )
Parameters
f
the specified font
Returns
the font metrics for the specified font.
Description
Gets the font metrics for the specified font.

See Also
getFont, FontMetrics, getFontMetrics


 Graphics.setClip

Graphics.setClip

Syntax
public abstract void setClip( int x, int y, int width, int height )
Parameters
x
the x coordinate of the new clip rectangle.
y
the y coordinate of the new clip rectangle.
width
the width of the new clip rectangle.
height
the height of the new clip rectangle.
Description
Sets the current clip to the rectangle specified by the given coordinates. Rendering operations have no effect outside of the clipping area.

See Also
clipRect, setClip


 Graphics.setClip

Graphics.setClip

Syntax
public abstract void setClip( Shape clip )
Description
Sets the current clipping area to an arbitrary clip shape. Not all objects which implement the Shape interface can be used to set the clip. The only Shape objects which are guaranteed to be supported are Shape objects which are obtained via the getClip method and via Rectangle objects.

See Also
getClip, clipRect, setClip


 Graphics.setColor

Graphics.setColor

Syntax
public abstract void setColor( Color c )
Parameters
c
the new rendering color.
Description
Sets this graphics context's current color to the specified color. All subsequent graphics operations using this graphics context use this specified color.

See Also
Color, getColor


 Graphics.setFont

Graphics.setFont

Syntax
public abstract void setFont( Font font )
Parameters
font
the font.
Description
Sets this graphics context's font to the specified font. All subsequent text operations using this graphics context use this font.

See Also
getFont, drawChars, drawString, drawBytes


 Graphics.setPaintMode

Graphics.setPaintMode

Syntax
public abstract void setPaintMode()
Description
Sets the paint mode of this graphics context to overwrite the destination with this graphics context's current color. This sets the logical pixel operation function to the paint or overwrite mode. All subsequent rendering operations will overwrite the destination with the current color.


 Graphics.setXORMode

Graphics.setXORMode

Syntax
public abstract void setXORMode( Color c1 )
Parameters
c1
the XOR alternation color
Description
Sets the paint mode of this graphics context to alternate between this graphics context's current color and the new specified color. This specifies that logical pixel operations are performed in the XOR mode, which alternates pixels between the current color and a specified XOR color.

When drawing operations are performed, pixels which are the current color are changed to the specified color, and vice versa.

Pixels that are of colors other than those two colors are changed in an unpredictable but reversible manner; if the same figure is drawn twice, then all pixels are restored to their original values.


 Graphics.toString

Graphics.toString

Syntax
public String toString()
Returns
a string representation of this graphics context.
Description
Returns a String object representing this Graphics object's value.

Overrides
toString in class Object


 Graphics.translate

Graphics.translate

Syntax
public abstract void translate( int x, int y )
Parameters
x
the x coordinate.
y
the y coordinate.
Description
Translates the origin of the graphics context to the point (x, y) in the current coordinate system. Modifies this graphics context so that its new origin corresponds to the point (x, y) in this graphics context's original coordinate system. All coordinates used in subsequent rendering operations on this graphics context will be relative to this new origin.


 Class GridBagConstraints

Class java.awt.GridBagConstraints

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.GridBagConstraints

public class GridBagConstraints
extends Object
implements Cloneable, Serializable

The GridBagConstraints class specifies constraints for components that are laid out using the GridBagLayout class.

See Also:
GridBagLayout


 GridBagConstraints Members

GridBagConstraints Members

Class Overview | This Package | All Packages

Fields
Name | Description
anchor | This field is used when the component is smaller than its display area.
BOTH | Resize the component both horizontally and vertically.
CENTER | Put the component in the center of its display area.
EAST | Put the component on the left side of its display area, centered vertically.
fill | This field is used when the component's display area is larger than the component's requested size.
gridheight | Specifies the number of cells in a column for the component's display area.
gridwidth | Specifies the number of cells in a row for the component's display area.
gridx | Specifies the cell at the left of the component's display area, where the leftmost cell has gridx = 0.
gridy | Specifies the cell at the top of the component's display area, where the topmost cell has gridy = 0.
HORIZONTAL | Resize the component horizontally but not vertically.
insets | This field specifies the external padding of the component, the minimum amount of space between the component and the edges of its display area.
ipadx | This field specifies the internal padding of the component, how much space to add to the minimum width of the component.
ipady | This field specifies the internal padding, that is, how much space to add to the minimum height of the component.
NONE | Do not resize the component.
NORTH | Put the component at the top of its display area, centered horizontally.
NORTHEAST | Put the component at the top-right corner of its display area.
NORTHWEST | Put the component at the top-left corner of its display area.
RELATIVE | Specify that this component is the next-to-last component in its column or row (gridwidth, gridheight), or that this component be placed next to the previously added component (gridx, gridy).
REMAINDER | Specify that this component is the last component in its column or row.
SOUTH | Put the component at the bottom of its display area, centered horizontally.
SOUTHEAST | Put the component at the bottom-right corner of its display area.
SOUTHWEST | Put the component at the bottom-left corner of its display area.
VERTICAL | Resize the component vertically but not horizontally.
weightx | Specifies how to distribute extra horizontal space.
weighty | Specifies how to distribute extra vertical space.
WEST | Put the component on the left side of its display area, centered vertically.

Constructors
Name | Description
GridBagConstraints() | Creates a GridBagConstraint object with all of its fields set to their default value.

Methods
Name | Description
clone() | Creates a copy of this grid bag constraint.


 GridBagConstraints.anchor

GridBagConstraints.anchor

Syntax
public int anchor
Description
This field is used when the component is smaller than its display area. It determines where, within the display area, to place the component. Possible values are CENTER, NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, and NORTHWEST. The default value is CENTER.


 GridBagConstraints.BOTH

GridBagConstraints.BOTH

Syntax
public static final int BOTH
Description
Resize the component both horizontally and vertically.


 GridBagConstraints.CENTER

GridBagConstraints.CENTER

Syntax
public static final int CENTER
Description
Put the component in the center of its display area.


 GridBagConstraints.EAST

GridBagConstraints.EAST

Syntax
public static final int EAST
Description
Put the component on the left side of its display area, centered vertically.


 GridBagConstraints.fill

GridBagConstraints.fill

Syntax
public int fill
Description
This field is used when the component's display area is larger than the component's requested size. It determines whether to resize the component, and if so, how.

The following values are valid for fill:

  • NONE: Do not resize the component.
  • HORIZONTAL: Make the component wide enough to fill its display area horizontally, but do not change its height.
  • VERTICAL: Make the component tall enough to fill its display area vertically, but do not change its width.
  • BOTH: Make the component fill its display area entirely.

The default value is NONE.


 GridBagConstraints.gridheight

GridBagConstraints.gridheight

Syntax
public int gridheight
Description
Specifies the number of cells in a column for the component's display area.

Use REMAINDER to specify that the component be the last one in its column. Use RELATIVE to specify that the component be the next-to-last one in its column.

The default value is 1.

See Also
gridwidth


 GridBagConstraints.gridwidth

GridBagConstraints.gridwidth

Syntax
public int gridwidth
Description
Specifies the number of cells in a row for the component's display area.

Use REMAINDER to specify that the component be the last one in its row. Use RELATIVE to specify that the component be the next-to-last one in its row.

The default value is 1.

See Also
gridheight


 GridBagConstraints.gridx

GridBagConstraints.gridx

Syntax
public int gridx
Description
Specifies the cell at the left of the component's display area, where the leftmost cell has gridx = 0. The value RELATIVE specifies that the component be placed just to the right of the component that was added to the container just before this component was added.

The default value is RELATIVE.

See Also
gridy


 GridBagConstraints.gridy

GridBagConstraints.gridy

Syntax
public int gridy
Description
Specifies the cell at the top of the component's display area, where the topmost cell has gridy = 0. The value RELATIVE specifies that the component be placed just below the component that was added to the container just before this component was added.

The default value is RELATIVE.

See Also
gridx


 GridBagConstraints.HORIZONTAL

GridBagConstraints.HORIZONTAL

Syntax
public static final int HORIZONTAL
Description
Resize the component horizontally but not vertically.


 GridBagConstraints.insets

GridBagConstraints.insets

Syntax
public Insets insets
Description
This field specifies the external padding of the component, the minimum amount of space between the component and the edges of its display area.

The default value is new Insets(0, 0, 0, 0).


 GridBagConstraints.ipadx

GridBagConstraints.ipadx

Syntax
public int ipadx
Description
This field specifies the internal padding of the component, how much space to add to the minimum width of the component. The width of the component is at least its minimum width plus (ipadx * 2) pixels.

The default value is 0.

See Also
ipady


 GridBagConstraints.ipady

GridBagConstraints.ipady

Syntax
public int ipady
Description
This field specifies the internal padding, that is, how much space to add to the minimum height of the component. The height of the component is at least its minimum height plus (ipady * 2) pixels.

The default value is 0.

See Also
ipadx


 GridBagConstraints.NONE

GridBagConstraints.NONE

Syntax
public static final int NONE
Description
Do not resize the component.


 GridBagConstraints.NORTH

GridBagConstraints.NORTH

Syntax
public static final int NORTH
Description
Put the component at the top of its display area, centered horizontally.


 GridBagConstraints.NORTHEAST

GridBagConstraints.NORTHEAST

Syntax
public static final int NORTHEAST
Description
Put the component at the top-right corner of its display area.


 GridBagConstraints.NORTHWEST

GridBagConstraints.NORTHWEST

Syntax
public static final int NORTHWEST
Description
Put the component at the top-left corner of its display area.


 GridBagConstraints.RELATIVE

GridBagConstraints.RELATIVE

Syntax
public static final int RELATIVE
Description
Specify that this component is the next-to-last component in its column or row (gridwidth, gridheight), or that this component be placed next to the previously added component (gridx, gridy).

See Also
gridwidth, gridheight, gridx, gridy


 GridBagConstraints.REMAINDER

GridBagConstraints.REMAINDER

Syntax
public static final int REMAINDER
Description
Specify that this component is the last component in its column or row.


 GridBagConstraints.SOUTH

GridBagConstraints.SOUTH

Syntax
public static final int SOUTH
Description
Put the component at the bottom of its display area, centered horizontally.


 GridBagConstraints.SOUTHEAST

GridBagConstraints.SOUTHEAST

Syntax
public static final int SOUTHEAST
Description
Put the component at the bottom-right corner of its display area.


 GridBagConstraints.SOUTHWEST

GridBagConstraints.SOUTHWEST

Syntax
public static final int SOUTHWEST
Description
Put the component at the bottom-left corner of its display area.


 GridBagConstraints.VERTICAL

GridBagConstraints.VERTICAL

Syntax
public static final int VERTICAL
Description
Resize the component vertically but not horizontally.


 GridBagConstraints.weightx

GridBagConstraints.weightx

Syntax
public double weightx
Description
Specifies how to distribute extra horizontal space.

The grid bag layout manager calculates the weight of a column to be the maximum weighty of all the components in a row. If the resulting layout is smaller horizontally than the area it needs to fill, the extra space is distributed to each column in proportion to its weight. A column that has a weight zero receives no extra space.

If all the weights are zero, all the extra space appears between the grids of the cell and the left and right edges.

The default value of this field is 0.

See Also
weighty


 GridBagConstraints.weighty

GridBagConstraints.weighty

Syntax
public double weighty
Description
Specifies how to distribute extra vertical space.

The grid bag layout manager calculates the weight of a row to be the maximum weightx of all the components in a row. If the resulting layout is smaller vertically than the area it needs to fill, the extra space is distributed to each row in proportion to its weight. A row that has a weight of zero receives no extra space.

If all the weights are zero, all the extra space appears between the grids of the cell and the top and bottom edges.

The default value of this field is 0.

See Also
weightx


 GridBagConstraints.WEST

GridBagConstraints.WEST

Syntax
public static final int WEST
Description
Put the component on the left side of its display area, centered vertically.


 GridBagConstraints.GridBagConstraints

GridBagConstraints.GridBagConstraints

Syntax
public GridBagConstraints()
Description
Creates a GridBagConstraint object with all of its fields set to their default value.


 GridBagConstraints.clone

GridBagConstraints.clone

Syntax
public Object clone()
Returns
a copy of this grid bag constraint
Description
Creates a copy of this grid bag constraint.

Overrides
clone in class Object


 Class GridBagLayout

Class java.awt.GridBagLayout

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.GridBagLayout

public class GridBagLayout
extends Object
implements LayoutManager2, Serializable

The GridBagLayout class is a flexible layout manager that aligns components vertically and horizontally, without requiring that the components be of the same size. Each GridBagLayout object maintains a dynamic rectangular grid of cells, with each component occupying one or more cells, called its display area.

Each component managed by a grid bag layout is associated with an instance of GridBagConstraints that specifies how the component is laid out within its display area.

How a GridBagLayout object places a set of components depends on the GridBagConstraints object associated with each component, and on the minimum size and the preferred size of the components' containers.

To use a grid bag layout effectively, you must customize one or more of the GridBagConstraints objects that are associated with its components. You customize a GridBagConstraints object by setting one or more of its instance variables:

gridx, gridy
Specifies the cell at the upper left of the component's display area, where the upper-left-most cell has address gridx = 0, gridy = 0. Use GridBagConstraints.RELATIVE (the default value) to specify that the component be just placed just to the right of (for gridx) or just below (for gridy) the component that was added to the container just before this component was added.
gridwidth, gridheight
Specifies the number of cells in a row (for gridwidth) or column (for gridheight) in the component's display area. The default value is 1. Use GridBagConstraints.REMAINDER to specify that the component be the last one in its row (for gridwidth) or column (for gridheight). Use GridBagConstraints.RELATIVE to specify that the component be the next to last one in its row (for gridwidth) or column (for gridheight).
fill
Used when the component's display area is larger than the component's requested size to determine whether (and how) to resize the component. Possible values are GridBagConstraints.NONE (the default), GridBagConstraints.HORIZONTAL (make the component wide enough to fill its display area horizontally, but don't change its height), GridBagConstraints.VERTICAL (make the component tall enough to fill its display area vertically, but don't change its width), and GridBagConstraints.BOTH (make the component fill its display area entirely).
ipadx, ipady
Specifies the component's internal padding within the layout, how much to add to the minimum size of the component. The width of the component will be at least its minimum width plus (ipadx * 2) pixels (since the padding applies to both sides of the component). Similarly, the height of the component will be at least the minimum height plus (ipady * 2) pixels.
insets
Specifies the component's external padding, the minimum amount of space between the component and the edges of its display area.
anchor
Used when the component is smaller than its display area to determine where (within the display area) to place the component. Valid values are GridBagConstraints.CENTER (the default), GridBagConstraints.NORTH, GridBagConstraints.NORTHEAST, GridBagConstraints.EAST, GridBagConstraints.SOUTHEAST, GridBagConstraints.SOUTH, GridBagConstraints.SOUTHWEST, GridBagConstraints.WEST, and GridBagConstraints.NORTHWEST.
weightx, weighty
Used to determine how to distribute space, which is important for specifying resizing behavior. Unless you specify a weight for at least one component in a row (weightx) and column (weighty), all the components clump together in the center of their container. This is because when the weight is zero (the default), the GridBagLayout object puts any extra space between its grid of cells and the edges of the container.

The following figure shows ten components (all buttons) managed by a grid bag layout:

Each of the ten components has the fill field of its associated GridBagConstraints object set to GridBagConstraints.BOTH. In addition, the components have the following non-default constraints:

  • Button1, Button2, Button3: weightx = 1.0
  • Button4: weightx = 1.0, gridwidth = GridBagConstraints.REMAINDER
  • Button5: gridwidth = GridBagConstraints.REMAINDER
  • Button6: gridwidth = GridBagConstraints.RELATIVE
  • Button7: gridwidth = GridBagConstraints.REMAINDER
  • Button8: gridheight = 2, weighty = 1.0
  • Button9, Button 10: gridwidth = GridBagConstraints.REMAINDER

Here is the code that implements the example shown above:

 import java.awt.*;
 import java.util.*;
 import java.applet.Applet;
 public class GridBagEx1 extends Applet {
     protected void makebutton(String name,
                               GridBagLayout gridbag,
                               GridBagConstraints c) {
         Button button = new Button(name);
         gridbag.setConstraints(button, c);
         add(button);
     }
     public void init() {
         GridBagLayout gridbag = new GridBagLayout();
         GridBagConstraints c = new GridBagConstraints();
         setFont(new Font("Helvetica", Font.PLAIN, 14));
         setLayout(gridbag);
         c.fill = GridBagConstraints.BOTH;
         c.weightx = 1.0;
         makebutton("Button1", gridbag, c);
         makebutton("Button2", gridbag, c);
         makebutton("Button3", gridbag, c);
            c.gridwidth = GridBagConstraints.REMAINDER; //end row
         makebutton("Button4", gridbag, c);
         c.weightx = 0.0;		   //reset to the default
         makebutton("Button5", gridbag, c); //another row
        c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last in row
         makebutton("Button6", gridbag, c);
        c.gridwidth = GridBagConstraints.REMAINDER; //end row
         makebutton("Button7", gridbag, c);
        c.gridwidth = 1;	   	   //reset to the default
        c.gridheight = 2;
         c.weighty = 1.0;
         makebutton("Button8", gridbag, c);
         c.weighty = 0.0;		   //reset to the default
        c.gridwidth = GridBagConstraints.REMAINDER; //end row
        c.gridheight = 1;		   //reset to the default
         makebutton("Button9", gridbag, c);
         makebutton("Button10", gridbag, c);
         setSize(300, 100);
     }
     public static void main(String args[]) {
        Frame f = new Frame("GridBag Layout Example");
        GridBagEx1 ex1 = new GridBagEx1();
        ex1.init();
        f.add("Center", ex1);
        f.pack();
        f.setSize(f.getPreferredSize());
        f.show();
     }
 }

See Also:
GridBagConstraints


 GridBagLayout Members

GridBagLayout Members

Class Overview | This Package | All Packages

Fields
Name | Description
columnWeights |
columnWidths |
comptable |
defaultConstraints |
layoutInfo |
MAXGRIDSIZE | The maximum number of grid positions (both horizontally and vertically) that can be laid out by the grid bag layout.
MINSIZE | The smallest grid that can be laid out by the grid bag layout.
PREFERREDSIZE |
rowHeights |
rowWeights |

Constructors
Name | Description
GridBagLayout() | Creates a grid bag layout manager.

Methods
Name | Description
addLayoutComponent(Component, Object) | Adds the specified component to the layout, using the specified constraint object.
addLayoutComponent(String, Component) | Adds the specified component with the specified name to the layout.
AdjustForGravity(GridBagConstraints, Rectangle) |
ArrangeGrid(Container) |
getConstraints(Component) | Gets the constraints for the specified component.
getLayoutAlignmentX(Container) | Returns the alignment along the x axis.
getLayoutAlignmentY(Container) | Returns the alignment along the y axis.
getLayoutDimensions() | Determines column widths and row heights for the layout grid.
GetLayoutInfo(Container, int) | Print the layout constraints.
getLayoutOrigin() | Determines the origin of the layout grid.
getLayoutWeights() | Determines the weights of the layout grid's columns and rows.
GetMinSize(Container, GridBagLayoutInfo) |
invalidateLayout(Container) | Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
layoutContainer(Container) | Lays out the specified container using this grid bag layout.
location(int, int) | Determines which cell in the layout grid contains the point specified by (x, y).
lookupConstraints(Component) | Retrieves the constraints for the specified component.
maximumLayoutSize(Container) | Returns the maximum dimensions for this layout given the components in the specified target container.
minimumLayoutSize(Container) | Determines the minimum size of the target container using this grid bag layout.
preferredLayoutSize(Container) | Determines the preferred size of the target container using this grid bag layout.
removeLayoutComponent(Component) | Removes the specified component from this layout.
setConstraints(Component, GridBagConstraints) | Sets the constraints for the specified component in this layout.
toString() | Returns a string representation of this grid bag layout's values.


 GridBagLayout.columnWeights

GridBagLayout.columnWeights

Syntax
public double columnWeights[]


 GridBagLayout.columnWidths

GridBagLayout.columnWidths

Syntax
public int columnWidths[]


 GridBagLayout.comptable

GridBagLayout.comptable

Syntax
protected Hashtable comptable


 GridBagLayout.defaultConstraints

GridBagLayout.defaultConstraints

Syntax
protected GridBagConstraints defaultConstraints


 GridBagLayout.layoutInfo

GridBagLayout.layoutInfo

Syntax
protected GridBagLayoutInfo layoutInfo


 GridBagLayout.MAXGRIDSIZE

GridBagLayout.MAXGRIDSIZE

Syntax
protected static final int MAXGRIDSIZE
Description
The maximum number of grid positions (both horizontally and vertically) that can be laid out by the grid bag layout.


 GridBagLayout.MINSIZE

GridBagLayout.MINSIZE

Syntax
protected static final int MINSIZE
Description
The smallest grid that can be laid out by the grid bag layout.


 GridBagLayout.PREFERREDSIZE

GridBagLayout.PREFERREDSIZE

Syntax
protected static final int PREFERREDSIZE


 GridBagLayout.rowHeights

GridBagLayout.rowHeights

Syntax
public int rowHeights[]


 GridBagLayout.rowWeights

GridBagLayout.rowWeights

Syntax
public double rowWeights[]


 GridBagLayout.GridBagLayout

GridBagLayout.GridBagLayout

Syntax
public GridBagLayout()
Description
Creates a grid bag layout manager.


 GridBagLayout.addLayoutComponent

GridBagLayout.addLayoutComponent

Syntax 1
public void addLayoutComponent( String name, Component comp )
Parameters
name
the name of the component.
comp
the component to be added.
Description
Adds the specified component with the specified name to the layout.

Syntax 2
public void addLayoutComponent( Component comp, Object constraints )
Parameters
comp
the component to be added.
constraints
an object that determines how the component is added to the layout.
Description
Adds the specified component to the layout, using the specified constraint object.


 GridBagLayout.AdjustForGravity

GridBagLayout.AdjustForGravity

Syntax
protected void AdjustForGravity( GridBagConstraints constraints, Rectangle r )


 GridBagLayout.ArrangeGrid

GridBagLayout.ArrangeGrid

Syntax
protected void ArrangeGrid( Container parent )


 GridBagLayout.getConstraints

GridBagLayout.getConstraints

Syntax
public GridBagConstraints getConstraints( Component comp )
Parameters
comp
the component to be queried.
Returns
the constraint for the specified component in this grid bag layout; a copy of the actual constraint object is returned.
Description
Gets the constraints for the specified component. A copy of the actual GridBagConstraints object is returned.


 GridBagLayout.getLayoutAlignmentX

GridBagLayout.getLayoutAlignmentX

Syntax
public float getLayoutAlignmentX( Container parent )
Description
Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.


 GridBagLayout.getLayoutAlignmentY

GridBagLayout.getLayoutAlignmentY

Syntax
public float getLayoutAlignmentY( Container parent )
Description
Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.


 GridBagLayout.getLayoutDimensions

GridBagLayout.getLayoutDimensions

Syntax
public int[][] getLayoutDimensions()
Returns
an array of two arrays, containing the widths of the layout columns and the heights of the layout rows.
Description
Determines column widths and row heights for the layout grid.

Most applications do not call this method directly.


 GridBagLayout.GetLayoutInfo

GridBagLayout.GetLayoutInfo

Syntax
protected GridBagLayoutInfo GetLayoutInfo( Container parent, int sizeflag )
Description
Print the layout constraints. Useful for debugging.


 GridBagLayout.getLayoutOrigin

GridBagLayout.getLayoutOrigin

Syntax
public Point getLayoutOrigin()
Returns
the origin of the cell in the top-left corner of the layout grid.
Description
Determines the origin of the layout grid. Most applications do not call this method directly.


 GridBagLayout.getLayoutWeights

GridBagLayout.getLayoutWeights

Syntax
public double[][] getLayoutWeights()
Returns
an array of two arrays, representing the horizontal weights of the layout columns and the vertical weights of the layout rows.
Description
Determines the weights of the layout grid's columns and rows. Weights are used to calculate how much a given column or row stretches beyond its preferred size, if the layout has extra room to fill.

Most applications do not call this method directly.


 GridBagLayout.GetMinSize

GridBagLayout.GetMinSize

Syntax
protected Dimension GetMinSize( Container parent, GridBagLayoutInfo info )


 GridBagLayout.invalidateLayout

GridBagLayout.invalidateLayout

Syntax
public void invalidateLayout( Container target )
Description
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.


 GridBagLayout.layoutContainer

GridBagLayout.layoutContainer

Syntax
public void layoutContainer( Container parent )
Parameters
parent
the container in which to do the layout.
Description
Lays out the specified container using this grid bag layout. This method reshapes components in the specified container in order to satisfy the contraints of this GridBagLayout object.

Most applications do not call this method directly.

See Also
Container, doLayout


 GridBagLayout.location

GridBagLayout.location

Syntax
public Point location( int x, int y )
Parameters
x
the x coordinate of a point.
y
the y coordinate of a point.
Returns
an ordered pair of indexes that indicate which cell in the layout grid contains the point (x, y).
Description
Determines which cell in the layout grid contains the point specified by (x, y). Each cell is identified by its column index (ranging from 0 to the number of columns minus 1) and its row index (ranging from 0 to the number of rows minus 1).

If the (x, y) point lies outside the grid, the following rules are used. The column index is returned as zero if x lies to the left of the layout, and as the number of columns if x lies to the right of the layout. The row index is returned as zero if y lies above the layout, and as the number of rows if y lies below the layout.


 GridBagLayout.lookupConstraints

GridBagLayout.lookupConstraints

Syntax
protected GridBagConstraints lookupConstraints( Component comp )
Parameters
comp
the component to be queried
Returns
the contraints for the specified component.
Description
Retrieves the constraints for the specified component. The return value is not a copy, but is the actual GridBagConstraints object used by the layout mechanism.


 GridBagLayout.maximumLayoutSize

GridBagLayout.maximumLayoutSize

Syntax
public Dimension maximumLayoutSize( Container target )
Parameters
target
the component which needs to be laid out
Description
Returns the maximum dimensions for this layout given the components in the specified target container.

See Also
Container, minimumLayoutSize, preferredLayoutSize


 GridBagLayout.minimumLayoutSize

GridBagLayout.minimumLayoutSize

Syntax
public Dimension minimumLayoutSize( Container parent )
Parameters
target
the container in which to do the layout.
Description
Determines the minimum size of the target container using this grid bag layout.

Most applications do not call this method directly.

See Also
doLayout


 GridBagLayout.preferredLayoutSize

GridBagLayout.preferredLayoutSize

Syntax
public Dimension preferredLayoutSize( Container parent )
Parameters
target
the container in which to do the layout.
Description
Determines the preferred size of the target container using this grid bag layout.

Most applications do not call this method directly.

See Also
getPreferredSize


 GridBagLayout.removeLayoutComponent

GridBagLayout.removeLayoutComponent

Syntax
public void removeLayoutComponent( Component comp )
Parameters
comp
the component to be removed.
Description
Removes the specified component from this layout.

Most applications do not call this method directly.

See Also
remove, removeAll


 GridBagLayout.setConstraints

GridBagLayout.setConstraints

Syntax
public void setConstraints( Component comp, GridBagConstraints constraints )
Parameters
comp
the component to be modified.
constraints
the constraints to be applied.
Description
Sets the constraints for the specified component in this layout.


 GridBagLayout.toString

GridBagLayout.toString

Syntax
public String toString()
Returns
a string representation of this grid bag layout.
Description
Returns a string representation of this grid bag layout's values.

Overrides
toString in class Object


 Class GridLayout

Class java.awt.GridLayout

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.GridLayout

public class GridLayout
extends Object
implements LayoutManager, Serializable

The GridLayout class is a layout manager that lays out a container's components in a rectangular grid.

The container is divided into equal-sized rectangles, and one component is placed in each rectangle.

For example, the following is an applet that lays out six buttons into three rows and two columns:

 import java.awt.*;
 import java.applet.Applet;
 public class ButtonGrid extends Applet {
     public void init() {
         setLayout(new GridLayout(3,2));
         add(new Button("1"));
         add(new Button("2"));
         add(new Button("3"));
         add(new Button("4"));
         add(new Button("5"));
         add(new Button("6"));
     }
 }

It produces the following output:


 GridLayout Members

GridLayout Members

Class Overview | This Package | All Packages

Constructors
Name | Description
GridLayout() | Creates a grid layout with a default of one column per component, in a single row.
GridLayout(int, int) | Creates a grid layout with the specified number of rows and columns.
GridLayout(int, int, int, int) | Creates a grid layout with the specified number of rows and columns.

Methods
Name | Description
addLayoutComponent(String, Component) | Adds the specified component with the specified name to the layout.
getColumns() | Gets the number of columns in this layout.
getHgap() | Gets the horizontal gap between components.
getRows() | Gets the number of rows in this layout.
getVgap() | Gets the vertical gap between components.
layoutContainer(Container) | Lays out the specified container using this layout.
minimumLayoutSize(Container) | Determines the minimum size of the container argument using this grid layout.
preferredLayoutSize(Container) | Determines the preferred size of the container argument using this grid layout.
removeLayoutComponent(Component) | Removes the specified component from the layout.
setColumns(int) | Sets the number of columns in this layout to the specified value.
setHgap(int) | Sets the horizontal gap between components to the specified value.
setRows(int) | Sets the number of rows in this layout to the specified value.
setVgap(int) | Sets the vertical gap between components to the specified value.
toString() | Returns the string representation of this grid layout's values.


 GridLayout.GridLayout

GridLayout.GridLayout

Syntax 1
public GridLayout()
Description
Creates a grid layout with a default of one column per component, in a single row.

Syntax 2
public GridLayout( int rows, int cols )
Parameters
rows
the rows, with the value zero meaning any number of rows.
cols
the columns, with the value zero meaning any number of columns.
Description
Creates a grid layout with the specified number of rows and columns. All components in the layout are given equal size.

One, but not both, of rows and cols can be zero, which means that any number of objects can be placed in a row or in a column.

Syntax 3
public GridLayout( int rows, int cols, int hgap, int vgap )
Parameters
rows
the rows, with the value zero meaning any number of rows.
cols
the columns, with the value zero meaning any number of columns.
hgap
the horizontal gap.
vgap
the vertical gap.
Description
Creates a grid layout with the specified number of rows and columns. All components in the layout are given equal size.

In addition, the horizontal and vertical gaps are set to the specified values. Horizontal gaps are placed at the left and right edges, and between each of the columns. Vertical gaps are placed at the top and bottom edges, and between each of the rows.

One, but not both, of rows and cols can be zero, which means that any number of objects can be placed in a row or in a column.

Exceptions
IllegalArgumentException if the of rows or cols is invalid.


 GridLayout.addLayoutComponent

GridLayout.addLayoutComponent

Syntax
public void addLayoutComponent( String name, Component comp )
Parameters
name
the name of the component.
comp
the component to be added.
Description
Adds the specified component with the specified name to the layout.


 GridLayout.getColumns

GridLayout.getColumns

Syntax
public int getColumns()
Returns
the number of columns in this layout.
Description
Gets the number of columns in this layout.


 GridLayout.getHgap

GridLayout.getHgap

Syntax
public int getHgap()
Returns
the horizontal gap between components.
Description
Gets the horizontal gap between components.


 GridLayout.getRows

GridLayout.getRows

Syntax
public int getRows()
Returns
the number of rows in this layout.
Description
Gets the number of rows in this layout.


 GridLayout.getVgap

GridLayout.getVgap

Syntax
public int getVgap()
Returns
the vertical gap between components.
Description
Gets the vertical gap between components.


 GridLayout.layoutContainer

GridLayout.layoutContainer

Syntax
public void layoutContainer( Container parent )
Parameters
target
the container in which to do the layout.
Description
Lays out the specified container using this layout.

This method reshapes the components in the specified target container in order to satisfy the constraints of the GridLayout object.

The grid layout manager determines the size of individual components by dividing the free space in the container into equal-sized portions according to the number of rows and columns in the layout. The container's free space equals the container's size minus any insets and any specified horizontal or vertical gap. All components in a grid layout are given the same size.

See Also
Container, doLayout


 GridLayout.minimumLayoutSize

GridLayout.minimumLayoutSize

Syntax
public Dimension minimumLayoutSize( Container parent )
Parameters
target
the container in which to do the layout.
Returns
the minimum dimensions needed to lay out the subcomponents of the specified container.
Description
Determines the minimum size of the container argument using this grid layout.

The minimum width of a grid layout is the largest minimum width of any of the widths in the container times the number of columns, plus the horizontal padding times the number of columns plus one, plus the left and right insets of the target container.

The minimum height of a grid layout is the largest minimum height of any of the widths in the container times the number of rows, plus the vertical padding times the number of rows plus one, plus the top and left insets of the target container.

See Also
preferredLayoutSize, doLayout


 GridLayout.preferredLayoutSize

GridLayout.preferredLayoutSize

Syntax
public Dimension preferredLayoutSize( Container parent )
Parameters
target
the container in which to do the layout.
Returns
the preferred dimensions to lay out the subcomponents of the specified container.
Description
Determines the preferred size of the container argument using this grid layout.

The preferred width of a grid layout is the largest preferred width of any of the widths in the container times the number of columns, plus the horizontal padding times the number of columns plus one, plus the left and right insets of the target container.

The preferred height of a grid layout is the largest preferred height of any of the widths in the container times the number of rows, plus the vertical padding times the number of rows plus one, plus the top and left insets of the target container.

See Also
minimumLayoutSize, getPreferredSize


 GridLayout.removeLayoutComponent

GridLayout.removeLayoutComponent

Syntax
public void removeLayoutComponent( Component comp )
Parameters
comp
the component to be removed.
Description
Removes the specified component from the layout.


 GridLayout.setColumns

GridLayout.setColumns

Syntax
public void setColumns( int cols )
Parameters
cols
the number of columns in this layout.
Description
Sets the number of columns in this layout to the specified value.

Exceptions
IllegalArgumentException if the value of both rows and cols is set to zero.


 GridLayout.setHgap

GridLayout.setHgap

Syntax
public void setHgap( int hgap )
Parameters
hgap
the horizontal gap between components.
Description
Sets the horizontal gap between components to the specified value.


 GridLayout.setRows

GridLayout.setRows

Syntax
public void setRows( int rows )
Parameters
rows
the number of rows in this layout.
Description
Sets the number of rows in this layout to the specified value.

Exceptions
IllegalArgumentException if the value of both rows and cols is set to zero.


 GridLayout.setVgap

GridLayout.setVgap

Syntax
public void setVgap( int vgap )
Parameters
vgap
the vertical gap between components.
Description
Sets the vertical gap between components to the specified value.


 GridLayout.toString

GridLayout.toString

Syntax
public String toString()
Returns
a string representation of this grid layout.
Description
Returns the string representation of this grid layout's values.

Overrides
toString in class Object


 Class IllegalComponentStateException

Class java.awt.IllegalComponentStateException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.lang.IllegalStateException
                                   |
                                   +----java.awt.IllegalComponentStateException

public class IllegalComponentStateException
extends IllegalStateException

Signals that an AWT component is not in an appropriate state for the requested operation.


 IllegalComponentStateException Members

IllegalComponentStateException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
IllegalComponentStateException() | Constructs an IllegalComponentStateException with no detail message.
IllegalComponentStateException(String) | Constructs an IllegalComponentStateException with the specified detail message.


 IllegalComponentStateException.IllegalComponentStateException

IllegalComponentStateException.IllegalComponentStateException

Class Overview | Class Members | This Package | All Packages

Syntax 1
public IllegalComponentStateException()
Description
Constructs an IllegalComponentStateException with no detail message. A detail message is a String that describes this particular exception.

Syntax 2
public IllegalComponentStateException( String s )
Parameters
s
the String that contains a detailed message
Description
Constructs an IllegalComponentStateException with the specified detail message. A detail message is a String that describes this particular exception.


 Class Image

Class java.awt.Image

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Image

public abstract class Image
extends Object

The abstract class Image is the superclass of all classes that represent graphical images. The image must be obtained in a platform-specific manner.


 Image Members

Image Members

Class Overview | This Package | All Packages

Fields
Name | Description
SCALE_AREA_AVERAGING | Use the Area Averaging image scaling algorithm.
SCALE_DEFAULT | Use the default image-scaling algorithm.
SCALE_FAST | Choose an image-scaling algorithm that gives higher priority to scaling speed than smoothness of the scaled image.
SCALE_REPLICATE | Use the image scaling algorithm embodied in the ReplicateScaleFilter class.
SCALE_SMOOTH | Choose an image-scaling algorithm that gives higher priority to image smoothness than scaling speed.
UndefinedProperty | The UndefinedProperty object should be returned whenever a property which was not defined for a particular image is fetched.

Constructors
Name | Description
Image() |

Methods
Name | Description
flush() | Flushes all resources being used by this Image object.
getGraphics() | Creates a graphics context for drawing to an off-screen image.
getHeight(ImageObserver) | Determines the height of the image.
getProperty(String, ImageObserver) | Gets a property of this image by name.
getScaledInstance(int, int, int) | Creates a scaled version of this image.
getSource() | Gets the object that produces the pixels for the image.
getWidth(ImageObserver) | Determines the width of the image.


 Image.SCALE_AREA_AVERAGING

Image.SCALE_AREA_AVERAGING

Syntax
public static final int SCALE_AREA_AVERAGING
Description
Use the Area Averaging image scaling algorithm. The image object is free to substitute a different filter that performs the same algorithm yet integrates more efficiently into the image infrastructure supplied by the toolkit.

See Also
AreaAveragingScaleFilter


 Image.SCALE_DEFAULT

Image.SCALE_DEFAULT

Syntax
public static final int SCALE_DEFAULT
Description
Use the default image-scaling algorithm.


 Image.SCALE_FAST

Image.SCALE_FAST

Syntax
public static final int SCALE_FAST
Description
Choose an image-scaling algorithm that gives higher priority to scaling speed than smoothness of the scaled image.


 Image.SCALE_REPLICATE

Image.SCALE_REPLICATE

Syntax
public static final int SCALE_REPLICATE
Description
Use the image scaling algorithm embodied in the ReplicateScaleFilter class. The Image object is free to substitute a different filter that performs the same algorithm yet integrates more efficiently into the imaging infrastructure supplied by the toolkit.

See Also
ReplicateScaleFilter


 Image.SCALE_SMOOTH

Image.SCALE_SMOOTH

Syntax
public static final int SCALE_SMOOTH
Description
Choose an image-scaling algorithm that gives higher priority to image smoothness than scaling speed.


 Image.UndefinedProperty

Image.UndefinedProperty

Syntax
public static final Object UndefinedProperty
Description
The UndefinedProperty object should be returned whenever a property which was not defined for a particular image is fetched.


 Image.Image

Image.Image

Syntax
public Image()


 Image.flush

Image.flush

Syntax
public abstract void flush()
Description
Flushes all resources being used by this Image object. This includes any pixel data that is being cached for rendering to the screen as well as any system resources that are being used to store data or pixels for the image. The image is reset to a state similar to when it was first created so that if it is again rendered, the image data will have to be recreated or fetched again from its source.


 Image.getGraphics

Image.getGraphics

Syntax
public abstract Graphics getGraphics()
Returns
a graphics context to draw to the off-screen image.
Description
Creates a graphics context for drawing to an off-screen image. This method can only be called for off-screen images.

See Also
Graphics, createImage


 Image.getHeight

Image.getHeight

Syntax
public abstract int getHeight( ImageObserver observer )
Parameters
observer
an object waiting for the image to be loaded.
Returns
the height of this image, or -1 if the height is not yet known.
Description
Determines the height of the image. If the height is not yet known, this method returns -1 and the specified ImageObserver object is notified later.

See Also
getWidth, ImageObserver


 Image.getProperty

Image.getProperty

Syntax
public abstract Object getProperty( String name, ImageObserver observer )
Parameters
name
a property name.
observer
an object waiting for this image to be loaded.
Returns
the value of the named property.
Description
Gets a property of this image by name.

Individual property names are defined by the various image formats. If a property is not defined for a particular image, this method returns the UndefinedProperty object.

If the properties for this image are not yet known, this method returns null, and the ImageObserver object is notified later.

The property name "comment" should be used to store an optional comment which can be presented to the application as a description of the image, its source, or its author.

See Also
ImageObserver, UndefinedProperty


 Image.getScaledInstance

Image.getScaledInstance

Syntax
public Image getScaledInstance( int width, int height, int hints )
Parameters
width
the width to which to scale the image.
height
the height to which to scale the image.
hints
flags to indicate the type of algorithm to use for image resampling.
Returns
a scaled version of the image.
Description
Creates a scaled version of this image. A new Image object is returned which will render the image at the specified width and height by default. The new Image object may be loaded asynchronously even if the original source image has already been loaded completely. If either the width or height is a negative number then a value is substituted to maintain the aspect ratio of the original image dimensions.

See Also
SCALE_DEFAULT, SCALE_FAST, SCALE_SMOOTH, SCALE_REPLICATE, SCALE_AREA_AVERAGING


 Image.getSource

Image.getSource

Syntax
public abstract ImageProducer getSource()
Returns
the image producer that produces the pixels for this image.
Description
Gets the object that produces the pixels for the image. This method is called by the image filtering classes and by methods that perform image conversion and scaling.

See Also
ImageProducer


 Image.getWidth

Image.getWidth

Syntax
public abstract int getWidth( ImageObserver observer )
Parameters
observer
an object waiting for the image to be loaded.
Returns
the width of this image, or -1 if the width is not yet known.
Description
Determines the width of the image. If the width is not yet known, this method returns -1 and the specified ImageObserver object is notified later.

See Also
getHeight, ImageObserver


 Class Insets

Class java.awt.Insets

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Insets

public class Insets
extends Object
implements Cloneable, Serializable

An Insets object is a representation of the borders of a container. It specifies the space that a container must leave at each of its edges. The space can be a border, a blank space, or a title.

See Also:
LayoutManager, Container


 Insets Members

Insets Members

Class Overview | This Package | All Packages

Fields
Name | Description
bottom | The inset from the bottom.
left | The inset from the left.
right | The inset from the right.
top | The inset from the top.

Constructors
Name | Description
Insets(int, int, int, int) | Creates and initializes a new Insets object with the specified top, left, bottom, and right insets.

Methods
Name | Description
clone() | Create a copy of this object.
equals(Object) | Checks whether two insets objects are equal.
toString() | Returns a String object representing this Insets object's values.


 Insets.bottom

Insets.bottom

Syntax
public int bottom
Description
The inset from the bottom.


 Insets.left

Insets.left

Syntax
public int left
Description
The inset from the left.


 Insets.right

Insets.right

Syntax
public int right
Description
The inset from the right.


 Insets.top

Insets.top

Syntax
public int top
Description
The inset from the top.


 Insets.Insets

Insets.Insets

Syntax
public Insets( int top, int left, int bottom, int right )
Parameters
top
the inset from the top.
left
the inset from the left.
bottom
the inset from the bottom.
right
the inset from the right.
Description
Creates and initializes a new Insets object with the specified top, left, bottom, and right insets.


 Insets.clone

Insets.clone

Syntax
public Object clone()
Returns
a copy of this Insets object.
Description
Create a copy of this object.

Overrides
clone in class Object


 Insets.equals

Insets.equals

Syntax
public boolean equals( Object obj )
Returns
true if the two insets are equal; otherwise false.
Description
Checks whether two insets objects are equal. Two instances of Insets are equal if the four integer values of the fields top, left, bottom, and right are all equal.

Overrides
equals in class Object


 Insets.toString

Insets.toString

Syntax
public String toString()
Returns
a string representation of this Insets object, including the values of its member fields.
Description
Returns a String object representing this Insets object's values.

Overrides
toString in class Object


 Interface ItemSelectable

Interface java.awt.ItemSelectable

Interface Members | This Package | All Packages

public interface ItemSelectable

The interface for objects which contain a set of items for which zero or more can be selected.


 ItemSelectable Members

ItemSelectable Members

Interface Overview | This Package | All Packages

Methods
Name | Description
addItemListener(ItemListener) | Add a listener to recieve item events when the state of an item changes.
getSelectedObjects() | Returns the selected items or null if no items are selected.
removeItemListener(ItemListener) | Removes an item listener.


 ItemSelectable.addItemListener

ItemSelectable.addItemListener

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void addItemListener( ItemListener l )
Parameters
l
the listener to recieve events
Description
Add a listener to recieve item events when the state of an item changes.

See Also
ItemEvent


 ItemSelectable.getSelectedObjects

ItemSelectable.getSelectedObjects

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Object[] getSelectedObjects()
Description
Returns the selected items or null if no items are selected.


 ItemSelectable.removeItemListener

ItemSelectable.removeItemListener

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void removeItemListener( ItemListener l )
Parameters
l
the listener being removed
Description
Removes an item listener.

See Also
ItemEvent


 Class Label

Class java.awt.Label

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Label

public class Label
extends Component

A Label object is a component for placing text in a container. A label displays a single line of read-only text. The text can be changed by the application, but a user cannot edit it directly.

For example, the code . . .

 setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10));
 add(new Label("Hi There!"));
 add(new Label("Another Label"));

produces the following label:


 Label Members

Label Members

Class Overview | This Package | All Packages

Fields
Name | Description
CENTER | Indicates that the label should be centered.
LEFT | Indicates that the label should be left justified.
RIGHT | Indicates that the label should be right justified.

Constructors
Name | Description
Label() | Constructs an empty label.
Label(String) | Constructs a new label with the specified string of text, left justified.
Label(String, int) | Constructs a new label that presents the specified string of text with the specified alignment.

Methods
Name | Description
addNotify() | Creates the peer for this label.
getAlignment() | Gets the current alignment of this label.
getText() | Gets the text of this label.
paramString() | Returns the parameter string representing the state of this label.
setAlignment(int) | Sets the alignment for this label to the specified alignment.
setText(String) | Sets the text for this label to the specified text.


 Label.CENTER

Label.CENTER

Syntax
public static final int CENTER
Description
Indicates that the label should be centered.


 Label.LEFT

Label.LEFT

Syntax
public static final int LEFT
Description
Indicates that the label should be left justified.


 Label.RIGHT

Label.RIGHT

Syntax
public static final int RIGHT
Description
Indicates that the label should be right justified.


 Label.Label

Label.Label

Syntax 1
public Label()
Description
Constructs an empty label.

Syntax 2
public Label( String text )
Parameters
text
the string that the label presents.
Description
Constructs a new label with the specified string of text, left justified.

Syntax 3
public Label( String text, int alignment )
Parameters
text
the string that the label presents.
alignment
the alignment value.
Description
Constructs a new label that presents the specified string of text with the specified alignment.

Possible values for alignment are Label.LEFT, Label.RIGHT, and Label.CENTER.


 Label.addNotify

Label.addNotify

Syntax
public void addNotify()
Description
Creates the peer for this label. The peer allows us to modify the appearance of the label without changing its functionality.

Overrides
addNotify in class Component


 Label.getAlignment

Label.getAlignment

Syntax
public int getAlignment()
Description
Gets the current alignment of this label. Possible values are Label.LEFT, Label.RIGHT, and Label.CENTER.

See Also
setAlignment


 Label.getText

Label.getText

Syntax
public String getText()
Returns
the text of this label.
Description
Gets the text of this label.

See Also
setText


 Label.paramString

Label.paramString

Syntax
protected String paramString()
Returns
the parameter string of this label.
Description
Returns the parameter string representing the state of this label. This string is useful for debugging.

Overrides
paramString in class Component


 Label.setAlignment

Label.setAlignment

Syntax
public synchronized void setAlignment( int alignment )
Parameters
alignment
the alignment to be set.
Description
Sets the alignment for this label to the specified alignment. Possible values are Label.LEFT, Label.RIGHT, and Label.CENTER.

Exceptions
IllegalArgumentException if an improper value for alignment is given.
See Also
getAlignment


 Label.setText

Label.setText

Syntax
public synchronized void setText( String text )
Parameters
text
the text that this label presents.
Description
Sets the text for this label to the specified text.

See Also
getText


 Interface LayoutManager

Interface java.awt.LayoutManager

Interface Members | This Package | All Packages

public interface LayoutManager

Defines the interface for classes that know how to layout Containers.

See Also:
Container


 LayoutManager Members

LayoutManager Members

Interface Overview | This Package | All Packages

Methods
Name | Description
addLayoutComponent(String, Component) | Adds the specified component with the specified name to the layout.
layoutContainer(Container) | Lays out the container in the specified panel.
minimumLayoutSize(Container) | Calculates the minimum size dimensions for the specified panel given the components in the specified parent container.
preferredLayoutSize(Container) | Calculates the preferred size dimensions for the specified panel given the components in the specified parent container.
removeLayoutComponent(Component) | Removes the specified component from the layout.


 LayoutManager.addLayoutComponent

LayoutManager.addLayoutComponent

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void addLayoutComponent( String name, Component comp )
Parameters
name
the component name
comp
the component to be added
Description
Adds the specified component with the specified name to the layout.


 LayoutManager.layoutContainer

LayoutManager.layoutContainer

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void layoutContainer( Container parent )
Parameters
parent
the component which needs to be laid out
Description
Lays out the container in the specified panel.


 LayoutManager.minimumLayoutSize

LayoutManager.minimumLayoutSize

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Dimension minimumLayoutSize( Container parent )
Parameters
parent
the component to be laid out
Description
Calculates the minimum size dimensions for the specified panel given the components in the specified parent container.

See Also
preferredLayoutSize


 LayoutManager.preferredLayoutSize

LayoutManager.preferredLayoutSize

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Dimension preferredLayoutSize( Container parent )
Parameters
parent
the component to be laid out
Description
Calculates the preferred size dimensions for the specified panel given the components in the specified parent container.

See Also
minimumLayoutSize


 LayoutManager.removeLayoutComponent

LayoutManager.removeLayoutComponent

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void removeLayoutComponent( Component comp )
Parameters
comp
the component ot be removed
Description
Removes the specified component from the layout.


 Interface LayoutManager2

Interface java.awt.LayoutManager2

Interface Members | This Package | All Packages

public interface LayoutManager2
extends LayoutManager

Defines an interface for classes that know how to layout Containers based on a layout constraints object. This interface extends the LayoutManager interface to deal with layouts explicitly in terms of constraint objects that specify how and where components should be added to the layout.

This minimal extension to LayoutManager is intended for tool providers who wish to the creation of constraint-based layouts. It does not yet provide full, general support for custom constraint-based layout managers.

See Also:
LayoutManager, Container


 LayoutManager2 Members

LayoutManager2 Members

Interface Overview | This Package | All Packages

Methods
Name | Description
addLayoutComponent(Component, Object) | Adds the specified component to the layout, using the specified constraint object.
getLayoutAlignmentX(Container) | Returns the alignment along the x axis.
getLayoutAlignmentY(Container) | Returns the alignment along the y axis.
invalidateLayout(Container) | Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
maximumLayoutSize(Container) | Returns the maximum size of this component.


 LayoutManager2.addLayoutComponent

LayoutManager2.addLayoutComponent

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void addLayoutComponent( Component comp, Object constraints )
Parameters
comp
the component to be added
constraints
where/how the component is added to the layout.
Description
Adds the specified component to the layout, using the specified constraint object.


 LayoutManager2.getLayoutAlignmentX

LayoutManager2.getLayoutAlignmentX

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract float getLayoutAlignmentX( Container target )
Description
Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.


 LayoutManager2.getLayoutAlignmentY

LayoutManager2.getLayoutAlignmentY

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract float getLayoutAlignmentY( Container target )
Description
Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.


 LayoutManager2.invalidateLayout

LayoutManager2.invalidateLayout

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void invalidateLayout( Container target )
Description
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.


 LayoutManager2.maximumLayoutSize

LayoutManager2.maximumLayoutSize

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Dimension maximumLayoutSize( Container target )
Description
Returns the maximum size of this component.

See Also
getMinimumSize, getPreferredSize, LayoutManager


 Class List

Class java.awt.List

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.List

public class List
extends Component
implements ItemSelectable

The List component presents the user with a scrolling list of text items. The list can be set up so that the user can choose either one item or multiple items.

For example, the code . . .

 List lst = new List(4, false);
 lst.add("Mercury");
 lst.add("Venus");
 lst.add("Earth");
 lst.add("JavaSoft");
 lst.add("Mars");
 lst.add("Jupiter");
 lst.add("Saturn");
 lst.add("Uranus");
 lst.add("Neptune");
 lst.add("Pluto");
 cnt.add(lst);

where cnt is a container, produces the following scrolling list:

Clicking on an item that isn't selected selects it. Clicking on an item that is already selected deselects it. In the preceding example, only one item from the scrolling list can be selected at a time, since the second argument when creating the new scrolling list is false. Selecting an item causes any other selected item to be automatically deselected.

Beginning with Java 1.1, the Abstract Window Toolkit sends the List object all mouse, keyboard, and focus events that occur over it. (The old AWT event model is being maintained only for backwards compatibility, and its use is discouraged.)

When an item is selected or deselected, AWT sends an instance of ItemEvent to the list. When the user double-clicks on an item in a scrolling list, AWT sends an instance of ActionEvent to the list following the item event. AWT also generates an action event when the user presses the return key while an item in the list is selected.

If an application wants to perform some action based on an item in this list being selected or activated, it should implement ItemListener or ActionListener as appropriate and register the new listener to receive events from this list.

For multiple-selection scrolling lists, it is considered a better user interface to use an external gesture (such as clicking on a button) to trigger the action.

See Also:
ItemEvent, ItemListener, ActionEvent, ActionListener


 List Members

List Members

Class Overview | This Package | All Packages

Constructors
Name | Description
List() | Creates a new scrolling list.
List(int) | Creates a new scrolling list initialized with the specified number of visible lines.
List(int, boolean) | Creates a new scrolling list initialized to display the specified number of rows.

Methods
Name | Description
add(String) | Adds the specified item to the end of scrolling list.
add(String, int) | Adds the specified item to the end of the scrolling list.
addActionListener(ActionListener) | Adds the specified action listener to receive action events from this list.
addItem(String) | Deprecated.
addItem(String, int) | Deprecated.
addItemListener(ItemListener) | Adds the specified item listener to receive item events from this list.
addNotify() | Creates the peer for the list.
allowsMultipleSelections() | Deprecated.
clear() | Deprecated.
countItems() | Deprecated.
delItem(int) | Deprecated.
delItems(int, int) | Deprecated.
deselect(int) | Deselects the item at the specified index.
getItem(int) | Gets the item associated with the specified index.
getItemCount() | Gets the number of items in the list.
getItems() | Gets the items in the list.
getMinimumSize() | Determines the minimum size of this scrolling list.
getMinimumSize(int) | Gets the minumum dimensions for a list with the specified number of rows.
getPreferredSize() | Gets the preferred size of this scrolling list.
getPreferredSize(int) | Gets the preferred dimensions for a list with the specified number of rows.
getRows() | Get the number of visible lines in this list.
getSelectedIndex() | Gets the index of the selected item on the list,
getSelectedIndexes() | Gets the selected indexes on the list.
getSelectedItem() | Get the selected item on this scrolling list.
getSelectedItems() | Get the selected items on this scrolling list.
getSelectedObjects() | Returns the selected items on the list in an array of Objects.
getVisibleIndex() | Gets the index of the item that was last made visible by the method makeVisible.
isIndexSelected(int) | Determines if the specified item in this scrolling list is selected.
isMultipleMode() | Determines whether this list allows multiple selections.
isSelected(int) | Deprecated.
makeVisible(int) | Makes the item at the specified index visible.
minimumSize() | Deprecated.
minimumSize(int) | Deprecated.
paramString() | Returns the parameter string representing the state of this scrolling list.
preferredSize() | Deprecated.
preferredSize(int) | Deprecated.
processActionEvent(ActionEvent) | Processes action events occurring on this component by dispatching them to any registered ActionListener objects.
processEvent(AWTEvent) | Processes events on this scrolling list.
processItemEvent(ItemEvent) | Processes item events occurring on this list by dispatching them to any registered ItemListener objects.
remove(int) | Remove the item at the specified position from this scrolling list.
remove(String) | Removes the first occurrence of an item from the list.
removeActionListener(ActionListener) | Removes the specified action listener so that it no longer receives action events from this list.
removeAll() | Removes all items from this list.
removeItemListener(ItemListener) | Removes the specified item listener so that it no longer receives item events from this list.
removeNotify() | Removes the peer for this list.
replaceItem(String, int) | Replaces the item at the specified index in the scrolling list with the new string.
select(int) | Selects the item at the specified index in the scrolling list.
setMultipleMode(boolean) | Sets the flag that determines whether this list allows multiple selections.
setMultipleSelections(boolean) | Deprecated.


 List.List

List.List

Syntax 1
public List()
Description
Creates a new scrolling list. Initially there are no visible lines, and only one item can be selected from the list.

Syntax 2
public List( int rows )
Parameters
rows
the number of items to show.
Description
Creates a new scrolling list initialized with the specified number of visible lines. By default, multiple selections are not allowed.

Syntax 3
public List( int rows, boolean multipleMode )
Parameters
rows
the number of items to show.
multipleMode
if true, then multiple selections are allowed; otherwise, only one item can be selected at a time.
Description
Creates a new scrolling list initialized to display the specified number of rows. If the value of multipleMode is true, then the user can select multiple items from the list. If it is false, only one item at a time can be selected.


 List.add

List.add

Syntax 1
public void add( String item )
Parameters
item
the item to be added.
Description
Adds the specified item to the end of scrolling list.

Syntax 2
public synchronized void add( String item, int index )
Parameters
item
the item to be added.
index
the position at which to add the item.
Description
Adds the specified item to the end of the scrolling list. The index is zero-based. If value of the index is -1 then the item is added to the end. If value of the index is greater than the number of items in the list, the item is added at the end.


 List.addActionListener

List.addActionListener

Syntax
public synchronized void addActionListener( ActionListener l )
Parameters
l
the action listener.
Description
Adds the specified action listener to receive action events from this list. Action events occur when a user double-clicks on a list item.

See Also
ActionEvent, ActionListener, removeActionListener


 List.addItem

List.addItem

Syntax 1
public void addItem( String item )
Description
Note: addItem() is deprecated. replaced by add(String).

Syntax 2
public synchronized void addItem( String item, int index )
Description
Note: addItem() is deprecated. replaced by add(String, int).


 List.addItemListener

List.addItemListener

Syntax
public synchronized void addItemListener( ItemListener l )
Parameters
l
the item listener.
Description
Adds the specified item listener to receive item events from this list.

See Also
ItemEvent, ItemListener, removeItemListener


 List.addNotify

List.addNotify

Syntax
public void addNotify()
Description
Creates the peer for the list. The peer allows us to modify the list's appearance without changing its functionality.

Overrides
addNotify in class Component


 List.allowsMultipleSelections

List.allowsMultipleSelections

Syntax
public boolean allowsMultipleSelections()
Description
Note: allowsMultipleSelections() is deprecated. As of JDK version 1.1, replaced by isMultipleMode().


 List.clear

List.clear

Syntax
public synchronized void clear()
Description
Note: clear() is deprecated. As of JDK version 1.1, replaced by removeAll().


 List.countItems

List.countItems

Syntax
public int countItems()
Description
Note: countItems() is deprecated. As of JDK version 1.1, replaced by getItemCount().


 List.delItem

List.delItem

Syntax
public synchronized void delItem( int position )
Description
Note: delItem() is deprecated. replaced by remove(String) and remove(int).


 List.delItems

List.delItems

Syntax
public synchronized void delItems( int start, int end )
Description
Note: delItems() is deprecated. As of JDK version 1.1, Not for public use in the future. This method is expected to be retained only as a package private method.


 List.deselect

List.deselect

Syntax
public synchronized void deselect( int index )
Parameters
index
the position of the item to deselect.
Description
Deselects the item at the specified index.

If the item at the specified index is not selected, or if the index is out of range, then the operation is ignored.

See Also
select, getSelectedItem, isIndexSelected


 List.getItem

List.getItem

Syntax
public String getItem( int index )
Parameters
index
the position of the item.
Returns
an item that is associated with the specified index.
Description
Gets the item associated with the specified index.

See Also
getItemCount


 List.getItemCount

List.getItemCount

Syntax
public int getItemCount()
Returns
the number of items in the list.
Description
Gets the number of items in the list.

See Also
getItem


 List.getItems

List.getItems

Syntax
public synchronized String[] getItems()
Returns
a string array containing items of the list.
Description
Gets the items in the list.

See Also
select, deselect, isIndexSelected


 List.getMinimumSize

List.getMinimumSize

Syntax 1
public Dimension getMinimumSize( int rows )
Parameters
rows
number of rows in the list.
Returns
the minimum dimensions for displaying this scrolling list.
Description
Gets the minumum dimensions for a list with the specified number of rows.

See Also
getMinimumSize

Syntax 2
public Dimension getMinimumSize()
Returns
the minimum dimensions needed to display this scrolling list.
Description
Determines the minimum size of this scrolling list.

Overrides
getMinimumSize in class Component
See Also
getMinimumSize


 List.getPreferredSize

List.getPreferredSize

Syntax 1
public Dimension getPreferredSize( int rows )
Parameters
rows
number of rows in the list.
Returns
the preferred dimensions for displaying this scrolling list.
Description
Gets the preferred dimensions for a list with the specified number of rows.

See Also
getPreferredSize

Syntax 2
public Dimension getPreferredSize()
Returns
the preferred dimensions for displaying this scrolling list.
Description
Gets the preferred size of this scrolling list.

Overrides
getPreferredSize in class Component
See Also
getPreferredSize


 List.getRows

List.getRows

Syntax
public int getRows()
Returns
the number of visible lines in this scrolling list.
Description
Get the number of visible lines in this list.


 List.getSelectedIndex

List.getSelectedIndex

Syntax
public synchronized int getSelectedIndex()
Returns
the index of the selected item, or -1 if no item is selected, or if more that one item is selected.
Description
Gets the index of the selected item on the list,

See Also
select, deselect, isIndexSelected


 List.getSelectedIndexes

List.getSelectedIndexes

Syntax
public synchronized int[] getSelectedIndexes()
Returns
an array of the selected indexes of this scrolling list.
Description
Gets the selected indexes on the list.

See Also
select, deselect, isIndexSelected


 List.getSelectedItem

List.getSelectedItem

Syntax
public synchronized String getSelectedItem()
Returns
the selected item on the list, or null if no item is selected.
Description
Get the selected item on this scrolling list.

See Also
select, deselect, isIndexSelected


 List.getSelectedItems

List.getSelectedItems

Syntax
public synchronized String[] getSelectedItems()
Returns
an array of the selected items on this scrolling list.
Description
Get the selected items on this scrolling list.

See Also
select, deselect, isIndexSelected


 List.getSelectedObjects

List.getSelectedObjects

Syntax
public Object[] getSelectedObjects()
Description
Returns the selected items on the list in an array of Objects.

See Also
ItemSelectable


 List.getVisibleIndex

List.getVisibleIndex

Syntax
public int getVisibleIndex()
Returns
the index of the item that was last made visible.
Description
Gets the index of the item that was last made visible by the method makeVisible.

See Also
makeVisible


 List.isIndexSelected

List.isIndexSelected

Syntax
public boolean isIndexSelected( int index )
Parameters
index
the item to be checked.
Returns
true if the specified item has been selected; false otherwise.
Description
Determines if the specified item in this scrolling list is selected.

See Also
select, deselect


 List.isMultipleMode

List.isMultipleMode

Syntax
public boolean isMultipleMode()
Returns
true if this list allows multiple selections; otherwise, false.
Description
Determines whether this list allows multiple selections.

See Also
setMultipleMode


 List.isSelected

List.isSelected

Syntax
public boolean isSelected( int index )
Description
Note: isSelected() is deprecated. As of JDK version 1.1, replaced by isIndexSelected(int).


 List.makeVisible

List.makeVisible

Syntax
public synchronized void makeVisible( int index )
Parameters
index
the position of the item.
Description
Makes the item at the specified index visible.

See Also
getVisibleIndex


 List.minimumSize

List.minimumSize

Syntax 1
public Dimension minimumSize( int rows )
Description
Note: minimumSize() is deprecated. As of JDK version 1.1, replaced by getMinimumSize(int).

Syntax 2
public Dimension minimumSize()
Description
Note: minimumSize() is deprecated. As of JDK version 1.1, replaced by getMinimumSize().

Overrides
minimumSize in class Component


 List.paramString

List.paramString

Syntax
protected String paramString()
Returns
the parameter string of this scrolling list.
Description
Returns the parameter string representing the state of this scrolling list. This string is useful for debugging.

Overrides
paramString in class Component


 List.preferredSize

List.preferredSize

Syntax 1
public Dimension preferredSize( int rows )
Description
Note: preferredSize() is deprecated. As of JDK version 1.1, replaced by getPreferredSize(int).

Syntax 2
public Dimension preferredSize()
Description
Note: preferredSize() is deprecated. As of JDK version 1.1, replaced by getPreferredSize().

Overrides
preferredSize in class Component


 List.processActionEvent

List.processActionEvent

Syntax
protected void processActionEvent( ActionEvent e )
Parameters
e
the action event.
Description
Processes action events occurring on this component by dispatching them to any registered ActionListener objects.

This method is not called unless action events are enabled for this component. Action events are enabled when one of the following occurs:

  • An ActionListener object is registered via addActionListener.
  • Action events are enabled via enableEvents.

See Also
ActionEvent, ActionListener, addActionListener, enableEvents


 List.processEvent

List.processEvent

Syntax
protected void processEvent( AWTEvent e )
Parameters
e
the event.
Description
Processes events on this scrolling list. If an event is an instance of ItemEvent, it invokes the processItemEvent method. Else, if the event is an instance of ActionEvent, it invokes processActionEvent. If the event is not an item event or an action event, it invokes processEvent on the superclass.

Overrides
processEvent in class Component
See Also
ActionEvent, ItemEvent, processActionEvent, processItemEvent


 List.processItemEvent

List.processItemEvent

Syntax
protected void processItemEvent( ItemEvent e )
Parameters
e
the item event.
Description
Processes item events occurring on this list by dispatching them to any registered ItemListener objects.

This method is not called unless item events are enabled for this component. Item events are enabled when one of the following occurs:

  • An ItemListener object is registered via addItemListener.
  • Item events are enabled via enableEvents.

See Also
ItemEvent, ItemListener, addItemListener, enableEvents


 List.remove

List.remove

Syntax 1
public synchronized void remove( String item )
Parameters
item
the item to remove from the list.
Description
Removes the first occurrence of an item from the list.

Exceptions
IllegalArgumentException if the item doesn't exist in the list.

Syntax 2
public synchronized void remove( int position )
Parameters
position
the index of the item to delete.
Description
Remove the item at the specified position from this scrolling list.

See Also
add


 List.removeActionListener

List.removeActionListener

Syntax
public synchronized void removeActionListener( ActionListener l )
Parameters
l
the action listener.
Description
Removes the specified action listener so that it no longer receives action events from this list. Action events occur when a user double-clicks on a list item.

See Also
ActionEvent, ActionListener, addActionListener


 List.removeAll

List.removeAll

Syntax
public synchronized void removeAll()
Description
Removes all items from this list.

See Also
remove, delItems


 List.removeItemListener

List.removeItemListener

Syntax
public synchronized void removeItemListener( ItemListener l )
Parameters
l
the item listener.
Description
Removes the specified item listener so that it no longer receives item events from this list.

See Also
ItemEvent, ItemListener, addItemListener


 List.removeNotify

List.removeNotify

Syntax
public void removeNotify()
Description
Removes the peer for this list. The peer allows us to modify the list's appearance without changing its functionality.

Overrides
removeNotify in class Component


 List.replaceItem

List.replaceItem

Syntax
public synchronized void replaceItem( String newValue, int index )
Parameters
newValue
a new string to replace an existing item.
index
the position of the item to replace.
Description
Replaces the item at the specified index in the scrolling list with the new string.


 List.select

List.select

Syntax
public synchronized void select( int index )
Parameters
index
the position of the item to select.
Description
Selects the item at the specified index in the scrolling list.

See Also
getSelectedItem, deselect, isIndexSelected


 List.setMultipleMode

List.setMultipleMode

Syntax
public synchronized void setMultipleMode( boolean b )
Parameters
b
if true then multiple selections are allowed; otherwise, only one item from the list can be selected at once.
Description
Sets the flag that determines whether this list allows multiple selections.

See Also
isMultipleMode


 List.setMultipleSelections

List.setMultipleSelections

Syntax
public synchronized void setMultipleSelections( boolean b )
Description
Note: setMultipleSelections() is deprecated. As of JDK version 1.1, replaced by setMultipleMode(boolean).


 Class MediaTracker

Class java.awt.MediaTracker

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.MediaTracker

public class MediaTracker
extends Object
implements Serializable

The MediaTracker class is a utility class to track the status of a number of media objects. Media objects could include audio clips as well as images, though currently only images are supported.

To use a media tracker, create an instance of MediaTracker and call its addImage method for each image to be tracked. In addition, each image can be assigned a unique identifier. This identifier controls the priority order in which the images are fetched. It can also be used to identify unique subsets of the images that can be waited on independently. Images with a lower ID are loaded in preference to those with a higher ID number.

Here is an example:

 import java.applet.Applet;
 import java.awt.Color;
 import java.awt.Image;
 import java.awt.Graphics;
 import java.awt.MediaTracker;
 public class ImageBlaster extends Applet implements Runnable {
    MediaTracker tracker;
    Image bg;
    Image anim[] = new Image[5];
    int index;
    Thread animator;
    // Get the images for the background (id == 0)
    // and the animation frames (id == 1)
      // and add them to the MediaTracker
    public void init() {
        tracker = new MediaTracker(this);
        bg = getImage(getDocumentBase(),
                  "images/background.gif");
        tracker.addImage(bg, 0);
        for (int i = 0; i < 5; i++) {
        anim[i] = getImage(getDocumentBase(),
                      "images/anim"+i+".gif");
        tracker.addImage(anim[i], 1);
        }
    }
    // Start the animation thread.
    public void start() {
        animator = new Thread(this);
        animator.start();
    }
    // Stop the animation thread.
    public void stop() {
        animator.stop();
        animator = null;
    }
    // Run the animation thread.
    // First wait for the background image to fully load
      // and paint.  Then wait for all of the animation
    // frames to finish loading. Finally, loop and
    // increment the animation frame index.
    public void run() {
        try {
        tracker.waitForID(0);
        tracker.waitForID(1);
        } catch (InterruptedException e) {
        return;
        }
        Thread me = Thread.currentThread();
        while (animator == me) {
        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
            break;
        }
        synchronized (this) {
            index++;
            if (index >= anim.length) {
            index = 0;
            }
        }
        repaint();
        }
    }
    // The background image fills the frame so we
    // don't need to clear the applet on repaints.
      // Just call the paint method.
    public void update(Graphics g) {
        paint(g);
    }
    // Paint a large red rectangle if there are any errors
    // loading the images.  Otherwise always paint the
    // background so that it appears incrementally as it
      // is loading.  Finally, only paint the current animation
    // frame if all of the frames (id == 1) are done loading,
    // so that we don't get partial animations.
    public void paint(Graphics g) {
        if ((tracker.statusAll(false) & MediaTracker.ERRORED) != 0) {
        g.setColor(Color.red);
        g.fillRect(0, 0, size().width, size().height);
        return;
        }
        g.drawImage(bg, 0, 0, this);
        if (tracker.statusID(1, false) == MediaTracker.COMPLETE) {
        g.drawImage(anim[index], 10, 10, this);
        }
    }
 }


 MediaTracker Members

MediaTracker Members

Class Overview | This Package | All Packages

Fields
Name | Description
ABORTED | Flag indicating that the downloading of some media was aborted.
COMPLETE | Flag indicating that the downloading of media was completed successfully.
ERRORED | Flag indicating that the downloading of some media encountered an error.
LOADING | Flag indicating some media is currently being loaded.

Constructors
Name | Description
MediaTracker(Component) | Creates a media tracker to track images for a given component.

Methods
Name | Description
addImage(Image, int) | Adds an image to the list of images being tracked by this media tracker.
addImage(Image, int, int, int) | Adds a scaled image to the list of images being tracked by this media tracker.
checkAll() | Checks to see if all images being tracked by this media tracker have finished loading.
checkAll(boolean) | Checks to see if all images being tracked by this media tracker have finished loading.
checkID(int) | Checks to see if all images tracked by this media tracker that are tagged with the specified identifier have finished loading.
checkID(int, boolean) | Checks to see if all images tracked by this media tracker that are tagged with the specified identifier have finished loading.
getErrorsAny() | Returns a list of all media that have encountered an error.
getErrorsID(int) | Returns a list of media with the specified ID that have encountered an error.
isErrorAny() | Checks the error status of all of the images.
isErrorID(int) | Checks the error status of all of the images tracked by this media tracker with the specified identifier.
removeImage(Image) | Remove the specified image from this media tracker.
removeImage(Image, int) | Remove the specified image from the specified tracking ID of this media tracker.
removeImage(Image, int, int, int) | Remove the specified image with the specified width, height, and ID from this media tracker.
statusAll(boolean) | Calculates and returns the bitwise inclusive OR of the status of all media that are tracked by this media tracker.
statusID(int, boolean) | Calculates and returns the bitwise inclusive OR of the status of all media with the specified identifier that are tracked by this media tracker.
waitForAll() | Starts loading all images tracked by this media tracker.
waitForAll(long) | Starts loading all images tracked by this media tracker.
waitForID(int) | Starts loading all images tracked by this media tracker with the specified identifier.
waitForID(int, long) | Starts loading all images tracked by this media tracker with the specified identifier.


 MediaTracker.ABORTED

MediaTracker.ABORTED

Syntax
public static final int ABORTED
Description
Flag indicating that the downloading of some media was aborted.

See Also
statusAll, statusID


 MediaTracker.COMPLETE

MediaTracker.COMPLETE

Syntax
public static final int COMPLETE
Description
Flag indicating that the downloading of media was completed successfully.

See Also
statusAll, statusID


 MediaTracker.ERRORED

MediaTracker.ERRORED

Syntax
public static final int ERRORED
Description
Flag indicating that the downloading of some media encountered an error.

See Also
statusAll, statusID


 MediaTracker.LOADING

MediaTracker.LOADING

Syntax
public static final int LOADING
Description
Flag indicating some media is currently being loaded.

See Also
statusAll, statusID


 MediaTracker.MediaTracker

MediaTracker.MediaTracker

Syntax
public MediaTracker( Component comp )
Parameters
comp
the component on which the images will eventually be drawn.
Description
Creates a media tracker to track images for a given component.


 MediaTracker.addImage

MediaTracker.addImage

Syntax 1
public void addImage( Image image, int id )
Parameters
image
the image to be tracked.
id
an identifier used to track this image.
Description
Adds an image to the list of images being tracked by this media tracker. The image will eventually be rendered at its default (unscaled) size.

Syntax 2
public synchronized void addImage( Image image, int id, int w, int h )
Parameters
image
the image to be tracked.
id
an identifier that can be used to track this image.
w
the width at which the image is rendered.
h
the height at which the image is rendered.
Description
Adds a scaled image to the list of images being tracked by this media tracker. The image will eventually be rendered at the indicated width and height.


 MediaTracker.checkAll

MediaTracker.checkAll

Syntax 1
public boolean checkAll()
Returns
true if all images have finished loading, have been aborted, or have encountered an error; false otherwise.
Description
Checks to see if all images being tracked by this media tracker have finished loading.

This method does not start loading the images if they are not already loading.

If there is an error while loading or scaling an image, then that image is considered to have finished loading. Use the isErrorAny or isErrorID methods to check for errors.

See Also
checkAll, checkID, isErrorAny, isErrorID

Syntax 2
public boolean checkAll( boolean load )
Parameters
load
if true, start loading any images that are not yet being loaded.
Returns
true if all images have finished loading, have been aborted, or have encountered an error; false otherwise.
Description
Checks to see if all images being tracked by this media tracker have finished loading.

If the value of the load flag is true, then this method starts loading any images that are not yet being loaded.

If there is an error while loading or scaling an image, that image is considered to have finished loading. Use the isErrorAny and isErrorID methods to check for errors.

See Also
checkID, checkAll, isErrorAny, isErrorID


 MediaTracker.checkID

MediaTracker.checkID

Syntax 1
public boolean checkID( int id )
Parameters
id
the identifier of the images to check.
Returns
true if all images have finished loading, have been aborted, or have encountered an error; false otherwise.
Description
Checks to see if all images tracked by this media tracker that are tagged with the specified identifier have finished loading.

This method does not start loading the images if they are not already loading.

If there is an error while loading or scaling an image, then that image is considered to have finished loading. Use the isErrorAny or isErrorID methods to check for errors.

See Also
checkID, checkAll, isErrorAny, isErrorID

Syntax 2
public boolean checkID( int id, boolean load )
Parameters
id
the identifier of the images to check.
load
if true, start loading any images that are not yet being loaded.
Returns
true if all images have finished loading, have been aborted, or have encountered an error; false otherwise.
Description
Checks to see if all images tracked by this media tracker that are tagged with the specified identifier have finished loading.

If the value of the load flag is true, then this method starts loading any images that are not yet being loaded.

If there is an error while loading or scaling an image, then that image is considered to have finished loading. Use the isErrorAny or isErrorID methods to check for errors.

See Also
checkID, checkAll, isErrorAny, isErrorID


 MediaTracker.getErrorsAny

MediaTracker.getErrorsAny

Syntax
public synchronized Object[] getErrorsAny()
Returns
an array of media objects tracked by this media tracker that have encountered an error, or null if there are none with errors.
Description
Returns a list of all media that have encountered an error.

See Also
isErrorAny, getErrorsID


 MediaTracker.getErrorsID

MediaTracker.getErrorsID

Syntax
public synchronized Object[] getErrorsID( int id )
Parameters
id
the identifier of the images to check.
Returns
an array of media objects tracked by this media tracker with the specified identifier that have encountered an error, or null if there are none with errors.
Description
Returns a list of media with the specified ID that have encountered an error.

See Also
isErrorID, isErrorAny, getErrorsAny


 MediaTracker.isErrorAny

MediaTracker.isErrorAny

Syntax
public synchronized boolean isErrorAny()
Returns
true if any of the images tracked by this media tracker had an error during loading; false otherwise.
Description
Checks the error status of all of the images.

See Also
isErrorID, getErrorsAny


 MediaTracker.isErrorID

MediaTracker.isErrorID

Syntax
public synchronized boolean isErrorID( int id )
Parameters
id
the identifier of the images to check.
Returns
true if any of the images with the specified identifier had an error during loading; false otherwise.
Description
Checks the error status of all of the images tracked by this media tracker with the specified identifier.

See Also
isErrorAny, getErrorsID


 MediaTracker.removeImage

MediaTracker.removeImage

Syntax 1
public synchronized void removeImage( Image image )
Parameters
image
the image to be removed
Description
Remove the specified image from this media tracker. All instances of the specified image are removed, regardless of scale or ID.

See Also
removeImage, removeImage

Syntax 2
public synchronized void removeImage( Image image, int id )
Parameters
image
the image to be removed.
id
the tracking ID frrom which to remove the image.
Description
Remove the specified image from the specified tracking ID of this media tracker. All instances of Image being tracked under the specified ID are removed regardless of scale.

See Also
removeImage, removeImage

Syntax 3
public synchronized void removeImage( Image image, int id, int width, int height )
Parameters
image
the image to be removed
id
the tracking ID from which to remove the image.
width
the width to remove (-1 for unscaled).
height
the height to remove (-1 for unscaled).
Description
Remove the specified image with the specified width, height, and ID from this media tracker. Only the specified instance (with any duplicates) is removed.

See Also
removeImage, removeImage


 MediaTracker.statusAll

MediaTracker.statusAll

Syntax
public int statusAll( boolean load )
Parameters
load
if true, start loading any images that are not yet being loaded.
Returns
the bitwise inclusive OR of the status of all of the media being tracked.
Description
Calculates and returns the bitwise inclusive OR of the status of all media that are tracked by this media tracker.

Possible flags defined by the MediaTracker class are LOADING, ABORTED, ERRORED, and COMPLETE. An image that hasn't started loading has zero as its status.

If the value of load is true, then this method starts loading any images that are not yet being loaded.

See Also
statusID, LOADING, ABORTED, ERRORED, COMPLETE


 MediaTracker.statusID

MediaTracker.statusID

Syntax
public int statusID( int id, boolean load )
Parameters
id
the identifier of the images to check.
load
if true, start loading any images that are not yet being loaded.
Returns
the bitwise inclusive OR of the status of all of the media with the specified identifier that are being tracked.
Description
Calculates and returns the bitwise inclusive OR of the status of all media with the specified identifier that are tracked by this media tracker.

Possible flags defined by the MediaTracker class are LOADING, ABORTED, ERRORED, and COMPLETE. An image that hasn't started loading has zero as its status.

If the value of load is true, then this method starts loading any images that are not yet being loaded.

See Also
statusAll, LOADING, ABORTED, ERRORED, COMPLETE


 MediaTracker.waitForAll

MediaTracker.waitForAll

Syntax 1
public void waitForAll() throws InterruptedException
Description
Starts loading all images tracked by this media tracker. This method waits until all the images being tracked have finished loading.

If there is an error while loading or scaling an image, then that image is considered to have finished loading. Use the isErrorAny or isErrorID methods to check for errors.

Exceptions
InterruptedException if another thread has interrupted this thread.
See Also
waitForID, waitForAll, isErrorAny, isErrorID

Syntax 2
public synchronized boolean waitForAll( long ms ) throws InterruptedException
Parameters
ms
the number of milliseconds to wait for the loading to complete.
Returns
true if all images were successfully loaded; false otherwise.
Description
Starts loading all images tracked by this media tracker. This method waits until all the images being tracked have finished loading, or until the length of time specified in milliseconds by the ms argument has passed.

If there is an error while loading or scaling an image, then that image is considered to have finished loading. Use the isErrorAny or isErrorID methods to check for errors.

Exceptions
InterruptedException if another thread has interrupted this thread.
See Also
waitForID, waitForAll, isErrorAny, isErrorID


 MediaTracker.waitForID

MediaTracker.waitForID

Syntax 1
public void waitForID( int id ) throws InterruptedException
Parameters
id
the identifier of the images to check.
Description
Starts loading all images tracked by this media tracker with the specified identifier. This method waits until all the images with the specified identifier have finished loading.

If there is an error while loading or scaling an image, then that image is considered to have finished loading. Use the isErrorAny and isErrorID methods to check for errors.

Exceptions
InterruptedException if another thread has interrupted this thread.
See Also
waitForAll, isErrorAny, isErrorID

Syntax 2
public synchronized boolean waitForID( int id, long ms ) throws InterruptedException
Parameters
id
the identifier of the images to check.
ms
the length of time, in milliseconds, to wait for the loading to complete.
Description
Starts loading all images tracked by this media tracker with the specified identifier. This method waits until all the images with the specified identifier have finished loading, or until the length of time specified in milliseconds by the ms argument has passed.

If there is an error while loading or scaling an image, then that image is considered to have finished loading. Use the statusID, isErrorID, and isErrorAny methods to check for errors.

Exceptions
InterruptedException if another thread has interrupted this thread.
See Also
waitForAll, waitForID, statusID, isErrorAny, isErrorID


 Class Menu

Class java.awt.Menu

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.MenuComponent
           |
           +----java.awt.MenuItem
                   |
                   +----java.awt.Menu

public class Menu
extends MenuItem
implements MenuContainer

A Menu object is a pull-down menu component that is deployed from a menu bar.

A menu can optionally be a tear-off menu. A tear-off menu can be opened and dragged away from its parent menu bar or menu. It remains on the screen after the mouse button has been released. The mechanism for tearing off a menu is platform dependent, since the look and feel of the tear-off menu is determined by its peer. On platforms that do not support tear-off menus, the tear-off property is ignored.

Each item in a menu must belong to the MenuItem class. It can be an instance of MenuItem, a submenu (an instance of Menu), or a check box (an instance of CheckboxMenuItem).

See Also:
MenuItem, CheckboxMenuItem


 Menu Members

Menu Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Menu() | Constructs a new menu with an empty label.
Menu(String) | Constructs a new menu with the specified label.
Menu(String, boolean) | Constructs a new menu with the specified label.

Methods
Name | Description
add(MenuItem) | Adds the specified menu item to this menu.
add(String) | Adds an item with the specified label to this menu.
addNotify() | Creates the menu's peer.
addSeparator() | Adds a separator line, or a hypen, to the menu at the current position.
countItems() | Deprecated.
getItem(int) | Gets the item located at the specified index of this menu.
getItemCount() | Get the number of items in this menu.
insert(MenuItem, int) | Inserts a menu item into this menu at the specified position.
insert(String, int) | Inserts a menu item with the specified label into this menu at the specified position.
insertSeparator(int) | Inserts a separator at the specified position.
isTearOff() | Indicates whether this menu is a tear-off menu.
paramString() | Gets the parameter string representing the state of this menu.
remove(int) | Removes the menu item at the specified index from this menu.
remove(MenuComponent) | Removes the specified menu item from this menu.
removeAll() | Removes all items from this menu.
removeNotify() | Removes the menu's peer.


 Menu.Menu

Menu.Menu

Syntax 1
public Menu()
Description
Constructs a new menu with an empty label. This menu is not a tear-off menu.

Syntax 2
public Menu( String label )
Parameters
label
the menu's label in the menu bar, or in another menu of which this menu is a submenu.
Description
Constructs a new menu with the specified label. This menu is not a tear-off menu.

Syntax 3
public Menu( String label, boolean tearOff )
Parameters
label
the menu's label in the menu bar, or in another menu of which this menu is a submenu.
tearOff
if true, the menu is a tear-off menu.
Description
Constructs a new menu with the specified label. If the value of tearOff is true, the menu can be torn off.

Tear-off functionality may not be supported by all implementations of AWT. If a particular implementation doesn't support tear-off menus, this value is silently ignored.


 Menu.add

Menu.add

Syntax 1
public synchronized MenuItem add( MenuItem mi )
Parameters
mi
the menu item to be added.
Returns
the menu item added.
Description
Adds the specified menu item to this menu. If the menu item has been part of another menu, remove it from that menu.

See Also
insert, insert

Syntax 2
public void add( String label )
Parameters
label
the text on the item.
Description
Adds an item with the specified label to this menu.

See Also
insert, insert


 Menu.addNotify

Menu.addNotify

Syntax
public void addNotify()
Description
Creates the menu's peer. The peer allows us to modify the appearance of the menu without changing its functionality.

Overrides
addNotify in class MenuItem


 Menu.addSeparator

Menu.addSeparator

Syntax
public void addSeparator()
Description
Adds a separator line, or a hypen, to the menu at the current position.

See Also
insertSeparator


 Menu.countItems

Menu.countItems

Syntax
public int countItems()
Description
Note: countItems() is deprecated. As of JDK version 1.1, replaced by getItemCount().


 Menu.getItem

Menu.getItem

Syntax
public MenuItem getItem( int index )
Parameters
index
the position of the item to be returned.
Returns
the item located at the specified index.
Description
Gets the item located at the specified index of this menu.


 Menu.getItemCount

Menu.getItemCount

Syntax
public int getItemCount()
Returns
the number of items in this menu.
Description
Get the number of items in this menu.


 Menu.insert

Menu.insert

Syntax 1
public synchronized void insert( MenuItem menuitem, int index )
Parameters
menuitem
the menu item to be inserted.
index
the position at which the menu item should be inserted.
Description
Inserts a menu item into this menu at the specified position.

Exceptions
IllegalArgumentException if the value of index is less than zero.
See Also
add, add

Syntax 2
public void insert( String label, int index )
Parameters
label
the text on the item.
index
the position at which the menu item should be inserted.
Description
Inserts a menu item with the specified label into this menu at the specified position.

See Also
add, add


 Menu.insertSeparator

Menu.insertSeparator

Syntax
public void insertSeparator( int index )
Parameters
index
the position at which the menu separator should be inserted.
Description
Inserts a separator at the specified position.

Exceptions
IllegalArgumentException if the value of index is less than 0.
See Also
addSeparator


 Menu.isTearOff

Menu.isTearOff

Syntax
public boolean isTearOff()
Returns
true if this is a tear-off menu; false otherwise.
Description
Indicates whether this menu is a tear-off menu.

Tear-off functionality may not be supported by all implementations of AWT. If a particular implementation doesn't support tear-off menus, this value is silently ignored.


 Menu.paramString

Menu.paramString

Syntax
public String paramString()
Description
Gets the parameter string representing the state of this menu. This string is useful for debugging.

Overrides
paramString in class MenuItem


 Menu.remove

Menu.remove

Syntax 1
public synchronized void remove( int index )
Parameters
index
the position of the item to be removed.
Description
Removes the menu item at the specified index from this menu.

Syntax 2
public synchronized void remove( MenuComponent item )
Parameters
item
the item to be removed from the menu
Description
Removes the specified menu item from this menu.


 Menu.removeAll

Menu.removeAll

Syntax
public synchronized void removeAll()
Description
Removes all items from this menu.


 Menu.removeNotify

Menu.removeNotify

Syntax
public void removeNotify()
Description
Removes the menu's peer. The peer allows us to modify the appearance of the menu without changing its functionality.

Overrides
removeNotify in class MenuComponent


 Class MenuBar

Class java.awt.MenuBar

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.MenuComponent
           |
           +----java.awt.MenuBar

public class MenuBar
extends MenuComponent
implements MenuContainer

The MenuBar class encapsulates the platform's concept of a menu bar bound to a frame. In order to associate the menu bar with a Frame object, call the frame's setMenuBar method.

This is what a menu bar might look like:

A menu bar handles keyboard shortcuts for menu items, passing them along to its child menus. (Keyboard shortcuts, which are optional, provide the user with an alternative to the mouse for invoking a menu item and the action that is associated with it.) Each menu item can maintain an instance of MenuShortcut. The MenuBar class defines several methods, shortCuts and getShortcutMenuItem that retrieve information about the shortcuts a given menu bar is managing.

See Also:
Frame, setMenuBar, Menu, MenuItem, MenuShortcut


 MenuBar Members

MenuBar Members

Class Overview | This Package | All Packages

Constructors
Name | Description
MenuBar() | Creates a new menu bar.

Methods
Name | Description
add(Menu) | Adds the specified menu to the menu bar.
addNotify() | Creates the menu bar's peer.
countMenus() | Deprecated.
deleteShortcut(MenuShortcut) | Deletes the specified menu shortcut.
getHelpMenu() | Gets the help menu on the menu bar.
getMenu(int) | Gets the specified menu.
getMenuCount() | Gets the number of menus on the menu bar.
getShortcutMenuItem(MenuShortcut) | Gets the instance of MenuItem associated with the specified MenuShortcut object, or null if none has been specified.
remove(int) | Removes the menu located at the specified index from this menu bar.
remove(MenuComponent) | Removes the specified menu component from this menu bar.
removeNotify() | Removes the menu bar's peer.
setHelpMenu(Menu) | Sets the help menu on this menu bar to be the specified menu.
shortcuts() | Gets an enumeration of all menu shortcuts this menu bar is managing.


 MenuBar.MenuBar

MenuBar.MenuBar

Syntax
public MenuBar()
Description
Creates a new menu bar.


 MenuBar.add

MenuBar.add

Syntax
public synchronized Menu add( Menu m )
Parameters
m
the menu to be added.
Returns
the menu added.
Description
Adds the specified menu to the menu bar.

See Also
remove, remove


 MenuBar.addNotify

MenuBar.addNotify

Syntax
public void addNotify()
Description
Creates the menu bar's peer. The peer allows us to change the appearance of the menu bar without changing any of the menu bar's functionality.


 MenuBar.countMenus

MenuBar.countMenus

Syntax
public int countMenus()
Description
Note: countMenus() is deprecated. As of JDK version 1.1, replaced by getMenuCount().


 MenuBar.deleteShortcut

MenuBar.deleteShortcut

Syntax
public void deleteShortcut( MenuShortcut s )
Parameters
s
the menu shortcut to delete.
Description
Deletes the specified menu shortcut.


 MenuBar.getHelpMenu

MenuBar.getHelpMenu

Syntax
public Menu getHelpMenu()
Returns
the help menu on this menu bar.
Description
Gets the help menu on the menu bar.


 MenuBar.getMenu

MenuBar.getMenu

Syntax
public Menu getMenu( int i )
Parameters
i
the index position of the menu to be returned.
Returns
the menu at the specified index of this menu bar.
Description
Gets the specified menu.


 MenuBar.getMenuCount

MenuBar.getMenuCount

Syntax
public int getMenuCount()
Returns
the number of menus on the menu bar.
Description
Gets the number of menus on the menu bar.


 MenuBar.getShortcutMenuItem

MenuBar.getShortcutMenuItem

Syntax
public MenuItem getShortcutMenuItem( MenuShortcut s )
Parameters
s
the specified menu shortcut.
Description
Gets the instance of MenuItem associated with the specified MenuShortcut object, or null if none has been specified.

See Also
MenuItem, MenuShortcut


 MenuBar.remove

MenuBar.remove

Syntax 1
public synchronized void remove( int index )
Parameters
index
the position of the menu to be removed.
Description
Removes the menu located at the specified index from this menu bar.

See Also
add

Syntax 2
public synchronized void remove( MenuComponent m )
Parameters
m
the menu component to be removed.
Description
Removes the specified menu component from this menu bar.

See Also
add


 MenuBar.removeNotify

MenuBar.removeNotify

Syntax
public void removeNotify()
Description
Removes the menu bar's peer. The peer allows us to change the appearance of the menu bar without changing any of the menu bar's functionality.

Overrides
removeNotify in class MenuComponent


 MenuBar.setHelpMenu

MenuBar.setHelpMenu

Syntax
public synchronized void setHelpMenu( Menu m )
Parameters
m
the menu to be set as the help menu.
Description
Sets the help menu on this menu bar to be the specified menu.


 MenuBar.shortcuts

MenuBar.shortcuts

Syntax
public synchronized Enumeration shortcuts()
Returns
an enumeration of menu shortcuts that this menu bar is managing.
Description
Gets an enumeration of all menu shortcuts this menu bar is managing.

See Also
MenuShortcut


 Class MenuComponent

Class java.awt.MenuComponent

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.MenuComponent

public abstract class MenuComponent
extends Object
implements Serializable

The abstract class MenuComponent is the superclass of all menu-related components. In this respect, the class MenuComponent is analogous to the abstract superclass Component for AWT components.

Menu components receive and process AWT events, just as components do, through the method processEvent.


 MenuComponent Members

MenuComponent Members

Class Overview | This Package | All Packages

Constructors
Name | Description
MenuComponent() |

Methods
Name | Description
dispatchEvent(AWTEvent) |
getFont() | Gets the font used for this menu component.
getName() | Gets the name of the menu component.
getParent() | Returns the parent container for this menu component.
getPeer() | Deprecated.
paramString() | Returns the parameter string representing the state of this menu component.
postEvent(Event) | Posts the specified event to the menu. Deprecated.
processEvent(AWTEvent) | Processes events occurring on this menu component.
removeNotify() | Removes the menu component's peer.
setFont(Font) | Sets the font to be used for this menu component to the specified font.
setName(String) | Sets the name of the component to the specified string.
toString() | Returns a representation of this menu component as a string.


 MenuComponent.MenuComponent

MenuComponent.MenuComponent

Syntax
public MenuComponent()


 MenuComponent.dispatchEvent

MenuComponent.dispatchEvent

Syntax
public final void dispatchEvent( AWTEvent e )


 MenuComponent.getFont

MenuComponent.getFont

Syntax
public Font getFont()
Returns
the font used in this menu component, if there is one; null otherwise.
Description
Gets the font used for this menu component.

See Also
setFont


 MenuComponent.getName

MenuComponent.getName

Syntax
public String getName()
Returns
the name of the menu component.
Description
Gets the name of the menu component.

See Also
setName


 MenuComponent.getParent

MenuComponent.getParent

Syntax
public MenuContainer getParent()
Returns
the menu component containing this menu component, or null if this menu component is the outermost component, the menu bar itself.
Description
Returns the parent container for this menu component.


 MenuComponent.getPeer

MenuComponent.getPeer

Syntax
public MenuComponentPeer getPeer()
Description
Note: getPeer() is deprecated. As of JDK version 1.1, programs should not directly manipulate peers.


 MenuComponent.paramString

MenuComponent.paramString

Syntax
protected String paramString()
Returns
the parameter string of this menu component.
Description
Returns the parameter string representing the state of this menu component. This string is useful for debugging.


 MenuComponent.postEvent

MenuComponent.postEvent

Syntax
public boolean postEvent( Event evt )
Parameters
evt
the event which is to take place
Description
Note: postEvent() is deprecated. As of JDK version 1.1, replaced by dispatchEvent(AWTEvent).

Posts the specified event to the menu. This method is part of the Java 1.0 event system and it is maintained only for backwards compatibility. Its use is discouraged, and it may not be supported in the future.


 MenuComponent.processEvent

MenuComponent.processEvent

Syntax
protected void processEvent( AWTEvent e )
Parameters
e
the event
Description
Processes events occurring on this menu component.


 MenuComponent.removeNotify

MenuComponent.removeNotify

Syntax
public void removeNotify()
Description
Removes the menu component's peer. The peer allows us to modify the appearance of the menu component without changing the functionality of the menu component.


 MenuComponent.setFont

MenuComponent.setFont

Syntax
public void setFont( Font f )
Parameters
f
the font to be set.
Description
Sets the font to be used for this menu component to the specified font. This font is also used by all subcomponents of this menu component, unless those subcomponents specify a different font.

See Also
getFont


 MenuComponent.setName

MenuComponent.setName

Syntax
public void setName( String name )
Parameters
name
the name of the menu component.
Description
Sets the name of the component to the specified string.

See Also
getName


 MenuComponent.toString

MenuComponent.toString

Syntax
public String toString()
Returns
a string representation of this menu component.
Description
Returns a representation of this menu component as a string.

Overrides
toString in class Object


 Interface MenuContainer

Interface java.awt.MenuContainer

Interface Members | This Package | All Packages

public interface MenuContainer

The super class of all menu related containers.


 MenuContainer Members

MenuContainer Members

Interface Overview | This Package | All Packages

Methods
Name | Description
getFont() |
postEvent(Event) | Deprecated.
remove(MenuComponent) |


 MenuContainer.getFont

MenuContainer.getFont

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Font getFont()


 MenuContainer.postEvent

MenuContainer.postEvent

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean postEvent( Event evt )
Description
Note: postEvent() is deprecated. As of JDK version 1.1 replaced by dispatchEvent(AWTEvent).


 MenuContainer.remove

MenuContainer.remove

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void remove( MenuComponent comp )


 Class MenuItem

Class java.awt.MenuItem

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.MenuComponent
           |
           +----java.awt.MenuItem

public class MenuItem
extends MenuComponent

All items in a menu must belong to the class MenuItem, or one of its subclasses.

The default MenuItem object embodies a simple labeled menu item.

This picture of a menu bar shows five menu items:
The first two items are simple menu items, labeled "Basic" and "Simple". Following these two items is a separator, which is itself a menu item, created with the label "-". Next is an instance of CheckboxMenuItem labeled "Check". The final menu item is a submenu labeled "More Examples", and this submenu is an instance of Menu.

When a menu item is selected, AWT sends an action event to the menu item. Since the event is an instance of ActionEvent, the processEvent method examines the event and passes it along to processActionEvent. The latter method redirects the event to any ActionListener objects that have registered an interest in action events generated by this menu item.

Note that the subclass Menu overrides this behavior and does not send any event to the frame until one of its subitems is selected.


 MenuItem Members

MenuItem Members

Class Overview | This Package | All Packages

Constructors
Name | Description
MenuItem() | Constructs a new MenuItem with an empty label and no keyboard shortcut.
MenuItem(String) | Constructs a new MenuItem with the specified label and no keyboard shortcut.
MenuItem(String, MenuShortcut) | Create a menu item with an associated keyboard shortcut.

Methods
Name | Description
addActionListener(ActionListener) | Adds the specified action listener to receive action events from this menu item.
addNotify() | Creates the menu item's peer.
deleteShortcut() | Delete any MenuShortcut object associated with this menu item.
disable() | Deprecated.
disableEvents(long) | Disables event delivery to this menu item for events defined by the specified event mask parameter.
enable() | Deprecated.
enable(boolean) | Deprecated.
enableEvents(long) | Enables event delivery to this menu item for events to be defined by the specified event mask parameter Since event types are automatically enabled when a listener for that type is added to the menu item, this method only needs to be invoked by subclasses of MenuItem which desire to have the specified event types delivered to processEvent regardless of whether a listener is registered.
getActionCommand() | Gets the command name of the action event that is fired by this menu item.
getLabel() | Gets the label for this menu item.
getShortcut() | Get the MenuShortcut object associated with this menu item,
isEnabled() | Checks whether this menu item is enabled.
paramString() | Returns the parameter string representing the state of this menu item.
processActionEvent(ActionEvent) | Processes action events occurring on this menu item, by dispatching them to any registered ActionListener objects.
processEvent(AWTEvent) | Processes events on this menu item.
removeActionListener(ActionListener) | Removes the specified action listener so it no longer receives action events from this menu item.
setActionCommand(String) | Sets the command name of the action event that is fired by this menu item.
setEnabled(boolean) | Sets whether or not this menu item can be chosen.
setLabel(String) | Sets the label for this menu item to the specified label.
setShortcut(MenuShortcut) | Set the MenuShortcut object associated with this menu item.


 MenuItem.MenuItem

MenuItem.MenuItem

Syntax 1
public MenuItem()
Description
Constructs a new MenuItem with an empty label and no keyboard shortcut.

Syntax 2
public MenuItem( String label )
Parameters
label
the label for this menu item.
Description
Constructs a new MenuItem with the specified label and no keyboard shortcut. Note that use of "-" in a label is reserved to indicate a separator between menu items. By default, all menu items except for separators are enabled.

Syntax 3
public MenuItem( String label, MenuShortcut s )
Parameters
label
the label for this menu item.
s
the instance of MenuShortcut associated with this menu item.
Description
Create a menu item with an associated keyboard shortcut. Note that use of "-" in a label is reserved to indicate a separator between menu items. By default, all menu items except for separators are enabled.


 MenuItem.addActionListener

MenuItem.addActionListener

Syntax
public synchronized void addActionListener( ActionListener l )
Parameters
l
the action listener.
Description
Adds the specified action listener to receive action events from this menu item.

See Also
ActionEvent, ActionListener, removeActionListener


 MenuItem.addNotify

MenuItem.addNotify

Syntax
public void addNotify()
Description
Creates the menu item's peer. The peer allows us to modify the appearance of the menu item without changing its functionality.


 MenuItem.deleteShortcut

MenuItem.deleteShortcut

Syntax
public void deleteShortcut()
Description
Delete any MenuShortcut object associated with this menu item.


 MenuItem.disable

MenuItem.disable

Syntax
public synchronized void disable()
Description
Note: disable() is deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).


 MenuItem.disableEvents

MenuItem.disableEvents

Syntax
protected final void disableEvents( long eventsToDisable )
Parameters
eventsToDisable
the event mask defining the event types.
Description
Disables event delivery to this menu item for events defined by the specified event mask parameter.

See Also
processEvent, enableEvents, disableEvents


 MenuItem.enable

MenuItem.enable

Syntax 1
public synchronized void enable()
Description
Note: enable() is deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).

Syntax 2
public void enable( boolean b )
Description
Note: enable() is deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).


 MenuItem.enableEvents

MenuItem.enableEvents

Syntax
protected final void enableEvents( long eventsToEnable )
Parameters
eventsToEnable
the event mask defining the event types.
Description
Enables event delivery to this menu item for events to be defined by the specified event mask parameter

Since event types are automatically enabled when a listener for that type is added to the menu item, this method only needs to be invoked by subclasses of MenuItem which desire to have the specified event types delivered to processEvent regardless of whether a listener is registered.

See Also
processEvent, disableEvents, enableEvents


 MenuItem.getActionCommand

MenuItem.getActionCommand

Syntax
public String getActionCommand()
Description
Gets the command name of the action event that is fired by this menu item.

See Also
setActionCommand


 MenuItem.getLabel

MenuItem.getLabel

Syntax
public String getLabel()
Returns
the label of this menu item, or null if this menu item has no label.
Description
Gets the label for this menu item.

See Also
setLabel


 MenuItem.getShortcut

MenuItem.getShortcut

Syntax
public MenuShortcut getShortcut()
Returns
the menu shortcut associated with this menu item, or null if none has been specified.
Description
Get the MenuShortcut object associated with this menu item,

See Also
setShortcut


 MenuItem.isEnabled

MenuItem.isEnabled

Syntax
public boolean isEnabled()
Description
Checks whether this menu item is enabled.

See Also
setEnabled


 MenuItem.paramString

MenuItem.paramString

Syntax
public String paramString()
Returns
the parameter string of this menu item.
Description
Returns the parameter string representing the state of this menu item. This string is useful for debugging.

Overrides
paramString in class MenuComponent


 MenuItem.processActionEvent

MenuItem.processActionEvent

Syntax
protected void processActionEvent( ActionEvent e )
Parameters
e
the action event.
Description
Processes action events occurring on this menu item, by dispatching them to any registered ActionListener objects. This method is not called unless action events are enabled for this component. Action events are enabled when one of the following occurs:

  • An ActionListener object is registered via addActionListener.
  • Action events are enabled via enableEvents.

See Also
ActionEvent, ActionListener, enableEvents


 MenuItem.processEvent

MenuItem.processEvent

Syntax
protected void processEvent( AWTEvent e )
Parameters
e
the event.
Description
Processes events on this menu item. If the event is an instance of ActionEvent, it invokes processActionEvent, another method defined by MenuItem.

Currently, menu items only support action events.

Overrides
processEvent in class MenuComponent
See Also
processActionEvent


 MenuItem.removeActionListener

MenuItem.removeActionListener

Syntax
public synchronized void removeActionListener( ActionListener l )
Parameters
l
the action listener.
Description
Removes the specified action listener so it no longer receives action events from this menu item.

See Also
ActionEvent, ActionListener, addActionListener


 MenuItem.setActionCommand

MenuItem.setActionCommand

Syntax
public void setActionCommand( String command )
Parameters
command
the action command to be set for this menu item.
Description
Sets the command name of the action event that is fired by this menu item.

By default, the action command is set to the label of the menu item.

See Also
getActionCommand


 MenuItem.setEnabled

MenuItem.setEnabled

Syntax
public synchronized void setEnabled( boolean b )
Parameters
b
if true, enables this menu item; if false, disables it.
Description
Sets whether or not this menu item can be chosen.

See Also
isEnabled


 MenuItem.setLabel

MenuItem.setLabel

Syntax
public synchronized void setLabel( String label )
Parameters
label
the new label, or null for no label.
Description
Sets the label for this menu item to the specified label.

See Also
getLabel


 MenuItem.setShortcut

MenuItem.setShortcut

Syntax
public void setShortcut( MenuShortcut s )
Parameters
s
the menu shortcut to associate with this menu item.
Description
Set the MenuShortcut object associated with this menu item. If a menu shortcut is already associated with this menu item, it is replaced.

See Also
getShortcut


 Class MenuShortcut

Class java.awt.MenuShortcut

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.MenuShortcut

public class MenuShortcut
extends Object
implements Serializable

A class which represents a keyboard accelerator for a MenuItem.


 MenuShortcut Members

MenuShortcut Members

Class Overview | This Package | All Packages

Constructors
Name | Description
MenuShortcut(int) | Constructs a new MenuShortcut for the specified key.
MenuShortcut(int, boolean) | Constructs a new MenuShortcut for the specified key.

Methods
Name | Description
equals(MenuShortcut) | Returns whether this MenuShortcut is the same as another: equality is defined to mean that both MenuShortcuts use the same key and both either use or don't use the SHIFT key.
getKey() | Return the raw keycode of this MenuShortcut.
paramString() |
toString() | Returns an internationalized description of the MenuShortcut.
usesShiftModifier() | Return whether this MenuShortcut must be invoked using the SHIFT key.


 MenuShortcut.MenuShortcut

MenuShortcut.MenuShortcut

Syntax 1
public MenuShortcut( int key )
Parameters
key
the raw keycode for this MenuShortcut, as would be returned in the keyCode field of a KeyEvent if this key were pressed.
Description
Constructs a new MenuShortcut for the specified key.

Syntax 2
public MenuShortcut( int key, boolean useShiftModifier )
Parameters
key
the raw keycode for this MenuShortcut, as would be returned in the keyCode field of a KeyEvent if this key were pressed.
useShiftModifier
indicates whether this MenuShortcut is invoked with the SHIFT key down.
Description
Constructs a new MenuShortcut for the specified key.


 MenuShortcut.equals

MenuShortcut.equals

Syntax
public boolean equals( MenuShortcut s )
Parameters
s
the MenuShortcut to compare with this.
Description
Returns whether this MenuShortcut is the same as another: equality is defined to mean that both MenuShortcuts use the same key and both either use or don't use the SHIFT key.


 MenuShortcut.getKey

MenuShortcut.getKey

Syntax
public int getKey()
Description
Return the raw keycode of this MenuShortcut.


 MenuShortcut.paramString

MenuShortcut.paramString

Syntax
protected String paramString()


 MenuShortcut.toString

MenuShortcut.toString

Syntax
public String toString()
Description
Returns an internationalized description of the MenuShortcut.

Overrides
toString in class Object


 MenuShortcut.usesShiftModifier

MenuShortcut.usesShiftModifier

Syntax
public boolean usesShiftModifier()
Description
Return whether this MenuShortcut must be invoked using the SHIFT key.


 Class Panel

Class java.awt.Panel

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel

public class Panel
extends Container

Panel is the simplest container class. A panel provides space in which an application can attach any other component, including other panels.

The default layout manager for a panel is the FlowLayout layout manager.

See Also:
FlowLayout


 Panel Members

Panel Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Panel() | Creates a new panel using the default layout manager.
Panel(LayoutManager) | Creates a new panel with the specified layout manager.

Methods
Name | Description
addNotify() | Creates the Panel's peer.


 Panel.Panel

Panel.Panel

Syntax 1
public Panel()
Description
Creates a new panel using the default layout manager. The default layout manager for all panels is the FlowLayout class.

Syntax 2
public Panel( LayoutManager layout )
Parameters
layout
the layout manager for this panel.
Description
Creates a new panel with the specified layout manager.


 Panel.addNotify

Panel.addNotify

Syntax
public void addNotify()
Description
Creates the Panel's peer. The peer allows you to modify the appearance of the panel without changing its functionality.

Overrides
addNotify in class Container


 Class Point

Class java.awt.Point

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Point

public class Point
extends Object
implements Serializable

The Point class represents a location in a two-dimensional (x, y) coordinate space.


 Point Members

Point Members

Class Overview | This Package | All Packages

Fields
Name | Description
x | The x coordinate.
y | The y coordinate.

Constructors
Name | Description
Point() | Constructs and initializes a point at the origin (0, 0) of the coordinate space.
Point(int, int) | Constructs and initializes a point at the specified (x, y) location in the coordinate space.
Point(Point) | Constructs and initializes a point with the same location as the specified Point object.

Methods
Name | Description
equals(Object) | Determines whether two points are equal.
getLocation() | Returns the location of this point.
hashCode() | Returns the hashcode for this point.
move(int, int) | Moves this point to the specificed location in the (x, y) coordinate plane.
setLocation(int, int) | Changes the point to have the specificed location.
setLocation(Point) | Sets the location of the point to the specificed location.
toString() | Returns a representation of this point and its location in the (x, y) coordinate space as a string.
translate(int, int) | Translates this point, at location (x, y), by dx along the x axis and dy along the y axis so that it now represents the point (x + dx, y + dy).


 Point.x

Point.x

Syntax
public int x
Description
The x coordinate.


 Point.y

Point.y

Syntax
public int y
Description
The y coordinate.


 Point.Point

Point.Point

Syntax 1
public Point()
Parameters
x
the x coordinate.
y
the y coordinate.
Description
Constructs and initializes a point at the origin (0, 0) of the coordinate space.

Syntax 2
public Point( Point p )
Parameters
p
a point.
Description
Constructs and initializes a point with the same location as the specified Point object.

Syntax 3
public Point( int x, int y )
Parameters
x
the x coordinate.
y
the y coordinate.
Description
Constructs and initializes a point at the specified (x, y) location in the coordinate space.


 Point.equals

Point.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
an object to be compared with this point.
Returns
true if the object to be compared is an instance of Point and has the same values; false otherwise.
Description
Determines whether two points are equal. Two instances of Point are equal if the values of their x and y member fields, representing their position in the coordinate space, are the same.

Overrides
equals in class Object


 Point.getLocation

Point.getLocation

Syntax
public Point getLocation()
Returns
a copy of this point, at the same location.
Description
Returns the location of this point. This method is included for completeness, to parallel the getLocation method of Component.

See Also
getLocation, setLocation, setLocation


 Point.hashCode

Point.hashCode

Syntax
public int hashCode()
Returns
a hash code for this point.
Description
Returns the hashcode for this point.

Overrides
hashCode in class Object


 Point.move

Point.move

Syntax
public void move( int x, int y )
Parameters
x
the x coordinate of the new location.
y
the y coordinate of the new location.
Description
Moves this point to the specificed location in the (x, y) coordinate plane. This method is identical with setLocation(int, int).

See Also
setLocation


 Point.setLocation

Point.setLocation

Syntax 1
public void setLocation( Point p )
Parameters
p
a point, the new location for this point.
Description
Sets the location of the point to the specificed location. This method is included for completeness, to parallel the setLocation method of Component.

See Also
setLocation, getLocation

Syntax 2
public void setLocation( int x, int y )
Parameters
x
the x coordinate of the new location.
y
the y coordinate of the new location.
Description
Changes the point to have the specificed location.

This method is included for completeness, to parallel the setLocation method of Component. Its behavior is identical with move(int, int).

See Also
setLocation, getLocation, move


 Point.toString

Point.toString

Syntax
public String toString()
Returns
a string representation of this point, including the values of its member fields.
Description
Returns a representation of this point and its location in the (x, y) coordinate space as a string.

Overrides
toString in class Object


 Point.translate

Point.translate

Syntax
public void translate( int x, int y )
Parameters
dx
the distance to move this point along the x axis.
dy
the distance to move this point along the y axis.
Description
Translates this point, at location (x, y), by dx along the x axis and dy along the y axis so that it now represents the point (x + dx, y + dy).


 Class Polygon

Class java.awt.Polygon

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Polygon

public class Polygon
extends Object
implements Shape, Serializable

The Polygon class encapsulates a description of a closed, two-dimensional region within a coordinate space. This region is bounded by an arbitrary number of line segments, each of which is one side of the polygon. Internally, a polygon comprises of a list of (x, y) coordinate pairs, where each pair defines a vertex of the polygon, and two successive pairs are the endpoints of a line that is a side of the polygon. The first and final pairs of (x, y) points are joined by a line segment that closes the polygon.


 Polygon Members

Polygon Members

Class Overview | This Package | All Packages

Fields
Name | Description
bounds |
npoints | The total number of points.
xpoints | The array of x coordinates.
ypoints | The array of y coordinates.

Constructors
Name | Description
Polygon() | Creates an empty polygon.
Polygon(int[], int[], int) | Constructs and initializes a polygon from the specified parameters.

Methods
Name | Description
addPoint(int, int) | Appends a point to this polygon.
contains(int, int) | Determines whether the specified point is contained by this polygon.
contains(Point) | Determines whether the specified point is inside the Polygon.
getBoundingBox() | Deprecated.
getBounds() | Gets the bounding box of this polygon.
inside(int, int) | Deprecated.
translate(int, int) | Translates the vertices by deltaX along the x axis and by deltaY along the y axis.


 Polygon.bounds

Polygon.bounds

Syntax
protected Rectangle bounds


 Polygon.npoints

Polygon.npoints

Syntax
public int npoints
Description
The total number of points.


 Polygon.xpoints

Polygon.xpoints

Syntax
public int xpoints[]
Description
The array of x coordinates.


 Polygon.ypoints

Polygon.ypoints

Syntax
public int ypoints[]
Description
The array of y coordinates.


 Polygon.Polygon

Polygon.Polygon

Syntax 1
public Polygon()
Description
Creates an empty polygon.

Syntax 2
public Polygon( int xpoints[], int ypoints[], int npoints )
Parameters
xpoints
an array of x coordinates.
ypoints
an array of y coordinates.
npoints
the total number of points in the polygon.
Description
Constructs and initializes a polygon from the specified parameters.

Exceptions
NegativeArraySizeException if the value of npoints is negative.


 Polygon.addPoint

Polygon.addPoint

Syntax
public void addPoint( int x, int y )
Parameters
x
the x coordinate of the point.
y
the y coordinate of the point.
Description
Appends a point to this polygon.

If an operation that calculates the bounding box of this polygon has already been performed, such as getBounds or contains, then this method updates the bounding box.

See Also
getBounds, contains


 Polygon.contains

Polygon.contains

Syntax 1
public boolean contains( Point p )
Parameters
p
the point to be tested
Description
Determines whether the specified point is inside the Polygon. Uses an even-odd insideness rule (also known as an alternating rule).

Syntax 2
public boolean contains( int x, int y )
Parameters
x
the x coordinate of the point to be tested.
y
the y coordinate of the point to be tested.
Returns
true if the point (x, y) is contained by this polygon; false otherwise.
Description
Determines whether the specified point is contained by this polygon.

(The contains method is based on code by Hanpeter van Vliet [hvvliet@inter.nl.net].)


 Polygon.getBoundingBox

Polygon.getBoundingBox

Syntax
public Rectangle getBoundingBox()
Description
Note: getBoundingBox() is deprecated. As of JDK version 1.1, replaced by getBounds().


 Polygon.getBounds

Polygon.getBounds

Syntax
public Rectangle getBounds()
Returns
a rectangle that defines the bounds of this polygon.
Description
Gets the bounding box of this polygon. The bounding box is the smallest rectangle whose sides are parallel to the x and y axes of the coordinate space, and that can completely contain the polygon.


 Polygon.inside

Polygon.inside

Syntax
public boolean inside( int x, int y )
Description
Note: inside() is deprecated. As of JDK version 1.1, replaced by contains(int, int).


 Polygon.translate

Polygon.translate

Syntax
public void translate( int deltaX, int deltaY )
Parameters
deltaX
the amount to translate along the x axis
deltaY
the amount to translate along the y axis
Description
Translates the vertices by deltaX along the x axis and by deltaY along the y axis.


 Class PopupMenu

Class java.awt.PopupMenu

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.MenuComponent
           |
           +----java.awt.MenuItem
                   |
                   +----java.awt.Menu
                           |
                           +----java.awt.PopupMenu

public class PopupMenu
extends Menu

A class that implements a menu which can be dynamically popped up at a specified position within a component.


 PopupMenu Members

PopupMenu Members

Class Overview | This Package | All Packages

Constructors
Name | Description
PopupMenu() | Creates a new popup menu.
PopupMenu(String) | Creates a new popup menu with the specified name.

Methods
Name | Description
addNotify() | Creates the popup menu's peer.
show(Component, int, int) | Shows the popup menu at the x, y position relative to an origin component.


 PopupMenu.PopupMenu

PopupMenu.PopupMenu

Syntax 1
public PopupMenu()
Description
Creates a new popup menu.

Syntax 2
public PopupMenu( String label )
Parameters
title
the title string for the popup menu
Description
Creates a new popup menu with the specified name.


 PopupMenu.addNotify

PopupMenu.addNotify

Syntax
public synchronized void addNotify()
Description
Creates the popup menu's peer. The peer allows us to change the appearance of the popup menu without changing any of the popup menu's functionality.

Overrides
addNotify in class Menu


 PopupMenu.show

PopupMenu.show

Syntax
public void show( Component origin, int x, int y )
Parameters
origin
the component which defines the coordinate space
x
the x coordinate position to popup the menu
y
the y coordinate position to popup the menu
Description
Shows the popup menu at the x, y position relative to an origin component. The origin component must be contained within the component hierarchy of the popup menu's parent. Both the origin and the parent must be showing on the screen for this method to be valid.


 Interface PrintGraphics

Interface java.awt.PrintGraphics

Interface Members | This Package | All Packages

public interface PrintGraphics

An abstract class which provides a print graphics context for a page.


 PrintGraphics Members

PrintGraphics Members

Interface Overview | This Package | All Packages

Methods
Name | Description
getPrintJob() | Returns the PrintJob object from which this PrintGraphics object originated.


 PrintGraphics.getPrintJob

PrintGraphics.getPrintJob

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract PrintJob getPrintJob()
Description
Returns the PrintJob object from which this PrintGraphics object originated.


 Class PrintJob

Class java.awt.PrintJob

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.PrintJob

public abstract class PrintJob
extends Object

An abstract class which initiates and executes a print job. It provides access to a print graphics object which renders to an appropriate print device.

See Also:
getPrintJob


 PrintJob Members

PrintJob Members

Class Overview | This Package | All Packages

Constructors
Name | Description
PrintJob() |

Methods
Name | Description
end() | Ends the print job and does any necessary cleanup.
finalize() | Ends this print job once it is no longer referenced.
getGraphics() | Gets a Graphics object that will draw to the next page.
getPageDimension() | Returns the dimensions of the page in pixels.
getPageResolution() | Returns the resolution of the page in pixels per inch.
lastPageFirst() | Returns true if the last page will be printed first.


 PrintJob.PrintJob

PrintJob.PrintJob

Syntax
public PrintJob()


 PrintJob.end

PrintJob.end

Syntax
public abstract void end()
Description
Ends the print job and does any necessary cleanup.


 PrintJob.finalize

PrintJob.finalize

Syntax
public void finalize()
Description
Ends this print job once it is no longer referenced.

Overrides
finalize in class Object
See Also
end


 PrintJob.getGraphics

PrintJob.getGraphics

Syntax
public abstract Graphics getGraphics()
Description
Gets a Graphics object that will draw to the next page. The page is sent to the printer when the graphics object is disposed. This graphics object will also implement the PrintGraphics interface.

See Also
PrintGraphics


 PrintJob.getPageDimension

PrintJob.getPageDimension

Syntax
public abstract Dimension getPageDimension()
Description
Returns the dimensions of the page in pixels. The resolution of the page is chosen so that it is similar to the screen resolution.


 PrintJob.getPageResolution

PrintJob.getPageResolution

Syntax
public abstract int getPageResolution()
Description
Returns the resolution of the page in pixels per inch. Note that this doesn't have to correspond to the physical resolution of the printer.


 PrintJob.lastPageFirst

PrintJob.lastPageFirst

Syntax
public abstract boolean lastPageFirst()
Description
Returns true if the last page will be printed first.


 Class Rectangle

Class java.awt.Rectangle

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Rectangle

public class Rectangle
extends Object
implements Shape, Serializable

A rectangle specifies an area in a coordinate space that is defined by the rectangle's top-left point (x, y) in the coordinate space, its width, and its height.

A rectangle's width and height are public fields. The constructors that allow you to create a rectangle, and the methods that allow you to modify one, do not prevent you from setting a negative value for width or height.

A rectangle whose width or height is negative is considered empty, and all methods defined by the Rectangle class behave accordingly. If the rectangle is empty, then the method isEmpty returns true. No point can be contained by or inside an empty rectangle, however the values of width and height are still valid. An empty rectangle still has a location in the coordinate space, and methods that change its size or location remain valid. The behavior of methods that operate on more than one rectangle is undefined if any of the participating rectangles has a negative width or height. These methods include intersects, intersection, and union.


 Rectangle Members

Rectangle Members

Class Overview | This Package | All Packages

Fields
Name | Description
height | The height of the rectangle.
width | The width of the rectangle.
x | The x coordinate of the rectangle.
y | The y coordinate of the rectangle.

Constructors
Name | Description
Rectangle() | Constructs a new rectangle whose top-left corner is at (0, 0) in the coordinate space, and whose width and height are zero.
Rectangle(Dimension) | Constructs a new rectangle whose top left corner is (0, 0) and whose width and height are specified by the dimension argument.
Rectangle(int, int) | Constructs a new rectangle whose top-left corner is at (0, 0) in the coordinate space, and whose width and height are specified by the arguments of the same name.
Rectangle(int, int, int, int) | Constructs a new rectangle whose top-left corner is specified as (x, y) and whose width and height are specified by the arguments of the same name.
Rectangle(Point) | Constructs a new rectangle whose top-left corner is the specified point, and whose width and height are zero.
Rectangle(Point, Dimension) | Constructs a new rectangle whose top-left corner is specified by the point argument, and whose width and height are specified by the dimension argument.
Rectangle(Rectangle) | Constructs a new rectangle, initialized to match the values of the specificed rectangle.

Methods
Name | Description
add(int, int) | Adds a point, specified by the integer arguments newx and newy, to a rectangle.
add(Point) | Adds a point to this rectangle.
add(Rectangle) | Adds a rectangle to this rectangle.
contains(int, int) | Checks whether this rectangle contains the point at the specified location (x, y).
contains(Point) | Checks whether this rectangle contains the specified point.
equals(Object) | Checks whether two rectangles are equal.
getBounds() | Gets the bounding rectangle of this rectangle.
getLocation() | Returns the location of this rectangle.
getSize() | Gets the size (width and height) of this rectangle.
grow(int, int) | Grows the rectangle both horizontally and vertically.
hashCode() | Returns the hashcode for this rectangle.
inside(int, int) | Deprecated.
intersection(Rectangle) | Computes the intersection of this rectangle with the specified rectangle.
intersects(Rectangle) | Determines whether this rectangle and the specified rectangle intersect.
isEmpty() | Determines whether this rectangle is empty.
move(int, int) | Deprecated.
reshape(int, int, int, int) | Deprecated.
resize(int, int) | Deprecated.
setBounds(int, int, int, int) | Sets the bounding rectangle of this rectangle to the specified values for x, y, width, and height.
setBounds(Rectangle) | Sets the bounding rectangle of this rectangle to match the specified rectangle.
setLocation(int, int) | Moves the rectangle to the specified location.
setLocation(Point) | Moves the rectangle to the specified location.
setSize(Dimension) | Sets the size of this rectangle to match the specified dimension.
setSize(int, int) | Sets the size of this rectangle to the specified width and height.
toString() | Returns a string representation of this rectangle and its values.
translate(int, int) | Translates the rectangle the indicated distance, to the right along the x coordinate axis, and downward along the y coordinate axis.
union(Rectangle) | Computes the union of this rectangle with the specified rectangle.


 Rectangle.height

Rectangle.height

Syntax
public int height
Description
The height of the rectangle.


 Rectangle.width

Rectangle.width

Syntax
public int width
Description
The width of the rectangle.


 Rectangle.x

Rectangle.x

Syntax
public int x
Description
The x coordinate of the rectangle.


 Rectangle.y

Rectangle.y

Syntax
public int y
Description
The y coordinate of the rectangle.


 Rectangle.Rectangle

Rectangle.Rectangle

Syntax 1
public Rectangle()
Description
Constructs a new rectangle whose top-left corner is at (0, 0) in the coordinate space, and whose width and height are zero.

Syntax 2
public Rectangle( Rectangle r )
Parameters
r
a rectangle from which to copy initial values.
Description
Constructs a new rectangle, initialized to match the values of the specificed rectangle.

Syntax 3
public Rectangle( int x, int y, int width, int height )
Parameters
x
the x coordinate.
y
the y coordinate.
width
the width of the rectangle.
height
the height of the rectangle.
Description
Constructs a new rectangle whose top-left corner is specified as (x, y) and whose width and height are specified by the arguments of the same name.

Syntax 4
public Rectangle( int width, int height )
Parameters
width
the width of the rectangle.
height
the height of the rectangle.
Description
Constructs a new rectangle whose top-left corner is at (0, 0) in the coordinate space, and whose width and height are specified by the arguments of the same name.

Syntax 5
public Rectangle( Point p, Dimension d )
Parameters
p
a point, the top-left corner of the rectangle.
d
a dimension, representing the width and height.
Description
Constructs a new rectangle whose top-left corner is specified by the point argument, and whose width and height are specified by the dimension argument.

Syntax 6
public Rectangle( Point p )
Parameters
p
the top left corner of the rectangle.
Description
Constructs a new rectangle whose top-left corner is the specified point, and whose width and height are zero.

Syntax 7
public Rectangle( Dimension d )
Parameters
d
a dimension, specifying width and height.
Description
Constructs a new rectangle whose top left corner is (0, 0) and whose width and height are specified by the dimension argument.


 Rectangle.add

Rectangle.add

Syntax 1
public void add( int newx, int newy )
Parameters
newx
the x coordinate of the new point.
newy
the y coordinate of the new point.
Description
Adds a point, specified by the integer arguments newx and newy, to a rectangle. The resulting rectangle is the smallest rectangle that contains both the rectangle and the specified point.

Syntax 2
public void add( Point pt )
Parameters
a
point.
Description
Adds a point to this rectangle. The resulting rectangle is the smallest rectangle that contains both the rectangle and the specified point.

Syntax 3
public void add( Rectangle r )
Parameters
a
rectangle.
Description
Adds a rectangle to this rectangle. The resulting rectangle is the union of the two rectangles.


 Rectangle.contains

Rectangle.contains

Syntax 1
public boolean contains( Point p )
Parameters
p
the point (location) to test.
Returns
true if the point (x, y) is inside this rectangle; false otherwise.
Description
Checks whether this rectangle contains the specified point.

Syntax 2
public boolean contains( int x, int y )
Parameters
x
the x coordinate.
y
the y coordinate.
Returns
true if the point (x, y) is inside this rectangle; false otherwise.
Description
Checks whether this rectangle contains the point at the specified location (x, y).


 Rectangle.equals

Rectangle.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the object to compare with.
Returns
true if the objects are equal; false otherwise.
Description
Checks whether two rectangles are equal.

The result is true if and only if the argument is not null and is a Rectangle object that has the same top-left corner, width, and height as this rectangle.

Overrides
equals in class Object


 Rectangle.getBounds

Rectangle.getBounds

Syntax
public Rectangle getBounds()
Returns
a new rectangle, equal to the bounding rectangle for this rectangle.
Description
Gets the bounding rectangle of this rectangle.

This method is included for completeness, to parallel the getBounds method of Component.

See Also
getBounds


 Rectangle.getLocation

Rectangle.getLocation

Syntax
public Point getLocation()
Description
Returns the location of this rectangle.

This method is included for completeness, to parallel the getLocation method of Component.

See Also
getLocation


 Rectangle.getSize

Rectangle.getSize

Syntax
public Dimension getSize()
Returns
a dimension, representing the size.
Description
Gets the size (width and height) of this rectangle.

This method is included for completeness, to parallel the getSize method of Component.

See Also
getSize


 Rectangle.grow

Rectangle.grow

Syntax
public void grow( int h, int v )
Parameters
h
the horizontal expansion.
v
the vertical expansion.
Description
Grows the rectangle both horizontally and vertically.

This method modifies the rectangle so that it is h units larger on both the left and right side, and v units larger at both the top and bottom.

The new rectangle has (x - h, y - v) as its top-left corner, a width of width + 2h, and a height of height + 2v.

If negative values are supplied for h and v, the size of the rectangle decreases accordingly. The grow method does not check whether the resulting values of width and height are non-negative.


 Rectangle.hashCode

Rectangle.hashCode

Syntax
public int hashCode()
Returns
the hashcode for this rectangle.
Description
Returns the hashcode for this rectangle.

Overrides
hashCode in class Object


 Rectangle.inside

Rectangle.inside

Syntax
public boolean inside( int x, int y )
Description
Note: inside() is deprecated. As of JDK version 1.1, replaced by contains(int, int).


 Rectangle.intersection

Rectangle.intersection

Syntax
public Rectangle intersection( Rectangle r )
Parameters
r
a rectangle.
Returns
the largest rectangle contained in both the specified rectangle and in this rectangle.
Description
Computes the intersection of this rectangle with the specified rectangle. Returns a new rectangle that represents the intersection of the two rectangles.


 Rectangle.intersects

Rectangle.intersects

Syntax
public boolean intersects( Rectangle r )
Parameters
r
a rectangle.
Returns
true if the specified rectangle and this rectangle insersect; false otherwise.
Description
Determines whether this rectangle and the specified rectangle intersect. Two rectangles intersect if their intersection is nonempty.


 Rectangle.isEmpty

Rectangle.isEmpty

Syntax
public boolean isEmpty()
Returns
true if this rectangle is empty; false otherwise.
Description
Determines whether this rectangle is empty. A rectangle is empty if its width or its height is less than or equal to zero.


 Rectangle.move

Rectangle.move

Syntax
public void move( int x, int y )
Description
Note: move() is deprecated. As of JDK version 1.1, replaced by setLocation(int, int).


 Rectangle.reshape

Rectangle.reshape

Syntax
public void reshape( int x, int y, int width, int height )
Description
Note: reshape() is deprecated. As of JDK version 1.1, replaced by setBounds(int, int, int, int).


 Rectangle.resize

Rectangle.resize

Syntax
public void resize( int width, int height )
Description
Note: resize() is deprecated. As of JDK version 1.1, replaced by setSize(int, int).


 Rectangle.setBounds

Rectangle.setBounds

Syntax 1
public void setBounds( Rectangle r )
Parameters
r
a rectangle.
Description
Sets the bounding rectangle of this rectangle to match the specified rectangle.

This method is included for completeness, to parallel the setBounds method of Component.

See Also
setBounds

Syntax 2
public void setBounds( int x, int y, int width, int height )
Parameters
x
the new x coordinate for the top-left corner of this rectangle.
y
the new y coordinate for the top-left corner of this rectangle.
width
the new width for this rectangle.
height
the new height for this rectangle.
Description
Sets the bounding rectangle of this rectangle to the specified values for x, y, width, and height.

This method is included for completeness, to parallel the setBounds method of Component.

See Also
setBounds


 Rectangle.setLocation

Rectangle.setLocation

Syntax 1
public void setLocation( Point p )
Parameters
p
the new location for the point.
Description
Moves the rectangle to the specified location.

This method is included for completeness, to parallel the setLocation method of Component.

See Also
setLocation

Syntax 2
public void setLocation( int x, int y )
Parameters
x
the x coordinate of the new location.
y
the y coordinate of the new location.
Description
Moves the rectangle to the specified location.

This method is included for completeness, to parallel the setLocation method of Component.

See Also
setLocation


 Rectangle.setSize

Rectangle.setSize

Syntax 1
public void setSize( Dimension d )
Parameters
d
the new size for the Dimension object
Description
Sets the size of this rectangle to match the specified dimension.

This method is included for completeness, to parallel the setSize method of Component.

See Also
setSize

Syntax 2
public void setSize( int width, int height )
Parameters
width
the new width for this rectangle object.
height
the new height for this rectangle object.
Description
Sets the size of this rectangle to the specified width and height.

This method is included for completeness, to parallel the setSize method of Component.

See Also
setSize


 Rectangle.toString

Rectangle.toString

Syntax
public String toString()
Returns
a string representation of this rectangle.
Description
Returns a string representation of this rectangle and its values.

Overrides
toString in class Object


 Rectangle.translate

Rectangle.translate

Syntax
public void translate( int x, int y )
Parameters
dx
the distance to move the rectangle along the x axis.
dy
the distance to move the rectangle along the y axis.
Description
Translates the rectangle the indicated distance, to the right along the x coordinate axis, and downward along the y coordinate axis.

See Also
setLocation, setLocation


 Rectangle.union

Rectangle.union

Syntax
public Rectangle union( Rectangle r )
Parameters
r
a rectangle.
Returns
the smallest rectangle containing both the specified rectangle and this rectangle.
Description
Computes the union of this rectangle with the specified rectangle. Returns a new rectangle that represents the union of the two rectangles.


 Class ScrollPane

Class java.awt.ScrollPane

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.ScrollPane

public class ScrollPane
extends Container

A container class which implements automatic horizontal and/or vertical scrolling for a single child component. The display policy for the scrollbars can be set to:

  1. as needed: scrollbars created and shown only when needed by scrollpane
  2. always: scrollbars created and always shown by the scrollpane
  3. never: scrollbars never created or shown by the scrollpane

The state of the horizontal and vertical scrollbars is represented by two objects (one for each dimension) which implement the Adjustable interface. The API provides methods to access those objects such that the attributes on the Adjustable object (such as unitIncrement, value, etc.) can be manipulated.

Certain adjustable properties (minimum, maximum, blockIncrement, and visibleAmount) are set internally by the scrollpane in accordance with the geometry of the scrollpane and its child and these should not be set by programs using the scrollpane.

If the scrollbar display policy is defined as "never", then the scrollpane can still be programmatically scrolled using the setScrollPosition() method and the scrollpane will move and clip the child's contents appropriately. This policy is useful if the program needs to create and manage its own adjustable controls.

The placement of the scrollbars is controlled by platform-specific properties set by the user outside of the program.

The initial size of this container is set to 100x100, but can be reset using setSize().

Insets are used to define any space used by scrollbars and any borders created by the scroll pane. getInsets() can be used to get the current value for the insets. If the value of scrollbarsAlwaysVisible is false, then the value of the insets will change dynamically depending on whether the scrollbars are currently visible or not.


 ScrollPane Members

ScrollPane Members

Class Overview | This Package | All Packages

Fields
Name | Description
SCROLLBARS_ALWAYS | Specifies that horizontal/vertical scrollbars should always be shown regardless of the respective sizes of the scrollpane and child.
SCROLLBARS_AS_NEEDED | Specifies that horizontal/vertical scrollbar should be shown only when the size of the child exceeds the size of the scrollpane in the horizontal/vertical dimension.
SCROLLBARS_NEVER | Specifies that horizontal/vertical scrollbars should never be shown regardless of the respective sizes of the scrollpane and child.

Constructors
Name | Description
ScrollPane() | Create a new scrollpane container with a scrollbar display policy of "as needed".
ScrollPane(int) | Create a new scrollpane container.

Methods
Name | Description
addImpl(Component, Object, int) | Adds the specified component to this scroll pane container.
addNotify() | Creates the scroll pane's peer.
doLayout() | Lays out this container by resizing its child to its preferred size.
getHAdjustable() | Returns the Adjustable object which represents the state of the horizontal scrollbar.
getHScrollbarHeight() | Returns the height that would be occupied by a horizontal scrollbar, which is independent of whether it is currently displayed by the scroll pane or not.
getScrollbarDisplayPolicy() | Returns the display policy for the scrollbars.
getScrollPosition() | Returns the current x,y position within the child which is displayed at the 0,0 location of the scrolled panel's view port.
getVAdjustable() | Returns the Adjustable object which represents the state of the vertical scrollbar.
getViewportSize() | Returns the current size of the scroll pane's view port.
getVScrollbarWidth() | Returns the width that would be occupied by a vertical scrollbar, which is independent of whether it is currently displayed by the scroll pane or not.
layout() | Deprecated.
paramString() | Returns the parameter string representing the state of this container.
printComponents(Graphics) | Prints the component in this scroll pane.
setLayout(LayoutManager) | Sets the layout manager for this container.
setScrollPosition(int, int) | Scrolls to the specified position within the child component.
setScrollPosition(Point) | Scrolls to the specified position within the child component.


 ScrollPane.SCROLLBARS_ALWAYS

ScrollPane.SCROLLBARS_ALWAYS

Syntax
public static final int SCROLLBARS_ALWAYS
Description
Specifies that horizontal/vertical scrollbars should always be shown regardless of the respective sizes of the scrollpane and child.


 ScrollPane.SCROLLBARS_AS_NEEDED

ScrollPane.SCROLLBARS_AS_NEEDED

Syntax
public static final int SCROLLBARS_AS_NEEDED
Description
Specifies that horizontal/vertical scrollbar should be shown only when the size of the child exceeds the size of the scrollpane in the horizontal/vertical dimension.


 ScrollPane.SCROLLBARS_NEVER

ScrollPane.SCROLLBARS_NEVER

Syntax
public static final int SCROLLBARS_NEVER
Description
Specifies that horizontal/vertical scrollbars should never be shown regardless of the respective sizes of the scrollpane and child.


 ScrollPane.ScrollPane

ScrollPane.ScrollPane

Syntax 1
public ScrollPane()
Description
Create a new scrollpane container with a scrollbar display policy of "as needed".

Syntax 2
public ScrollPane( int scrollbarDisplayPolicy )
Parameters
scrollbarDisplayPolicy
policy for when scrollbars should be shown
Description
Create a new scrollpane container.


 ScrollPane.addImpl

ScrollPane.addImpl

Syntax
protected final void addImpl( Component comp, Object constraints, int index )
Parameters
comp
the component to be added
constraints
not applicable
index
position of child component (must be <= 0)
Description
Adds the specified component to this scroll pane container. If the scroll pane has an existing child component, that component is removed and the new one is added.

Overrides
addImpl in class Container


 ScrollPane.addNotify

ScrollPane.addNotify

Syntax
public void addNotify()
Description
Creates the scroll pane's peer.

Overrides
addNotify in class Container


 ScrollPane.doLayout

ScrollPane.doLayout

Syntax
public void doLayout()
Description
Lays out this container by resizing its child to its preferred size. If the new preferred size of the child causes the current scroll position to be invalid, the scroll position is set to the closest valid position.

Overrides
doLayout in class Container
See Also
validate


 ScrollPane.getHAdjustable

ScrollPane.getHAdjustable

Syntax
public Adjustable getHAdjustable()
Description
Returns the Adjustable object which represents the state of the horizontal scrollbar. If the scrollbar display policy is "never", this method returns null.


 ScrollPane.getHScrollbarHeight

ScrollPane.getHScrollbarHeight

Syntax
public int getHScrollbarHeight()
Returns
the height of a horizontal scrollbar in pixels
Description
Returns the height that would be occupied by a horizontal scrollbar, which is independent of whether it is currently displayed by the scroll pane or not.


 ScrollPane.getScrollbarDisplayPolicy

ScrollPane.getScrollbarDisplayPolicy

Syntax
public int getScrollbarDisplayPolicy()
Returns
the display policy for the scrollbars
Description
Returns the display policy for the scrollbars.


 ScrollPane.getScrollPosition

ScrollPane.getScrollPosition

Syntax
public Point getScrollPosition()
Returns
the coordinate position for the current scroll position
Description
Returns the current x,y position within the child which is displayed at the 0,0 location of the scrolled panel's view port. This is a convenience method which interfaces with the adjustable objects which respresent the state of the scrollbars.


 ScrollPane.getVAdjustable

ScrollPane.getVAdjustable

Syntax
public Adjustable getVAdjustable()
Description
Returns the Adjustable object which represents the state of the vertical scrollbar. If the scrollbar display policy is "never", this method returns null.


 ScrollPane.getViewportSize

ScrollPane.getViewportSize

Syntax
public Dimension getViewportSize()
Returns
the size of the view port in pixels
Description
Returns the current size of the scroll pane's view port.


 ScrollPane.getVScrollbarWidth

ScrollPane.getVScrollbarWidth

Syntax
public int getVScrollbarWidth()
Returns
the width of a vertical scrollbar in pixels
Description
Returns the width that would be occupied by a vertical scrollbar, which is independent of whether it is currently displayed by the scroll pane or not.


 ScrollPane.layout

ScrollPane.layout

Syntax
public void layout()
Description
Note: layout() is deprecated. As of JDK version 1.1, replaced by doLayout().

Overrides
layout in class Container


 ScrollPane.paramString

ScrollPane.paramString

Syntax
public String paramString()
Description
Returns the parameter string representing the state of this container.

Overrides
paramString in class Container


 ScrollPane.printComponents

ScrollPane.printComponents

Syntax
public void printComponents( Graphics g )
Parameters
g
the specified Graphics window
Description
Prints the component in this scroll pane.

Overrides
printComponents in class Container
See Also
print, printAll


 ScrollPane.setLayout

ScrollPane.setLayout

Syntax
public final void setLayout( LayoutManager mgr )
Parameters
mgr
the specified layout manager
Description
Sets the layout manager for this container. This method is overridden to prevent the layout mgr from being set.

Overrides
setLayout in class Container


 ScrollPane.setScrollPosition

ScrollPane.setScrollPosition

Syntax 1
public void setScrollPosition( int x, int y )
Parameters
x
the x position to scroll to
y
the y position to scroll to
Description
Scrolls to the specified position within the child component. A call to this method is only valid if the scroll pane contains a child. Specifying a position outside of the legal scrolling bounds of the child will scroll to the closest legal position. Legal bounds are defined to be the rectangle: x = 0, y = 0, width = (child width - view port width), height = (child height - view port height). This is a convenience method which interfaces with the Adjustable objects which respresent the state of the scrollbars.

Exceptions
IllegalArgumentException if specified coordinates are not within the legal scrolling bounds of the child component.

Syntax 2
public void setScrollPosition( Point p )
Parameters
p
the Point representing the position to scroll to
Description
Scrolls to the specified position within the child component. A call to this method is only valid if the scroll pane contains a child and the specified position is within legal scrolling bounds of the child. Legal bounds are defined to be the rectangle: x = 0, y = 0, width = (child width - view port width), height = (child height - view port height). This is a convenience method which interfaces with the Adjustable objects which respresent the state of the scrollbars.

Exceptions
IllegalArgumentException if specified coordinates are not within the legal scrolling bounds of the child component.


 Class Scrollbar

Class java.awt.Scrollbar

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Scrollbar

public class Scrollbar
extends Component
implements Adjustable

The Scrollbar class embodies a scroll bar, a familiar user-interface object. A scroll bar provides a convenient means for allowing a user to select from a range of values. The following three vertical scroll bars could be used as slider controls to pick the red, green, and blue components of a color:

Each scroll bar in this example could be created with code similar to the following:

 redSlider=new Scrollbar(Scrollbar.VERTICAL, 0, 1, 0, 255);
 add(redSlider);

Alternatively, a scroll bar can represent a range of values. For example, if a scroll bar is used for scrolling through text, the width of the "bubble" or "thumb" can represent the amount of text that is visible. Here is an example of a scroll bar that represents a range:

The value range represented by the bubble is the visible range of the scroll bar. The horizontal scroll bar in this example could be created with code like the following:

 ranger = new Scrollbar(Scrollbar.HORIZONTAL, 0, 64, 0, 255);
 add(ranger);

Note that the maximum value above, 255, is the maximum value for the scroll bar's bubble. The actual width of the scroll bar's track is 255 + 64. When the scroll bar is set to its maximum value, the left side of the bubble is at 255, and the right side is at 255 + 64.

Normally, the user changes the value of the scroll bar by making a gesture with the mouse. For example, the user can drag the scroll bar's bubble up and down, or click in the scroll bar's unit increment or block increment areas. Keyboard gestures can also be mapped to the scroll bar. By convention, the Page Up and Page Down keys are equivalent to clicking in the scroll bar's block increment and block decrement areas.

When the user changes the value of the scroll bar, the scroll bar receives an instance of AdjustmentEvent. The scroll bar processes this event, passing it along to any registered listeners.

Any object that wishes to be notified of changes to the scroll bar's value should implement AdjustmentListener, an interface defined in the package java.awt.event. Listeners can be added and removed dynamically by calling the methods addAdjustmentListener and removeAdjustmentListener.

The AdjustmentEvent class defines five types of adjustment event, listed here:

  • AdjustmentEvent.TRACK is sent out when the user drags the scroll bar's bubble.
  • AdjustmentEvent.UNIT_INCREMENT is sent out when the user clicks in the left arrow of a horizontal scroll bar, or the top arrow of a vertical scroll bar, or makes the equivalent gesture from the keyboard.
  • AdjustmentEvent.UNIT_DECREMENT is sent out when the user clicks in the right arrow of a horizontal scroll bar, or the bottom arrow of a vertical scroll bar, or makes the equivalent gesture from the keyboard.
  • AdjustmentEvent.BLOCK_INCREMENT is sent out when the user clicks in the track, to the left of the bubble on a horizontal scroll bar, or above the bubble on a vertical scroll bar. By convention, the Page Up key is equivalent, if the user is using a keyboard that defines a Page Up key.
  • AdjustmentEvent.BLOCK_DECREMENT is sent out when the user clicks in the track, to the right of the bubble on a horizontal scroll bar, or below the bubble on a vertical scroll bar. By convention, the Page Down key is equivalent, if the user is using a keyboard that defines a Page Down key.

The JDK 1.0 event system is supported for backwards compatibility, but its use with newer versions of JDK is discouraged. The fives types of adjustment event introduced with JDK 1.1 correspond to the five event types that are associated with scroll bars in previous JDK versions. The following list gives the adjustment event type, and the corresponding JDK 1.0 event type it replaces.

  • AdjustmentEvent.TRACK replaces Event.SCROLL_ABSOLUTE
  • AdjustmentEvent.UNIT_INCREMENT replaces Event.SCROLL_LINE_UP
  • AdjustmentEvent.UNIT_DECREMENT replaces Event.SCROLL_LINE_DOWN
  • AdjustmentEvent.BLOCK_INCREMENT replaces Event.SCROLL_PAGE_UP
  • AdjustmentEvent.BLOCK_DECREMENT replaces Event.SCROLL_PAGE_DOWN

See Also:
AdjustmentEvent, AdjustmentListener


 Scrollbar Members

Scrollbar Members

Class Overview | This Package | All Packages

Fields
Name | Description
HORIZONTAL | A constant that indicates a horizontal scroll bar.
VERTICAL | A constant that indicates a vertical scroll bar.

Constructors
Name | Description
Scrollbar() | Constructs a new vertical scroll bar.
Scrollbar(int) | Constructs a new scroll bar with the specified orientation.
Scrollbar(int, int, int, int, int) | Constructs a new scroll bar with the specified orientation, initial value, page size, and minimum and maximum values.

Methods
Name | Description
addAdjustmentListener(AdjustmentListener) | Adds the specified adjustment listener to receive instances of AdjustmentEvent from this scroll bar.
addNotify() | Creates the Scrollbar's peer.
getBlockIncrement() | Gets the block increment of this scroll bar.
getLineIncrement() | Deprecated.
getMaximum() | Gets the maximum value of this scroll bar.
getMinimum() | Gets the minimum value of this scroll bar.
getOrientation() | Determines the orientation of this scroll bar.
getPageIncrement() | Deprecated.
getUnitIncrement() | Gets the unit increment for this scrollbar.
getValue() | Gets the current value of this scroll bar.
getVisible() | Deprecated.
getVisibleAmount() | Gets the visible amount of this scroll bar.
paramString() | Returns the parameter string representing the state of this scroll bar.
processAdjustmentEvent(AdjustmentEvent) | Processes adjustment events occurring on this scrollbar by dispatching them to any registered AdjustmentListener objects.
processEvent(AWTEvent) | Processes events on this scroll bar.
removeAdjustmentListener(AdjustmentListener) | Removes the specified adjustment listener so that it no longer receives instances of AdjustmentEvent from this scroll bar.
setBlockIncrement(int) | Sets the block increment for this scroll bar.
setLineIncrement(int) | Deprecated.
setMaximum(int) | Sets the maximum value of this scroll bar.
setMinimum(int) | Sets the minimum value of this scroll bar.
setOrientation(int) | Sets the orientation for this scroll bar.
setPageIncrement(int) | Deprecated.
setUnitIncrement(int) | Sets the unit increment for this scroll bar.
setValue(int) | Sets the value of this scroll bar to the specified value.
setValues(int, int, int, int) | Sets the values of four properties for this scroll bar.
setVisibleAmount(int) | Sets the visible amount of this scroll bar.


 Scrollbar.HORIZONTAL

Scrollbar.HORIZONTAL

Syntax
public static final int HORIZONTAL
Description
A constant that indicates a horizontal scroll bar.


 Scrollbar.VERTICAL

Scrollbar.VERTICAL

Syntax
public static final int VERTICAL
Description
A constant that indicates a vertical scroll bar.


 Scrollbar.Scrollbar

Scrollbar.Scrollbar

Syntax 1
public Scrollbar()
Description
Constructs a new vertical scroll bar.

Syntax 2
public Scrollbar( int orientation )
Parameters
orientation
indicates the orientation of the scroll bar.
Description
Constructs a new scroll bar with the specified orientation.

The orientation argument must take one of the two values Scrollbar.HORIZONTAL, or Scrollbar.VERTICAL, indicating a horizontal or vertical scroll bar, respectively.

Exceptions
IllegalArgumentException when an illegal value for the orientation argument is supplied.

Syntax 3
public Scrollbar( int orientation, int value, int visible, int minimum, int maximum )
Parameters
orientation
indicates the orientation of the scroll bar.
value
the initial value of the scroll bar.
visible
the size of the scroll bar's bubble, representing the visible portion; the scroll bar uses this value when paging up or down by a page.
minimum
the minimum value of the scroll bar.
maximum
the maximum value of the scroll bar.
Description
Constructs a new scroll bar with the specified orientation, initial value, page size, and minimum and maximum values.

The orientation argument must take one of the two values Scrollbar.HORIZONTAL, or Scrollbar.VERTICAL, indicating a horizontal or vertical scroll bar, respectively.

If the specified maximum value is less than the minimum value, it is changed to be the same as the minimum value. If the initial value is lower than the minimum value, it is changed to be the minimum value; if it is greater than the maximum value, it is changed to be the maximum value.


 Scrollbar.addAdjustmentListener

Scrollbar.addAdjustmentListener

Syntax
public synchronized void addAdjustmentListener( AdjustmentListener l )
Parameters
l
the adjustment listener.
Description
Adds the specified adjustment listener to receive instances of AdjustmentEvent from this scroll bar.

See Also
AdjustmentEvent, AdjustmentListener, removeAdjustmentListener


 Scrollbar.addNotify

Scrollbar.addNotify

Syntax
public void addNotify()
Description
Creates the Scrollbar's peer. The peer allows you to modify the appearance of the Scrollbar without changing any of its functionality.

Overrides
addNotify in class Component


 Scrollbar.getBlockIncrement

Scrollbar.getBlockIncrement

Syntax
public int getBlockIncrement()
Returns
the block increment of this scroll bar.
Description
Gets the block increment of this scroll bar.

The block increment is the value that is added (subtracted) when the user activates the block increment area of the scroll bar, generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event.

See Also
setBlockIncrement


 Scrollbar.getLineIncrement

Scrollbar.getLineIncrement

Syntax
public int getLineIncrement()
Description
Note: getLineIncrement() is deprecated. As of JDK version 1.1, replaced by getUnitIncrement().


 Scrollbar.getMaximum

Scrollbar.getMaximum

Syntax
public int getMaximum()
Returns
the maximum value of this scroll bar.
Description
Gets the maximum value of this scroll bar.

See Also
getValue, getMinimum


 Scrollbar.getMinimum

Scrollbar.getMinimum

Syntax
public int getMinimum()
Returns
the minimum value of this scroll bar.
Description
Gets the minimum value of this scroll bar.

See Also
getValue, getMaximum


 Scrollbar.getOrientation

Scrollbar.getOrientation

Syntax
public int getOrientation()
Returns
the orientation of this scroll bar, either Scrollbar.HORIZONTAL or Scrollbar.VERTICAL.
Description
Determines the orientation of this scroll bar.

See Also
setOrientation


 Scrollbar.getPageIncrement

Scrollbar.getPageIncrement

Syntax
public int getPageIncrement()
Description
Note: getPageIncrement() is deprecated. As of JDK version 1.1, replaced by getBlockIncrement().


 Scrollbar.getUnitIncrement

Scrollbar.getUnitIncrement

Syntax
public int getUnitIncrement()
Returns
the unit increment of this scroll bar.
Description
Gets the unit increment for this scrollbar.

The unit increment is the value that is added (subtracted) when the user activates the unit increment area of the scroll bar, generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event.

See Also
setUnitIncrement


 Scrollbar.getValue

Scrollbar.getValue

Syntax
public int getValue()
Returns
the current value of this scroll bar.
Description
Gets the current value of this scroll bar.

See Also
getMinimum, getMaximum


 Scrollbar.getVisible

Scrollbar.getVisible

Syntax
public int getVisible()
Description
Note: getVisible() is deprecated. As of JDK version 1.1, replaced by getVisibleAmount().


 Scrollbar.getVisibleAmount

Scrollbar.getVisibleAmount

Syntax
public int getVisibleAmount()
Returns
the visible amount of this scroll bar.
Description
Gets the visible amount of this scroll bar.

The visible amount of a scroll bar is the range of values represented by the width of the scroll bar's bubble. It is used to determine the scroll bar's block increment.

See Also
setVisibleAmount


 Scrollbar.paramString

Scrollbar.paramString

Syntax
protected String paramString()
Returns
the parameter string of this scroll bar.
Description
Returns the parameter string representing the state of this scroll bar. This string is useful for debugging.

Overrides
paramString in class Component


 Scrollbar.processAdjustmentEvent

Scrollbar.processAdjustmentEvent

Syntax
protected void processAdjustmentEvent( AdjustmentEvent e )
Parameters
e
the adjustment event.
Description
Processes adjustment events occurring on this scrollbar by dispatching them to any registered AdjustmentListener objects.

This method is not called unless adjustment events are enabled for this component. Adjustment events are enabled when one of the following occurs:

  • An AdjustmentListener object is registered via addAdjustmentListener.
  • Adjustment events are enabled via enableEvents.

See Also
AdjustmentEvent, AdjustmentListener, addAdjustmentListener, enableEvents


 Scrollbar.processEvent

Scrollbar.processEvent

Syntax
protected void processEvent( AWTEvent e )
Parameters
e
the event.
Description
Processes events on this scroll bar. If the event is an instance of AdjustmentEvent, it invokes the processAdjustmentEvent method. Otherwise, it invokes its superclass's processEvent method.

Overrides
processEvent in class Component
See Also
AdjustmentEvent, processAdjustmentEvent


 Scrollbar.removeAdjustmentListener

Scrollbar.removeAdjustmentListener

Syntax
public synchronized void removeAdjustmentListener( AdjustmentListener l )
Parameters
l
the adjustment listener.
Description
Removes the specified adjustment listener so that it no longer receives instances of AdjustmentEvent from this scroll bar.

See Also
AdjustmentEvent, AdjustmentListener, addAdjustmentListener


 Scrollbar.setBlockIncrement

Scrollbar.setBlockIncrement

Syntax
public synchronized void setBlockIncrement( int v )
Parameters
v
the amount by which to increment or decrement the scroll bar's value.
Description
Sets the block increment for this scroll bar.

The block increment is the value that is added (subtracted) when the user activates the block increment area of the scroll bar, generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event.

See Also
getBlockIncrement


 Scrollbar.setLineIncrement

Scrollbar.setLineIncrement

Syntax
public void setLineIncrement( int v )
Description
Note: setLineIncrement() is deprecated. As of JDK version 1.1, replaced by setUnitIncrement(int).


 Scrollbar.setMaximum

Scrollbar.setMaximum

Syntax
public synchronized void setMaximum( int newMaximum )
Parameters
newMaximum
the new maximum value for this scroll bar.
Description
Sets the maximum value of this scroll bar.

Normally, a program should change a scroll bar's maximum value only by calling setValues. The setValues method simultaneously and synchronously sets the minimum, maximum, visible amount, and value properties of a scroll bar, so that they are mutually consistent.

See Also
setValues, setMinimum


 Scrollbar.setMinimum

Scrollbar.setMinimum

Syntax
public synchronized void setMinimum( int newMinimum )
Parameters
newMinimum
the new minimum value for this scroll bar.
Description
Sets the minimum value of this scroll bar.

Normally, a program should change a scroll bar's minimum value only by calling setValues. The setValues method simultaneously and synchronously sets the minimum, maximum, visible amount, and value properties of a scroll bar, so that they are mutually consistent.

See Also
setValues, setMaximum


 Scrollbar.setOrientation

Scrollbar.setOrientation

Syntax
public synchronized void setOrientation( int orientation )
Parameters
the
orientation of this scroll bar, either Scrollbar.HORIZONTAL or Scrollbar.VERTICAL.
Description
Sets the orientation for this scroll bar.

Exceptions
IllegalArgumentException if the value supplied for orientation is not a legal value.
See Also
getOrientation


 Scrollbar.setPageIncrement

Scrollbar.setPageIncrement

Syntax
public void setPageIncrement( int v )
Description
Note: setPageIncrement() is deprecated. As of JDK version 1.1, replaced by setBlockIncrement().


 Scrollbar.setUnitIncrement

Scrollbar.setUnitIncrement

Syntax
public synchronized void setUnitIncrement( int v )
Parameters
v
the amount by which to increment or decrement the scroll bar's value.
Description
Sets the unit increment for this scroll bar.

The unit increment is the value that is added (subtracted) when the user activates the unit increment area of the scroll bar, generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event.

See Also
getUnitIncrement


 Scrollbar.setValue

Scrollbar.setValue

Syntax
public synchronized void setValue( int newValue )
Parameters
newValue
the new value of the scroll bar.
Description
Sets the value of this scroll bar to the specified value.

If the value supplied is less than the current minimum or greater than the current maximum, then one of those values is substituted, as appropriate.

Normally, a program should change a scroll bar's value only by calling setValues. The setValues method simultaneously and synchronously sets the minimum, maximum, visible amount, and value properties of a scroll bar, so that they are mutually consistent.

See Also
setValues, getValue, getMinimum, getMaximum


 Scrollbar.setValues

Scrollbar.setValues

Syntax
public synchronized void setValues( int value, int visible, int minimum, int maximum )
Parameters
value
is the position in the current window.
visible
is the amount visible per page.
minimum
is the minimum value of the scroll bar.
maximum
is the maximum value of the scroll bar.
Description
Sets the values of four properties for this scroll bar.

This method simultaneously and synchronously sets the values of four scroll bar properties, assuring that the values of these properties are mutually consistent. It enforces the constraints that maximum cannot be less than minimum, and that value cannot be less than the minimum or greater than the maximum.


 Scrollbar.setVisibleAmount

Scrollbar.setVisibleAmount

Syntax
public synchronized void setVisibleAmount( int newAmount )
Parameters
newAmount
the amount visible per page.
Description
Sets the visible amount of this scroll bar.

The visible amount of a scroll bar is the range of values represented by the width of the scroll bar's bubble. It is used to determine the scroll bar's block increment.

Normally, a program should change a scroll bar's value only by calling setValues. The setValues method simultaneously and synchronously sets the minimum, maximum, visible amount, and value properties of a scroll bar, so that they are mutually consistent.

See Also
getVisibleAmount, setValues


 Interface Shape

Interface java.awt.Shape

Interface Members | This Package | All Packages

public interface Shape

The interface for objects which represent some form of geometric shape.

This interface will be revised in the upcoming Java2D project. It is meant to provide a common interface for various existing geometric AWT classes and methods which operate on them. Since it may be superseded or expanded in the future, developers should avoid implementing this interface in their own classes until it is completed in a later release.


 Shape Members

Shape Members

Interface Overview | This Package | All Packages

Methods
Name | Description
getBounds() | Return the bounding box of the shape.


 Shape.getBounds

Shape.getBounds

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Rectangle getBounds()
Description
Return the bounding box of the shape.


 Class SystemColor

Class java.awt.SystemColor

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Color
           |
           +----java.awt.SystemColor

public final class SystemColor
extends Color
implements Serializable

A class to encapsulate symbolic colors representing the color of GUI objects on a system. For systems which support the dynamic update of the system colors (when the user changes the colors) the actual RGB values of these symbolic colors will also change dynamically. In order to compare the "current" RGB value of a SystemColor object with a non-symbolic Color object, getRGB() should be used rather than equals().


 SystemColor Members

SystemColor Members

Class Overview | This Package | All Packages

Fields
Name | Description
ACTIVE_CAPTION | The array index for the active caption background color.
ACTIVE_CAPTION_BORDER | The array index for the active caption border color.
ACTIVE_CAPTION_TEXT | The array index for the action caption text color.
activeCaption | The background color for captions in window borders.
activeCaptionBorder | The border color for captions in window borders.
activeCaptionText | The text color for captions in window borders.
CONTROL | The array index for the control background color.
control | The background color for control objects.
CONTROL_DK_SHADOW | The array index for the control dark shadow color.
CONTROL_HIGHLIGHT | The array index for the control highlight color.
CONTROL_LT_HIGHLIGHT | The array index for the control light highlight color.
CONTROL_SHADOW | The array index for the control shadow color.
CONTROL_TEXT | The array index for the control text color.
controlDkShadow | The dark shadow color for control objects.
controlHighlight | The regular highlight color for control objects.
controlLtHighlight | The light highlight color for control objects.
controlShadow | The regular shadow color for control objects.
controlText | The text color for control objects.
desktop | The color of the desktop background.
DESKTOP | The array index for the desktop background color.
INACTIVE_CAPTION | The array index for the inactive caption background color.
INACTIVE_CAPTION_BORDER | The array index for the inactive caption border color.
INACTIVE_CAPTION_TEXT | The array index for the inactive caption text color.
inactiveCaption | The background color for inactive captions in window borders.
inactiveCaptionBorder | The border color for inactive captios in window borders.
inactiveCaptionText | The text color for inactive captions in window borders.
INFO | The array index for the info background color.
info | The background color for info(help) text.
INFO_TEXT | The array index for the info text color.
infoText | The text color for info(help) text.
menu | The background color for menus.
MENU | The array index for the menu background color.
MENU_TEXT | The array index for the menu text color.
menuText | The text color for menus.
NUM_COLORS | The number of system colors in the array.
scrollbar | The background color for scrollbars.
SCROLLBAR | The array index for the scrollbar background color.
TEXT | The array index for the text background color.
text | The background color for text components.
TEXT_HIGHLIGHT | The array index for the text highlight color.
TEXT_HIGHLIGHT_TEXT | The array index for the text highlight text color.
TEXT_INACTIVE_TEXT | The array index for the text inactive text color.
TEXT_TEXT | The array index for the text text color.
textHighlight | The background color for highlighted text.
textHighlightText | The text color for highlighted text.
textInactiveText | The text color for inactive text.
textText | The text color for text components.
WINDOW | The array index for the window background color.
window | The background color for windows.
WINDOW_BORDER | The array index for the window border color.
WINDOW_TEXT | The array index for the window text color.
windowBorder | The border color for windows.
windowText | The text color for windows.

Methods
Name | Description
getRGB() | Gets the "current" RGB value representing the symbolic color.
toString() | Returns the String representation of this Color's values.


 SystemColor.ACTIVE_CAPTION

SystemColor.ACTIVE_CAPTION

Syntax
public static final int ACTIVE_CAPTION
Description
The array index for the active caption background color.


 SystemColor.ACTIVE_CAPTION_BORDER

SystemColor.ACTIVE_CAPTION_BORDER

Syntax
public static final int ACTIVE_CAPTION_BORDER
Description
The array index for the active caption border color.


 SystemColor.ACTIVE_CAPTION_TEXT

SystemColor.ACTIVE_CAPTION_TEXT

Syntax
public static final int ACTIVE_CAPTION_TEXT
Description
The array index for the action caption text color.


 SystemColor.activeCaption

SystemColor.activeCaption

Syntax
public static final SystemColor activeCaption
Description
The background color for captions in window borders.


 SystemColor.activeCaptionBorder

SystemColor.activeCaptionBorder

Syntax
public static final SystemColor activeCaptionBorder
Description
The border color for captions in window borders.


 SystemColor.activeCaptionText

SystemColor.activeCaptionText

Syntax
public static final SystemColor activeCaptionText
Description
The text color for captions in window borders.


 SystemColor.CONTROL

SystemColor.CONTROL

Syntax
public static final int CONTROL
Description
The array index for the control background color.


 SystemColor.control

SystemColor.control

Syntax
public static final SystemColor control
Description
The background color for control objects.


 SystemColor.CONTROL_DK_SHADOW

SystemColor.CONTROL_DK_SHADOW

Syntax
public static final int CONTROL_DK_SHADOW
Description
The array index for the control dark shadow color.


 SystemColor.CONTROL_HIGHLIGHT

SystemColor.CONTROL_HIGHLIGHT

Syntax
public static final int CONTROL_HIGHLIGHT
Description
The array index for the control highlight color.


 SystemColor.CONTROL_LT_HIGHLIGHT

SystemColor.CONTROL_LT_HIGHLIGHT

Syntax
public static final int CONTROL_LT_HIGHLIGHT
Description
The array index for the control light highlight color.


 SystemColor.CONTROL_SHADOW

SystemColor.CONTROL_SHADOW

Syntax
public static final int CONTROL_SHADOW
Description
The array index for the control shadow color.


 SystemColor.CONTROL_TEXT

SystemColor.CONTROL_TEXT

Syntax
public static final int CONTROL_TEXT
Description
The array index for the control text color.


 SystemColor.controlDkShadow

SystemColor.controlDkShadow

Syntax
public static final SystemColor controlDkShadow
Description
The dark shadow color for control objects.


 SystemColor.controlHighlight

SystemColor.controlHighlight

Syntax
public static final SystemColor controlHighlight
Description
The regular highlight color for control objects.


 SystemColor.controlLtHighlight

SystemColor.controlLtHighlight

Syntax
public static final SystemColor controlLtHighlight
Description
The light highlight color for control objects.


 SystemColor.controlShadow

SystemColor.controlShadow

Syntax
public static final SystemColor controlShadow
Description
The regular shadow color for control objects.


 SystemColor.controlText

SystemColor.controlText

Syntax
public static final SystemColor controlText
Description
The text color for control objects.


 SystemColor.DESKTOP

SystemColor.DESKTOP

Syntax
public static final int DESKTOP
Description
The array index for the desktop background color.


 SystemColor.desktop

SystemColor.desktop

Syntax
public static final SystemColor desktop
Description
The color of the desktop background.


 SystemColor.INACTIVE_CAPTION

SystemColor.INACTIVE_CAPTION

Syntax
public static final int INACTIVE_CAPTION
Description
The array index for the inactive caption background color.


 SystemColor.INACTIVE_CAPTION_BORDER

SystemColor.INACTIVE_CAPTION_BORDER

Syntax
public static final int INACTIVE_CAPTION_BORDER
Description
The array index for the inactive caption border color.


 SystemColor.INACTIVE_CAPTION_TEXT

SystemColor.INACTIVE_CAPTION_TEXT

Syntax
public static final int INACTIVE_CAPTION_TEXT
Description
The array index for the inactive caption text color.


 SystemColor.inactiveCaption

SystemColor.inactiveCaption

Syntax
public static final SystemColor inactiveCaption
Description
The background color for inactive captions in window borders.


 SystemColor.inactiveCaptionBorder

SystemColor.inactiveCaptionBorder

Syntax
public static final SystemColor inactiveCaptionBorder
Description
The border color for inactive captios in window borders.


 SystemColor.inactiveCaptionText

SystemColor.inactiveCaptionText

Syntax
public static final SystemColor inactiveCaptionText
Description
The text color for inactive captions in window borders.


 SystemColor.INFO

SystemColor.INFO

Syntax
public static final int INFO
Description
The array index for the info background color.


 SystemColor.info

SystemColor.info

Syntax
public static final SystemColor info
Description
The background color for info(help) text.


 SystemColor.INFO_TEXT

SystemColor.INFO_TEXT

Syntax
public static final int INFO_TEXT
Description
The array index for the info text color.


 SystemColor.infoText

SystemColor.infoText

Syntax
public static final SystemColor infoText
Description
The text color for info(help) text.


 SystemColor.MENU

SystemColor.MENU

Syntax
public static final int MENU
Description
The array index for the menu background color.


 SystemColor.menu

SystemColor.menu

Syntax
public static final SystemColor menu
Description
The background color for menus.


 SystemColor.MENU_TEXT

SystemColor.MENU_TEXT

Syntax
public static final int MENU_TEXT
Description
The array index for the menu text color.


 SystemColor.menuText

SystemColor.menuText

Syntax
public static final SystemColor menuText
Description
The text color for menus.


 SystemColor.NUM_COLORS

SystemColor.NUM_COLORS

Syntax
public static final int NUM_COLORS
Description
The number of system colors in the array.


 SystemColor.SCROLLBAR

SystemColor.SCROLLBAR

Syntax
public static final int SCROLLBAR
Description
The array index for the scrollbar background color.


 SystemColor.scrollbar

SystemColor.scrollbar

Syntax
public static final SystemColor scrollbar
Description
The background color for scrollbars.


 SystemColor.TEXT

SystemColor.TEXT

Syntax
public static final int TEXT
Description
The array index for the text background color.


 SystemColor.text

SystemColor.text

Syntax
public static final SystemColor text
Description
The background color for text components.


 SystemColor.TEXT_HIGHLIGHT

SystemColor.TEXT_HIGHLIGHT

Syntax
public static final int TEXT_HIGHLIGHT
Description
The array index for the text highlight color.


 SystemColor.TEXT_HIGHLIGHT_TEXT

SystemColor.TEXT_HIGHLIGHT_TEXT

Syntax
public static final int TEXT_HIGHLIGHT_TEXT
Description
The array index for the text highlight text color.


 SystemColor.TEXT_INACTIVE_TEXT

SystemColor.TEXT_INACTIVE_TEXT

Syntax
public static final int TEXT_INACTIVE_TEXT
Description
The array index for the text inactive text color.


 SystemColor.TEXT_TEXT

SystemColor.TEXT_TEXT

Syntax
public static final int TEXT_TEXT
Description
The array index for the text text color.


 SystemColor.textHighlight

SystemColor.textHighlight

Syntax
public static final SystemColor textHighlight
Description
The background color for highlighted text.


 SystemColor.textHighlightText

SystemColor.textHighlightText

Syntax
public static final SystemColor textHighlightText
Description
The text color for highlighted text.


 SystemColor.textInactiveText

SystemColor.textInactiveText

Syntax
public static final SystemColor textInactiveText
Description
The text color for inactive text.


 SystemColor.textText

SystemColor.textText

Syntax
public static final SystemColor textText
Description
The text color for text components.


 SystemColor.WINDOW

SystemColor.WINDOW

Syntax
public static final int WINDOW
Description
The array index for the window background color.


 SystemColor.window

SystemColor.window

Syntax
public static final SystemColor window
Description
The background color for windows.


 SystemColor.WINDOW_BORDER

SystemColor.WINDOW_BORDER

Syntax
public static final int WINDOW_BORDER
Description
The array index for the window border color.


 SystemColor.WINDOW_TEXT

SystemColor.WINDOW_TEXT

Syntax
public static final int WINDOW_TEXT
Description
The array index for the window text color.


 SystemColor.windowBorder

SystemColor.windowBorder

Syntax
public static final SystemColor windowBorder
Description
The border color for windows.


 SystemColor.windowText

SystemColor.windowText

Syntax
public static final SystemColor windowText
Description
The text color for windows.


 SystemColor.getRGB

SystemColor.getRGB

Syntax
public int getRGB()
Description
Gets the "current" RGB value representing the symbolic color. (Bits 24-31 are 0xff, 16-23 are red, 8-15 are green, 0-7 are blue).

Overrides
getRGB in class Color
See Also
getRGBdefault, getBlue, getGreen, getRed


 SystemColor.toString

SystemColor.toString

Syntax
public String toString()
Description
Returns the String representation of this Color's values.

Overrides
toString in class Color


 Class TextArea

Class java.awt.TextArea

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.TextComponent
                   |
                   +----java.awt.TextArea

public class TextArea
extends TextComponent

A TextArea object is a multi-line region that displays text. It can be set to allow editing or to be read-only.

The following image shows the appearance of a text area:

This text area could be created by the following line of code:

 new TextArea("Hello", 5, 40);


 TextArea Members

TextArea Members

Class Overview | This Package | All Packages

Fields
Name | Description
SCROLLBARS_BOTH | Create and display both vertical and horizontal scrollbars.
SCROLLBARS_HORIZONTAL_ONLY | Create and display horizontal scrollbar only.
SCROLLBARS_NONE | Do not create or display any scrollbars for the text area.
SCROLLBARS_VERTICAL_ONLY | Create and display vertical scrollbar only.

Constructors
Name | Description
TextArea() | Constructs a new text area.
TextArea(int, int) | Constructs a new empty TextArea with the specified number of rows and columns.
TextArea(String) | Constructs a new text area with the specified text.
TextArea(String, int, int) | Constructs a new text area with the specified text, and with the specified number of rows and columns.
TextArea(String, int, int, int) | Constructs a new text area with the specified text, and with the rows, columns, and scroll bar visibility as specified.

Methods
Name | Description
addNotify() | Creates the TextArea's peer.
append(String) | Appends the given text to the text area's current text.
appendText(String) | Deprecated.
getColumns() | Gets the number of columns in this text area.
getMinimumSize() | Determines the minimum size of this text area.
getMinimumSize(int, int) | Determines the minimum size of a text area with the specified number of rows and columns.
getPreferredSize() | Determines the preferred size of this text area.
getPreferredSize(int, int) | Determines the preferred size of a text area with the specified number of rows and columns.
getRows() | Gets the number of rows in the text area.
getScrollbarVisibility() | Gets an enumerated value that indicates which scroll bars the text area uses.
insert(String, int) | Inserts the specified text at the specified position in this text area.
insertText(String, int) | Deprecated.
minimumSize() | Deprecated.
minimumSize(int, int) | Deprecated.
paramString() | Returns the parameter string representing the state of this text area.
preferredSize() | Deprecated.
preferredSize(int, int) | Deprecated.
replaceRange(String, int, int) | Replaces text between the indicated start and end positions with the specified replacement text.
replaceText(String, int, int) | Deprecated.
setColumns(int) | Sets the number of columns for this text area.
setRows(int) | Sets the number of rows for this text area.


 TextArea.SCROLLBARS_BOTH

TextArea.SCROLLBARS_BOTH

Syntax
public static final int SCROLLBARS_BOTH
Description
Create and display both vertical and horizontal scrollbars.


 TextArea.SCROLLBARS_HORIZONTAL_ONLY

TextArea.SCROLLBARS_HORIZONTAL_ONLY

Syntax
public static final int SCROLLBARS_HORIZONTAL_ONLY
Description
Create and display horizontal scrollbar only.


 TextArea.SCROLLBARS_NONE

TextArea.SCROLLBARS_NONE

Syntax
public static final int SCROLLBARS_NONE
Description
Do not create or display any scrollbars for the text area.


 TextArea.SCROLLBARS_VERTICAL_ONLY

TextArea.SCROLLBARS_VERTICAL_ONLY

Syntax
public static final int SCROLLBARS_VERTICAL_ONLY
Description
Create and display vertical scrollbar only.


 TextArea.TextArea

TextArea.TextArea

Syntax 1
public TextArea()
Description
Constructs a new text area. This text area is created with both vertical and horizontal scroll bars.

Syntax 2
public TextArea( String text )
Parameters
text
the text to be displayed.
Description
Constructs a new text area with the specified text. This text area is created with both vertical and horizontal scroll bars.

Syntax 3
public TextArea( int rows, int columns )
Parameters
rows
the number of rows
columns
the number of columns
Description
Constructs a new empty TextArea with the specified number of rows and columns.

Syntax 4
public TextArea( String text, int rows, int columns )
Parameters
text
the text to be displayed.
rows
the number of rows.
columns
the number of columns.
Description
Constructs a new text area with the specified text, and with the specified number of rows and columns. This text area is created with both vertical and horizontal scroll bars.

Syntax 5
public TextArea( String text, int rows, int columns, int scrollbars )
Parameters
text
the text to be displayed.
rows
the number of rows.
columns
the number of columns.
scrollbars
a constant that determines what scrollbars are created to view the text area.
Description
Constructs a new text area with the specified text, and with the rows, columns, and scroll bar visibility as specified.

The TextArea class defines several constants that can be supplied as values for the scrollbars argument: SCROLLBARS_BOTH, SCROLLBARS_VERTICAL_ONLY, SCROLLBARS_HORIZONTAL_ONLY, and SCROLLBARS_NONE.


 TextArea.addNotify

TextArea.addNotify

Syntax
public void addNotify()
Description
Creates the TextArea's peer. The peer allows us to modify the appearance of the TextArea without changing any of its functionality.

Overrides
addNotify in class Component


 TextArea.append

TextArea.append

Syntax
public synchronized void append( String str )
Parameters
str
the text to append.
Description
Appends the given text to the text area's current text.

See Also
insert


 TextArea.appendText

TextArea.appendText

Syntax
public void appendText( String str )
Description
Note: appendText() is deprecated. As of JDK version 1.1, replaced by append(String).


 TextArea.getColumns

TextArea.getColumns

Syntax
public int getColumns()
Returns
the number of columns in the text area.
Description
Gets the number of columns in this text area.

See Also
setColumns, getRows


 TextArea.getMinimumSize

TextArea.getMinimumSize

Syntax 1
public Dimension getMinimumSize( int rows, int columns )
Parameters
rows
the number of rows.
cols
the number of columns.
Returns
the minimum dimensions required to display the text area with the specified number of rows and columns.
Description
Determines the minimum size of a text area with the specified number of rows and columns.

See Also
getMinimumSize

Syntax 2
public Dimension getMinimumSize()
Returns
the preferred dimensions needed for this text area.
Description
Determines the minimum size of this text area.

Overrides
getMinimumSize in class Component
See Also
getPreferredSize


 TextArea.getPreferredSize

TextArea.getPreferredSize

Syntax 1
public Dimension getPreferredSize( int rows, int columns )
Parameters
rows
the number of rows.
cols
the number of columns.
Returns
the preferred dimensions required to display the text area with the specified number of rows and columns.
Description
Determines the preferred size of a text area with the specified number of rows and columns.

See Also
getPreferredSize

Syntax 2
public Dimension getPreferredSize()
Returns
the preferred dimensions needed for this text area.
Description
Determines the preferred size of this text area.

Overrides
getPreferredSize in class Component
See Also
getPreferredSize


 TextArea.getRows

TextArea.getRows

Syntax
public int getRows()
Returns
the number of rows in the text area.
Description
Gets the number of rows in the text area.

See Also
setRows, getColumns


 TextArea.getScrollbarVisibility

TextArea.getScrollbarVisibility

Syntax
public int getScrollbarVisibility()
Returns
an integer that indicates which scroll bars are used.
Description
Gets an enumerated value that indicates which scroll bars the text area uses.

The TextArea class defines four integer constants that are used to specify which scroll bars are available. TextArea has one constructor that gives the application discretion over scroll bars.

See Also
SCROLLBARS_BOTH, SCROLLBARS_VERTICAL_ONLY, SCROLLBARS_HORIZONTAL_ONLY, SCROLLBARS_NONE, TextArea


 TextArea.insert

TextArea.insert

Syntax
public synchronized void insert( String str, int pos )
Parameters
str
the text to insert.
pos
the position at which to insert.
Description
Inserts the specified text at the specified position in this text area.

See Also
setText, replaceRange, append


 TextArea.insertText

TextArea.insertText

Syntax
public void insertText( String str, int pos )
Description
Note: insertText() is deprecated. As of JDK version 1.1, replaced by insert(String, int).


 TextArea.minimumSize

TextArea.minimumSize

Syntax 1
public Dimension minimumSize( int rows, int columns )
Description
Note: minimumSize() is deprecated. As of JDK version 1.1, replaced by getMinimumSize(int, int).

Syntax 2
public Dimension minimumSize()
Description
Note: minimumSize() is deprecated. As of JDK version 1.1, replaced by getMinimumSize().

Overrides
minimumSize in class Component


 TextArea.paramString

TextArea.paramString

Syntax
protected String paramString()
Returns
the parameter string of this text area.
Description
Returns the parameter string representing the state of this text area. This string is useful for debugging.

Overrides
paramString in class TextComponent


 TextArea.preferredSize

TextArea.preferredSize

Syntax 1
public Dimension preferredSize( int rows, int columns )
Description
Note: preferredSize() is deprecated. As of JDK version 1.1, replaced by getPreferredSize(int, int).

Syntax 2
public Dimension preferredSize()
Description
Note: preferredSize() is deprecated. As of JDK version 1.1, replaced by getPreferredSize().

Overrides
preferredSize in class Component


 TextArea.replaceRange

TextArea.replaceRange

Syntax
public synchronized void replaceRange( String str, int start, int end )
Parameters
str
the text to use as the replacement.
start
the start position.
end
the end position.
Description
Replaces text between the indicated start and end positions with the specified replacement text.

See Also
insert


 TextArea.replaceText

TextArea.replaceText

Syntax
public void replaceText( String str, int start, int end )
Description
Note: replaceText() is deprecated. As of JDK version 1.1, replaced by replaceRange(String, int, int).


 TextArea.setColumns

TextArea.setColumns

Syntax
public void setColumns( int columns )
Parameters
columns
the number of columns.
Description
Sets the number of columns for this text area.

Exceptions
IllegalArgumentException if the value supplied for columns is less than zero.
See Also
getColumns, setRows


 TextArea.setRows

TextArea.setRows

Syntax
public void setRows( int rows )
Parameters
rows
the number of rows.
Description
Sets the number of rows for this text area.

Exceptions
IllegalArgumentException if the value supplied for rows is less than zero.
See Also
getRows, setColumns


 Class TextComponent

Class java.awt.TextComponent

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.TextComponent

public class TextComponent
extends Component

The TextComponent class is the superclass of any component that allows the editing of some text.

A text component embodies a string of text. The TextComponent class defines a set of methods that determine whether or not this text is editable. If the component is editable, it defines another set of methods that supports a text insertion caret.

In addition, the class defines methods that are used to maintain a current selection from the text. The text selection, a substring of the component's text, is the target of editing operations. It is also referred to as the selected text.


 TextComponent Members

TextComponent Members

Class Overview | This Package | All Packages

Fields
Name | Description
textListener |

Methods
Name | Description
addTextListener(TextListener) | Adds the specified text event listener to recieve text events from this textcomponent.
getCaretPosition() | Gets the position of the text insertion caret for this text component.
getSelectedText() | Gets the selected text from the text that is presented by this text component.
getSelectionEnd() | Gets the end position of the selected text in this text component.
getSelectionStart() | Gets the start position of the selected text in this text component.
getText() | Gets the text that is presented by this text component.
isEditable() | Indicates whether or not this text component is editable.
paramString() | Returns the parameter string representing the state of this text component.
processEvent(AWTEvent) | Processes events on this textcomponent.
processTextEvent(TextEvent) | Processes text events occurring on this text component by dispatching them to any registered TextListener objects.
removeNotify() | Removes the TextComponent's peer.
removeTextListener(TextListener) | Removes the specified text event listener so that it no longer receives text events from this textcomponent
select(int, int) | Selects the text between the specified start and end positions.
selectAll() | Selects all the text in this text component.
setCaretPosition(int) | Sets the position of the text insertion caret for this text component.
setEditable(boolean) | Sets the flag that determines whether or not this text component is editable.
setSelectionEnd(int) | Sets the selection end for this text component to the specified position.
setSelectionStart(int) | Sets the selection start for this text component to the specified position.
setText(String) | Sets the text that is presented by this text component to be the specified text.


 TextComponent.textListener

TextComponent.textListener

Syntax
protected transient TextListener textListener


 TextComponent.addTextListener

TextComponent.addTextListener

Syntax
public synchronized void addTextListener( TextListener l )
Parameters
l
the text event listener
Description
Adds the specified text event listener to recieve text events from this textcomponent.


 TextComponent.getCaretPosition

TextComponent.getCaretPosition

Syntax
public int getCaretPosition()
Returns
the position of the text insertion caret.
Description
Gets the position of the text insertion caret for this text component.


 TextComponent.getSelectedText

TextComponent.getSelectedText

Syntax
public synchronized String getSelectedText()
Returns
the selected text of this text component.
Description
Gets the selected text from the text that is presented by this text component.

See Also
select


 TextComponent.getSelectionEnd

TextComponent.getSelectionEnd

Syntax
public synchronized int getSelectionEnd()
Returns
the end position of the selected text.
Description
Gets the end position of the selected text in this text component.

See Also
setSelectionEnd, getSelectionStart


 TextComponent.getSelectionStart

TextComponent.getSelectionStart

Syntax
public synchronized int getSelectionStart()
Returns
the start position of the selected text.
Description
Gets the start position of the selected text in this text component.

See Also
setSelectionStart, getSelectionEnd


 TextComponent.getText

TextComponent.getText

Syntax
public synchronized String getText()
Description
Gets the text that is presented by this text component.

See Also
setText


 TextComponent.isEditable

TextComponent.isEditable

Syntax
public boolean isEditable()
Returns
true if this text component is editable; false otherwise.
Description
Indicates whether or not this text component is editable.

See Also
setEditable


 TextComponent.paramString

TextComponent.paramString

Syntax
protected String paramString()
Returns
the parameter string of this text component.
Description
Returns the parameter string representing the state of this text component. This string is useful for debugging.

Overrides
paramString in class Component


 TextComponent.processEvent

TextComponent.processEvent

Syntax
protected void processEvent( AWTEvent e )
Parameters
e
the event
Description
Processes events on this textcomponent. If the event is a TextEvent, it invokes the processTextEvent method, else it invokes its superclass's processEvent.

Overrides
processEvent in class Component


 TextComponent.processTextEvent

TextComponent.processTextEvent

Syntax
protected void processTextEvent( TextEvent e )
Parameters
e
the text event
Description
Processes text events occurring on this text component by dispatching them to any registered TextListener objects. NOTE: This method will not be called unless text events are enabled for this component; this happens when one of the following occurs: a) A TextListener object is registered via addTextListener() b) Text events are enabled via enableEvents()

See Also
enableEvents


 TextComponent.removeNotify

TextComponent.removeNotify

Syntax
public void removeNotify()
Description
Removes the TextComponent's peer. The peer allows us to modify the appearance of the TextComponent without changing its functionality.

Overrides
removeNotify in class Component


 TextComponent.removeTextListener

TextComponent.removeTextListener

Syntax
public void removeTextListener( TextListener l )
Description
Removes the specified text event listener so that it no longer receives text events from this textcomponent


 TextComponent.select

TextComponent.select

Syntax
public synchronized void select( int selectionStart, int selectionEnd )
Parameters
selectionStart
the start position of the text to select.
selectionEnd
the end position of the text to select.
Description
Selects the text between the specified start and end positions.

This method sets the start and end positions of the selected text, enforcing the restriction that the end position must be greater than or equal to the start position. The start position must be greater than zero, and the end position must be less that or equal to the length of the text component's text. If the caller supplies values that are inconsistent or out of bounds, the method enforces these constraints silently, and without failure.

See Also
setSelectionStart, setSelectionEnd, selectAll


 TextComponent.selectAll

TextComponent.selectAll

Syntax
public synchronized void selectAll()
Description
Selects all the text in this text component.

See Also
TextComponent@select


 TextComponent.setCaretPosition

TextComponent.setCaretPosition

Syntax
public void setCaretPosition( int position )
Parameters
position
the position of the text insertion caret.
Description
Sets the position of the text insertion caret for this text component.

Exceptions
IllegalArgumentException if the value supplied for position is less than zero.


 TextComponent.setEditable

TextComponent.setEditable

Syntax
public synchronized void setEditable( boolean b )
Parameters
t
a flag indicating whether this text component should be user editable.
Description
Sets the flag that determines whether or not this text component is editable.

If the flag is set to true, this text component becomes user editable. If the flag is set to false, the user cannot change the text of this text component.

See Also
isEditable


 TextComponent.setSelectionEnd

TextComponent.setSelectionEnd

Syntax
public synchronized void setSelectionEnd( int selectionEnd )
Parameters
selectionEnd
the end position of the selected text.
Description
Sets the selection end for this text component to the specified position. The new end point is constrained to be at or after the current selection start. It also cannot be set beyond the end of the component's text. If the caller supplies a value for selectionEnd that is out of bounds, the method enforces these constraints silently, and without failure.

See Also
getSelectionEnd, setSelectionStart


 TextComponent.setSelectionStart

TextComponent.setSelectionStart

Syntax
public synchronized void setSelectionStart( int selectionStart )
Parameters
selectionStart
the start position of the selected text.
Description
Sets the selection start for this text component to the specified position. The new start point is constrained to be at or before the current selection end. It also cannot be set to less than zero, the beginning of the component's text. If the caller supplies a value for selectionStart that is out of bounds, the method enforces these constraints silently, and without failure.

See Also
getSelectionStart, setSelectionEnd


 TextComponent.setText

TextComponent.setText

Syntax
public synchronized void setText( String t )
Parameters
t
the new text.
Description
Sets the text that is presented by this text component to be the specified text.

See Also
getText


 Class TextField

Class java.awt.TextField

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.TextComponent
                   |
                   +----java.awt.TextField

public class TextField
extends TextComponent

A TextField object is a text component that allows for the editing of a single line of text.

For example, the following image depicts a frame with four text fields of varying widths. Two of these text fields display the predefined text "Hello".

Here is the code that produces these four text fields:

 TextField tf1, tf2, tf3, tf4;
 // a blank text field
 tf1 = new TextField();
 // blank field of 20 columns
 tf2 = new TextField("", 20);
 // predefined text displayed
 tf3 = new TextField("Hello!");
 // predefined text in 30 columns
 tf4 = new TextField("Hello", 30);

Every time the user types a key in the text field, AWT sends two action events to the text field. The first one represents the key press and the second one, the key release. Each action event embodies the state of the system at the time that some action occurred. The properties of an action event indicate which key was pressed, what modifier keys were also pressed, and the time at which the event occurred.

Since the event is an instance of ActionEvent, the TextField class's processEvent method examines the event and passes it along to processActionEvent. The latter method redirects the event to any ActionListener objects that have registered an interest in action events generated by this text field.

See Also:
ActionEvent, processEvent, processActionEvent


 TextField Members

TextField Members

Class Overview | This Package | All Packages

Constructors
Name | Description
TextField() | Constructs a new text field.
TextField(int) | Constructs a new empty TextField with the specified number of columns.
TextField(String) | Constructs a new text field initialized with the specified text.
TextField(String, int) | Constructs a new text field initialized with the specified text to be displayed, and wide enough to hold the specified number of characters.

Methods
Name | Description
addActionListener(ActionListener) | Adds the specified action listener to recieve action events from this text field.
addNotify() | Creates the TextField's peer.
echoCharIsSet() | Indicates whether or not this text field has a character set for echoing.
getColumns() | Gets the number of columns in this text field.
getEchoChar() | Gets the character that is to be used for echoing.
getMinimumSize() | Gets the minumum dimensions for this text field.
getMinimumSize(int) | Gets the minumum dimensions for a text field with the specified number of columns.
getPreferredSize() | Gets the preferred size of this text field.
getPreferredSize(int) | Gets the preferred size of this text field with the specified number of columns.
minimumSize() | Deprecated.
minimumSize(int) | Deprecated.
paramString() | Returns the parameter string representing the state of this text field.
preferredSize() | Deprecated.
preferredSize(int) | Deprecated.
processActionEvent(ActionEvent) | Processes action events occurring on this text field by dispatching them to any registered ActionListener objects.
processEvent(AWTEvent) | Processes events on this text field.
removeActionListener(ActionListener) | Removes the specified action listener so that it no longer receives action events from this text field.
setColumns(int) | Sets the number of columns in this text field.
setEchoChar(char) | Sets the echo character for this text field.
setEchoCharacter(char) | Deprecated.


 TextField.TextField

TextField.TextField

Syntax 1
public TextField()
Description
Constructs a new text field.

Syntax 2
public TextField( String text )
Parameters
text
the text to be displayed.
Description
Constructs a new text field initialized with the specified text.

Syntax 3
public TextField( int columns )
Parameters
columns
the number of columns
Description
Constructs a new empty TextField with the specified number of columns.

Syntax 4
public TextField( String text, int columns )
Parameters
text
the text to be displayed.
columns
the number of characters.
Description
Constructs a new text field initialized with the specified text to be displayed, and wide enough to hold the specified number of characters.


 TextField.addActionListener

TextField.addActionListener

Syntax
public synchronized void addActionListener( ActionListener l )
Parameters
l
the action listener.
Description
Adds the specified action listener to recieve action events from this text field.

See Also
ActionListener, removeActionListener


 TextField.addNotify

TextField.addNotify

Syntax
public void addNotify()
Description
Creates the TextField's peer. The peer allows us to modify the appearance of the TextField without changing its functionality.

Overrides
addNotify in class Component


 TextField.echoCharIsSet

TextField.echoCharIsSet

Syntax
public boolean echoCharIsSet()
Returns
true if this text field has a character set for echoing; false otherwise.
Description
Indicates whether or not this text field has a character set for echoing.

An echo character is useful for text fields where user input should not be echoed to the screen, as in the case of a text field for entering a password.

See Also
setEchoChar, getEchoChar


 TextField.getColumns

TextField.getColumns

Syntax
public int getColumns()
Returns
the number of columns.
Description
Gets the number of columns in this text field.

See Also
setColumns


 TextField.getEchoChar

TextField.getEchoChar

Syntax
public char getEchoChar()
Returns
the echo character for this text field.
Description
Gets the character that is to be used for echoing.

An echo character is useful for text fields where user input should not be echoed to the screen, as in the case of a text field for entering a password.

See Also
echoCharIsSet, setEchoChar


 TextField.getMinimumSize

TextField.getMinimumSize

Syntax 1
public Dimension getMinimumSize( int columns )
Parameters
columns
the number of columns in this text field.
Description
Gets the minumum dimensions for a text field with the specified number of columns.

Syntax 2
public Dimension getMinimumSize()
Returns
the minimum dimensions for displaying this text field.
Description
Gets the minumum dimensions for this text field.

Overrides
getMinimumSize in class Component


 TextField.getPreferredSize

TextField.getPreferredSize

Syntax 1
public Dimension getPreferredSize( int columns )
Parameters
columns
the number of columns in this text field.
Returns
the preferred dimensions for displaying this text field.
Description
Gets the preferred size of this text field with the specified number of columns.

Syntax 2
public Dimension getPreferredSize()
Returns
the preferred dimensions for displaying this text field.
Description
Gets the preferred size of this text field.

Overrides
getPreferredSize in class Component


 TextField.minimumSize

TextField.minimumSize

Syntax 1
public Dimension minimumSize( int columns )
Description
Note: minimumSize() is deprecated. As of JDK version 1.1, replaced by getMinimumSize(int).

Syntax 2
public Dimension minimumSize()
Description
Note: minimumSize() is deprecated. As of JDK version 1.1, replaced by getMinimumSize().

Overrides
minimumSize in class Component


 TextField.paramString

TextField.paramString

Syntax
protected String paramString()
Returns
the parameter string of this text field.
Description
Returns the parameter string representing the state of this text field. This string is useful for debugging.

Overrides
paramString in class TextComponent


 TextField.preferredSize

TextField.preferredSize

Syntax 1
public Dimension preferredSize( int columns )
Description
Note: preferredSize() is deprecated. As of JDK version 1.1, replaced by getPreferredSize(int).

Syntax 2
public Dimension preferredSize()
Description
Note: preferredSize() is deprecated. As of JDK version 1.1, replaced by getPreferredSize().

Overrides
preferredSize in class Component


 TextField.processActionEvent

TextField.processActionEvent

Syntax
protected void processActionEvent( ActionEvent e )
Parameters
e
the action event.
Description
Processes action events occurring on this text field by dispatching them to any registered ActionListener objects.

This method is not called unless action events are enabled for this component. Action events are enabled when one of the following occurs:

  • An ActionListener object is registered via addActionListener.
  • Action events are enabled via enableEvents.

See Also
ActionListener, addActionListener, enableEvents


 TextField.processEvent

TextField.processEvent

Syntax
protected void processEvent( AWTEvent e )
Parameters
e
the event.
Description
Processes events on this text field. If the event is an instance of ActionEvent, it invokes the processActionEvent method. Otherwise, it invokes processEvent on the superclass.

Overrides
processEvent in class TextComponent
See Also
ActionEvent, processActionEvent


 TextField.removeActionListener

TextField.removeActionListener

Syntax
public synchronized void removeActionListener( ActionListener l )
Parameters
l
the action listener.
Description
Removes the specified action listener so that it no longer receives action events from this text field.

See Also
ActionListener, addActionListener


 TextField.setColumns

TextField.setColumns

Syntax
public void setColumns( int columns )
Parameters
columns
the number of columns.
Description
Sets the number of columns in this text field.

Exceptions
IllegalArgumentException if the value supplied for columns is less than zero.
See Also
getColumns


 TextField.setEchoChar

TextField.setEchoChar

Syntax
public void setEchoChar( char c )
Parameters
c
the echo character for this text field.
Description
Sets the echo character for this text field.

An echo character is useful for text fields where user input should not be echoed to the screen, as in the case of a text field for entering a password.

See Also
echoCharIsSet, getEchoChar


 TextField.setEchoCharacter

TextField.setEchoCharacter

Syntax
public void setEchoCharacter( char c )
Description
Note: setEchoCharacter() is deprecated. As of JDK version 1.1, replaced by setEchoChar(char).


 Class Toolkit

Class java.awt.Toolkit

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Toolkit

public abstract class Toolkit
extends Object

This class is the abstract superclass of all actual implementations of the Abstract Window Toolkit. Subclasses of Toolkit are used to bind the various components to particular native toolkit implementations.

Most applications should not call any of the methods in this class directly. The methods defined by Toolkit are the "glue" that joins the platform-independent classes in the java.awt package with their counterparts in java.awt.peer. Some methods defined by Toolkit query the native operating system directly.


 Toolkit Members

Toolkit Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Toolkit() |

Methods
Name | Description
beep() | Emits an audio beep.
checkImage(Image, int, int, ImageObserver) | Indicates the construction status of a specified image that is being prepared for display.
createButton(Button) | Creates this toolkit's implementation of Button using the specified peer interface.
createCanvas(Canvas) | Creates this toolkit's implementation of Canvas using the specified peer interface.
createCheckbox(Checkbox) | Creates this toolkit's implementation of Checkbox using the specified peer interface.
createCheckboxMenuItem(CheckboxMenuItem) | Creates this toolkit's implementation of CheckboxMenuItem using the specified peer interface.
createChoice(Choice) | Creates this toolkit's implementation of Choice using the specified peer interface.
createComponent(Component) | Creates a peer for a component or container.
createDialog(Dialog) | Creates this toolkit's implementation of Dialog using the specified peer interface.
createFileDialog(FileDialog) | Creates this toolkit's implementation of FileDialog using the specified peer interface.
createFrame(Frame) | Creates this toolkit's implementation of Frame using the specified peer interface.
createImage(byte[]) | Creates an image which decodes the image stored in the specified byte array.
createImage(byte[], int, int) | Creates an image which decodes the image stored in the specified byte array, and at the specified offset and length.
createImage(ImageProducer) | Creates an image with the specified image producer.
createLabel(Label) | Creates this toolkit's implementation of Label using the specified peer interface.
createList(List) | Creates this toolkit's implementation of List using the specified peer interface.
createMenu(Menu) | Creates this toolkit's implementation of Menu using the specified peer interface.
createMenuBar(MenuBar) | Creates this toolkit's implementation of MenuBar using the specified peer interface.
createMenuItem(MenuItem) | Creates this toolkit's implementation of MenuItem using the specified peer interface.
createPanel(Panel) | Creates this toolkit's implementation of Panel using the specified peer interface.
createPopupMenu(PopupMenu) | Creates this toolkit's implementation of PopupMenu using the specified peer interface.
createScrollbar(Scrollbar) | Creates this toolkit's implementation of Scrollbar using the specified peer interface.
createScrollPane(ScrollPane) | Creates this toolkit's implementation of ScrollPane using the specified peer interface.
createTextArea(TextArea) | Creates this toolkit's implementation of TextArea using the specified peer interface.
createTextField(TextField) | Creates this toolkit's implementation of TextField using the specified peer interface.
createWindow(Window) | Creates this toolkit's implementation of Window using the specified peer interface.
getColorModel() | Determines the color model of this toolkit's screen.
getDefaultToolkit() | Gets the default toolkit.
getFontList() Returns the names of the available fonts in this toolkit.

For 1.1, the following font names are deprecated (the replacement name follows):

  • TimesRoman (use Serif)
  • Helvetica (use SansSerif)
  • Courier (use Monospaced)

The ZapfDingbats font is also deprecated in 1.1, but only as a separate fontname.

getFontMetrics(Font) | Gets the screen metrics of the font.
getFontPeer(String, int) | Creates this toolkit's implementation of Font using the specified peer interface.
getImage(String) | Returns an image which gets pixel data from the specified file.
getImage(URL) | Returns an image which gets pixel data from the specified URL.
getMenuShortcutKeyMask() | Determines which modifier key is the appropriate accelerator key for menu shortcuts.
getNativeContainer(Component) | Give native peers the ability to query the native container given a native component (eg the direct parent may be lightweight).
getPrintJob(Frame, String, Properties) | Gets a PrintJob object which is the result of initiating a print operation on the toolkit's platform.
getProperty(String, String) | Gets a property with the specified key and default.
getScreenResolution() | Returns the screen resolution in dots-per-inch.
getScreenSize() | Gets the size of the screen.
getSystemClipboard() | Gets an instance of the system clipboard which interfaces with clipboard facilities provided by the native platform.
getSystemEventQueue() | Get the application's or applet's EventQueue instance.
getSystemEventQueueImpl()
loadSystemColors(int[]) | Fills in the integer array that is supplied as an argument with the current system color values.
prepareImage(Image, int, int, ImageObserver) | Prepares an image for rendering.
sync() | Synchronizes this toolkit's graphics state.


 Toolkit.Toolkit

Toolkit.Toolkit

Syntax
public Toolkit()


 Toolkit.beep

Toolkit.beep

Syntax
public abstract void beep()
Description
Emits an audio beep.


 Toolkit.checkImage

Toolkit.checkImage

Syntax
public abstract int checkImage( Image image, int width, int height, ImageObserver observer )
Parameters
image
the image whose status is being checked.
width
the width of the scaled version whose status is being checked, or -1.
height
the height of the scaled version whose status is being checked, or -1.
observer
the ImageObserver object to be notified as the image is being prepared.
Returns
the bitwise inclusive OR of the ImageObserver flags for the image data that is currently available.
Description
Indicates the construction status of a specified image that is being prepared for display.

If the values of the width and height arguments are both -1, this method returns the construction status of a screen representation of the specified image in this toolkit. Otherwise, this method returns the construction status of a scaled representation of the image at the specified width and height.

This method does not cause the image to begin loading. An application must call prepareImage to force the loading of an image.

This method is called by the component's checkImage methods.

Information on the flags returned by this method can be found with the definition of the ImageObserver interface.

See Also
prepareImage, checkImage, checkImage, ImageObserver


 Toolkit.createButton

Toolkit.createButton

Syntax
protected abstract ButtonPeer createButton( Button target )
Parameters
target
the button to be implemented.
Returns
this toolkit's implementation of Button.
Description
Creates this toolkit's implementation of Button using the specified peer interface.

See Also
Button, ButtonPeer


 Toolkit.createCanvas

Toolkit.createCanvas

Syntax
protected abstract CanvasPeer createCanvas( Canvas target )
Parameters
target
the canvas to be implemented.
Returns
this toolkit's implementation of Canvas.
Description
Creates this toolkit's implementation of Canvas using the specified peer interface.

See Also
Canvas, CanvasPeer


 Toolkit.createCheckbox

Toolkit.createCheckbox

Syntax
protected abstract CheckboxPeer createCheckbox( Checkbox target )
Parameters
target
the check box to be implemented.
Returns
this toolkit's implementation of Checkbox.
Description
Creates this toolkit's implementation of Checkbox using the specified peer interface.

See Also
Checkbox, CheckboxPeer


 Toolkit.createCheckboxMenuItem

Toolkit.createCheckboxMenuItem

Syntax
protected abstract CheckboxMenuItemPeer createCheckboxMenuItem( CheckboxMenuItem target )
Parameters
target
the checkbox menu item to be implemented.
Returns
this toolkit's implementation of CheckboxMenuItem.
Description
Creates this toolkit's implementation of CheckboxMenuItem using the specified peer interface.

See Also
CheckboxMenuItem, CheckboxMenuItemPeer


 Toolkit.createChoice

Toolkit.createChoice

Syntax
protected abstract ChoicePeer createChoice( Choice target )
Parameters
target
the choice to be implemented.
Returns
this toolkit's implementation of Choice.
Description
Creates this toolkit's implementation of Choice using the specified peer interface.

See Also
Choice, ChoicePeer


 Toolkit.createComponent

Toolkit.createComponent

Syntax
protected LightweightPeer createComponent( Component target )
Parameters
target
The Component to be created.
Description
Creates a peer for a component or container. This peer is windowless and allows the Component and Container classes to be extended directly to create windowless components that are defined entirely in java.


 Toolkit.createDialog

Toolkit.createDialog

Syntax
protected abstract DialogPeer createDialog( Dialog target )
Parameters
target
the dialog to be implemented.
Returns
this toolkit's implementation of Dialog.
Description
Creates this toolkit's implementation of Dialog using the specified peer interface.

See Also
Dialog, DialogPeer


 Toolkit.createFileDialog

Toolkit.createFileDialog

Syntax
protected abstract FileDialogPeer createFileDialog( FileDialog target )
Parameters
target
the file dialog to be implemented.
Returns
this toolkit's implementation of FileDialog.
Description
Creates this toolkit's implementation of FileDialog using the specified peer interface.

See Also
FileDialog, FileDialogPeer


 Toolkit.createFrame

Toolkit.createFrame

Syntax
protected abstract FramePeer createFrame( Frame target )
Parameters
target
the frame to be implemented.
Returns
this toolkit's implementation of Frame.
Description
Creates this toolkit's implementation of Frame using the specified peer interface.

See Also
Frame, FramePeer


 Toolkit.createImage

Toolkit.createImage

Syntax 1
public abstract Image createImage( ImageProducer producer )
Parameters
producer
the image producer to be used.
Returns
an image with the specified image producer.
Description
Creates an image with the specified image producer.

See Also
Image, ImageProducer, createImage

Syntax 2
public Image createImage( byte imagedata[] )
Parameters
imagedata
an array of bytes, representing image data in a supported image format.
Returns
an image.
Description
Creates an image which decodes the image stored in the specified byte array.

The data must be in some image format, such as GIF or JPEG, that is supported by this toolkit.

Syntax 3
public abstract Image createImage( byte imagedata[], int imageoffset, int imagelength )
Parameters
imagedata
an array of bytes, representing image data in a supported image format.
imageoffset
the offset of the beginning of the data in the array.
imagelength
the length of the data in the array.
Returns
an image.
Description
Creates an image which decodes the image stored in the specified byte array, and at the specified offset and length. The data must be in some image format, such as GIF or JPEG, that is supported by this toolkit.


 Toolkit.createLabel

Toolkit.createLabel

Syntax
protected abstract LabelPeer createLabel( Label target )
Parameters
target
the label to be implemented.
Returns
this toolkit's implementation of Label.
Description
Creates this toolkit's implementation of Label using the specified peer interface.

See Also
Label, LabelPeer


 Toolkit.createList

Toolkit.createList

Syntax
protected abstract ListPeer createList( List target )
Parameters
target
the list to be implemented.
Returns
this toolkit's implementation of List.
Description
Creates this toolkit's implementation of List using the specified peer interface.

See Also
List, ListPeer


 Toolkit.createMenu

Toolkit.createMenu

Syntax
protected abstract MenuPeer createMenu( Menu target )
Parameters
target
the menu to be implemented.
Returns
this toolkit's implementation of Menu.
Description
Creates this toolkit's implementation of Menu using the specified peer interface.

See Also
Menu, MenuPeer


 Toolkit.createMenuBar

Toolkit.createMenuBar

Syntax
protected abstract MenuBarPeer createMenuBar( MenuBar target )
Parameters
target
the menu bar to be implemented.
Returns
this toolkit's implementation of MenuBar.
Description
Creates this toolkit's implementation of MenuBar using the specified peer interface.

See Also
MenuBar, MenuBarPeer


 Toolkit.createMenuItem

Toolkit.createMenuItem

Syntax
protected abstract MenuItemPeer createMenuItem( MenuItem target )
Parameters
target
the menu item to be implemented.
Returns
this toolkit's implementation of MenuItem.
Description
Creates this toolkit's implementation of MenuItem using the specified peer interface.

See Also
MenuItem, MenuItemPeer


 Toolkit.createPanel

Toolkit.createPanel

Syntax
protected abstract PanelPeer createPanel( Panel target )
Parameters
target
the panel to be implemented.
Returns
this toolkit's implementation of Panel.
Description
Creates this toolkit's implementation of Panel using the specified peer interface.

See Also
Panel, PanelPeer


 Toolkit.createPopupMenu

Toolkit.createPopupMenu

Syntax
protected abstract PopupMenuPeer createPopupMenu( PopupMenu target )
Parameters
target
the popup menu to be implemented.
Returns
this toolkit's implementation of PopupMenu.
Description
Creates this toolkit's implementation of PopupMenu using the specified peer interface.

See Also
PopupMenu, PopupMenuPeer


 Toolkit.createScrollbar

Toolkit.createScrollbar

Syntax
protected abstract ScrollbarPeer createScrollbar( Scrollbar target )
Parameters
target
the scroll bar to be implemented.
Returns
this toolkit's implementation of Scrollbar.
Description
Creates this toolkit's implementation of Scrollbar using the specified peer interface.

See Also
Scrollbar, ScrollbarPeer


 Toolkit.createScrollPane

Toolkit.createScrollPane

Syntax
protected abstract ScrollPanePeer createScrollPane( ScrollPane target )
Parameters
target
the scroll pane to be implemented.
Returns
this toolkit's implementation of ScrollPane.
Description
Creates this toolkit's implementation of ScrollPane using the specified peer interface.

See Also
ScrollPane, ScrollPanePeer


 Toolkit.createTextArea

Toolkit.createTextArea

Syntax
protected abstract TextAreaPeer createTextArea( TextArea target )
Parameters
target
the text area to be implemented.
Returns
this toolkit's implementation of TextArea.
Description
Creates this toolkit's implementation of TextArea using the specified peer interface.

See Also
TextArea, TextAreaPeer


 Toolkit.createTextField

Toolkit.createTextField

Syntax
protected abstract TextFieldPeer createTextField( TextField target )
Parameters
target
the text field to be implemented.
Returns
this toolkit's implementation of TextField.
Description
Creates this toolkit's implementation of TextField using the specified peer interface.

See Also
TextField, TextFieldPeer


 Toolkit.createWindow

Toolkit.createWindow

Syntax
protected abstract WindowPeer createWindow( Window target )
Parameters
target
the window to be implemented.
Returns
this toolkit's implementation of Window.
Description
Creates this toolkit's implementation of Window using the specified peer interface.

See Also
Window, WindowPeer


 Toolkit.getColorModel

Toolkit.getColorModel

Syntax
public abstract ColorModel getColorModel()
Returns
the color model of this toolkit's screen.
Description
Determines the color model of this toolkit's screen.

ColorModel is an abstract class that encapsulates the ability to translate between the pixel values of an image and its red, green, blue, and alpha components.

This toolkit method is called by the getColorModel method of the Component class.

See Also
ColorModel, getColorModel


 Toolkit.getDefaultToolkit

Toolkit.getDefaultToolkit

Syntax
public static synchronized Toolkit getDefaultToolkit()
Returns
the default toolkit.
Description
Gets the default toolkit.

If there is a system property named "awt.toolkit", that property is treated as the name of a class that is a subclass of Toolkit.

If the system property does not exist, then the default toolkit used is the class named "sun.awt.motif.MToolkit", which is a motif implementation of the Abstract Window Toolkit.

Exceptions
AWTError if a toolkit could not be found, or if one could not be accessed or instantiated.


 Toolkit.getFontList

Toolkit.getFontList

Syntax
public abstract String[] getFontList()
Returns
the names of the available fonts in this toolkit.
Description
Returns the names of the available fonts in this toolkit.

For 1.1, the following font names are deprecated (the replacement name follows):

  • TimesRoman (use Serif)
  • Helvetica (use SansSerif)
  • Courier (use Monospaced)

The ZapfDingbats font is also deprecated in 1.1, but only as a separate fontname. Unicode defines the ZapfDingbat characters starting at ?, and as of 1.1 Java supports those characters.


 Toolkit.getFontMetrics

Toolkit.getFontMetrics

Syntax
public abstract FontMetrics getFontMetrics( Font font )
Parameters
font
a font.
Returns
the screen metrics of the specified font in this toolkit.
Description
Gets the screen metrics of the font.


 Toolkit.getFontPeer

Toolkit.getFontPeer

Syntax
protected abstract FontPeer getFontPeer( String name, int style )
Parameters
target
the font to be implemented.
Returns
this toolkit's implementation of Font.
Description
Creates this toolkit's implementation of Font using the specified peer interface.

See Also
Font, FontPeer


 Toolkit.getImage

Toolkit.getImage

Syntax 1
public abstract Image getImage( String filename )
Parameters
filename
the name of a file containing pixel data in a recognized file format.
Returns
an image which gets its pixel data from the specified file.
Description
Returns an image which gets pixel data from the specified file.

Syntax 2
public abstract Image getImage( URL url )
Parameters
url
the URL to use in fetching the pixel data.
Returns
an image which gets its pixel data from the specified URL.
Description
Returns an image which gets pixel data from the specified URL.


 Toolkit.getMenuShortcutKeyMask

Toolkit.getMenuShortcutKeyMask

Syntax
public int getMenuShortcutKeyMask()
Returns
the modifier mask on the Event class that is used for menu shortcuts on this toolkit.
Description
Determines which modifier key is the appropriate accelerator key for menu shortcuts.

Menu shortcuts, which are embodied in the MenuShortcut class, are handled by the MenuBar class.

By default, this method returns Event.CTRL_MASK. Toolkit implementations should override this method if the Control key isn't the correct key for accelerators.

See Also
MenuBar, MenuShortcut


 Toolkit.getNativeContainer

Toolkit.getNativeContainer

Syntax
protected static Container getNativeContainer( Component c )
Description
Give native peers the ability to query the native container given a native component (eg the direct parent may be lightweight).


 Toolkit.getPrintJob

Toolkit.getPrintJob

Syntax
public abstract PrintJob getPrintJob( Frame frame, String jobtitle, Properties props )
Returns
a PrintJob object, or null if the user cancelled the print job.
Description
Gets a PrintJob object which is the result of initiating a print operation on the toolkit's platform.

See Also
PrintJob


 Toolkit.getProperty

Toolkit.getProperty

Syntax
public static String getProperty( String key, String defaultValue )
Description
Gets a property with the specified key and default. This method returns defaultValue if the property is not found.


 Toolkit.getScreenResolution

Toolkit.getScreenResolution

Syntax
public abstract int getScreenResolution()
Returns
this toolkit's screen resolution, in dots-per-inch.
Description
Returns the screen resolution in dots-per-inch.


 Toolkit.getScreenSize

Toolkit.getScreenSize

Syntax
public abstract Dimension getScreenSize()
Returns
the size of this toolkit's screen, in pixels.
Description
Gets the size of the screen.


 Toolkit.getSystemClipboard

Toolkit.getSystemClipboard

Syntax
public abstract Clipboard getSystemClipboard()
Returns
an instance of the system clipboard.
Description
Gets an instance of the system clipboard which interfaces with clipboard facilities provided by the native platform.

This clipboard enables data transfer between Java programs and native applications which use native clipboard facilities.

See Also
Clipboard


 Toolkit.getSystemEventQueue

Toolkit.getSystemEventQueue

Syntax
public final EventQueue getSystemEventQueue()
Description
Get the application's or applet's EventQueue instance. Depending on the Toolkit implementation, different EventQueues may be returned for different applets. Applets should therefore not assume that the EventQueue instance returned by this method will be shared by other applets or the system.


 Toolkit.getSystemEventQueueImpl

Toolkit.getSystemEventQueueImpl

Syntax
protected abstract EventQueue getSystemEventQueueImpl()


 Toolkit.loadSystemColors

Toolkit.loadSystemColors

Syntax
protected void loadSystemColors( int systemColors[] )
Parameters
an
integer array.
Description
Fills in the integer array that is supplied as an argument with the current system color values.


 Toolkit.prepareImage

Toolkit.prepareImage

Syntax
public abstract boolean prepareImage( Image image, int width, int height, ImageObserver observer )
Parameters
image
the image for which to prepare a screen representation.
width
the width of the desired screen representation, or -1.
height
the height of the desired screen representation, or -1.
observer
the ImageObserver object to be notified as the image is being prepared.
Returns
true if the image has already been fully prepared; false otherwise.
Description
Prepares an image for rendering.

If the values of the width and height arguments are both -1, this method prepares the image for rendering on the default screen; otherwise, this method prepares an image for rendering on the default screen at the specified width and height.

The image data is downloaded asynchronously in another thread, and an appropriately scaled screen representation of the image is generated.

This method is called by components prepareImage methods.

Information on the flags returned by this method can be found with the definition of the ImageObserver interface.

See Also
prepareImage, prepareImage, ImageObserver


 Toolkit.sync

Toolkit.sync

Syntax
public abstract void sync()
Description
Synchronizes this toolkit's graphics state. Some window systems may do buffering of graphics events.

This method ensures that the display is up-to-date. It is useful for animation.


 Class Window

Class java.awt.Window

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Window

public class Window
extends Container

A Window object is a top-level window with no borders and no menubar. It could be used to implement a pop-up menu. The default layout for a window is BorderLayout. A Window object blocks input to other application windows when it is shown.

Windows are capable of generating the following window events: WindowOpened, WindowClosed.

See Also:
WindowEvent, addWindowListener, BorderLayout


 Window Members

Window Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Window(Frame) | Constructs a new invisible window.

Methods
Name | Description
addNotify() | Creates the Window's peer.
addWindowListener(WindowListener) | Adds the specified window listener to receive window events from this window.
dispose() | Disposes of this window.
getFocusOwner() | Returns the child component of this Window which has focus if and only if this Window is active.
getLocale() | Gets the Locale object that is associated with this window, if the locale has been set.
getToolkit() | Returns the toolkit of this frame.
getWarningString() | Gets the warning string that is displayed with this window.
isShowing() | Checks if this Window is showing on screen.
pack() | Causes subcomponents of this window to be laid out at their preferred size.
postEvent(Event) | Deprecated.
processEvent(AWTEvent) | Processes events on this window.
processWindowEvent(WindowEvent) | Processes window events occurring on this window by dispatching them to any registered WindowListener objects.
removeWindowListener(WindowListener) | Removes the specified window listener so that it no longer receives window events from this window.
show() | Shows this window, and brings it to the front.
toBack() | Sends this window to the back.
toFront() | Brings this window to the front.


 Window.Window

Window.Window

Syntax
public Window( Frame parent )
Parameters
parent
the main application frame.
Description
Constructs a new invisible window.

The window is not initially visible. Call the show method to cause the window to become visible.

See Also
show, setSize


 Window.addNotify

Window.addNotify

Syntax
public void addNotify()
Description
Creates the Window's peer. The peer allows us to modify the appearance of the Window without changing its functionality.

Overrides
addNotify in class Container


 Window.addWindowListener

Window.addWindowListener

Syntax
public synchronized void addWindowListener( WindowListener l )
Parameters
l
the window listener
Description
Adds the specified window listener to receive window events from this window.


 Window.dispose

Window.dispose

Syntax
public void dispose()
Description
Disposes of this window. This method must be called to release the resources that are used for the window.


 Window.getFocusOwner

Window.getFocusOwner

Syntax
public Component getFocusOwner()
Returns
the component with focus, or null if no children have focus assigned to them.
Description
Returns the child component of this Window which has focus if and only if this Window is active.


 Window.getLocale

Window.getLocale

Syntax
public Locale getLocale()
Returns
the locale that is set for this window.
Description
Gets the Locale object that is associated with this window, if the locale has been set. If no locale has been set, then the default locale is returned.

Overrides
getLocale in class Component
See Also
Locale


 Window.getToolkit

Window.getToolkit

Syntax
public Toolkit getToolkit()
Returns
the toolkit of this window.
Description
Returns the toolkit of this frame.

Overrides
getToolkit in class Component
See Also
Toolkit, getDefaultToolkit, getToolkit


 Window.getWarningString

Window.getWarningString

Syntax
public final String getWarningString()
Returns
the warning string for this window.
Description
Gets the warning string that is displayed with this window. If this window is insecure, the warning string is displayed somewhere in the visible area of the window. A window is insecure if there is a security manager, and the security manager's checkTopLevelWindow method returns false when this window is passed to it as an argument.

If the window is secure, then getWarningString returns null. If the window is insecure, this methods checks for the system property awt.appletWarning and returns the string value of that property.

See Also
checkTopLevelWindow


 Window.isShowing

Window.isShowing

Syntax
public boolean isShowing()
Description
Checks if this Window is showing on screen.

Overrides
isShowing in class Component
See Also
setVisible


 Window.pack

Window.pack

Syntax
public void pack()
Description
Causes subcomponents of this window to be laid out at their preferred size.


 Window.postEvent

Window.postEvent

Syntax
public boolean postEvent( Event e )
Description
Note: postEvent() is deprecated. As of JDK version 1.1 replaced by dispatchEvent(AWTEvent).

Overrides
postEvent in class Component


 Window.processEvent

Window.processEvent

Syntax
protected void processEvent( AWTEvent e )
Parameters
e
the event
Description
Processes events on this window. If the event is an WindowEvent, it invokes the processWindowEvent method, else it invokes its superclass's processEvent.

Overrides
processEvent in class Container


 Window.processWindowEvent

Window.processWindowEvent

Syntax
protected void processWindowEvent( WindowEvent e )
Parameters
e
the window event
Description
Processes window events occurring on this window by dispatching them to any registered WindowListener objects. NOTE: This method will not be called unless window events are enabled for this component; this happens when one of the following occurs: a) A WindowListener object is registered via addWindowListener() b) Window events are enabled via enableEvents()

See Also
enableEvents


 Window.removeWindowListener

Window.removeWindowListener

Syntax
public synchronized void removeWindowListener( WindowListener l )
Parameters
l
the window listener
Description
Removes the specified window listener so that it no longer receives window events from this window.


 Window.show

Window.show

Syntax
public void show()
Description
Shows this window, and brings it to the front.

If this window is not yet visible, show makes it visible. If this window is already visible, then this method brings it to the front.

Overrides
show in class Component
See Also
toFront, setVisible


 Window.toBack

Window.toBack

Syntax
public void toBack()
Description
Sends this window to the back. Places this window at the bottom of the stacking order and makes the corresponding adjustment to other visible windows.

See Also
toFront


 Window.toFront

Window.toFront

Syntax
public void toFront()
Description
Brings this window to the front. Places this window at the top of the stacking order and shows it in front of any other windows.

See Also
toBack


 Package java.awt.datatransfer

Package java.awt.datatransfer

All Packages

Interfaces

  • ClipboardOwner
  • Transferable

    • Classes

  • Clipboard
  • DataFlavor
  • StringSelection

    • Exceptions

  • UnsupportedFlavorException


 Class Clipboard

Class java.awt.datatransfer.Clipboard

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.datatransfer.Clipboard

public class Clipboard
extends Object

A class which implements a mechanism to transfer data using cut/copy/paste operations.


 Clipboard Members

Clipboard Members

Class Overview | This Package | All Packages

Fields
Name | Description
contents |
owner |

Constructors
Name | Description
Clipboard(String) | Creates a clipboard object.

Methods
Name | Description
getContents(Object) | Returns a transferable object representing the current contents of the clipboard.
getName() | Returns the name of this clipboard object.
setContents(Transferable, ClipboardOwner) | Sets the current contents of the clipboard to the specified transferable object and registers the specified clipboard owner as the owner of the new contents.


 Clipboard.contents

Clipboard.contents

Syntax
protected Transferable contents


 Clipboard.owner

Clipboard.owner

Syntax
protected ClipboardOwner owner


 Clipboard.Clipboard

Clipboard.Clipboard

Syntax
public Clipboard( String name )
Description
Creates a clipboard object.


 Clipboard.getContents

Clipboard.getContents

Syntax
public synchronized Transferable getContents( Object requestor )
Parameters
requestor
the object requesting the clip data
Returns
the current transferable object on the clipboard
Description
Returns a transferable object representing the current contents of the clipboard. If the clipboard currently has no contents, it returns null.


 Clipboard.getName

Clipboard.getName

Syntax
public String getName()
Description
Returns the name of this clipboard object.


 Clipboard.setContents

Clipboard.setContents

Syntax
public synchronized void setContents( Transferable contents, ClipboardOwner owner )
Parameters
content
the transferable object representing the clipboard content
owner
the object which owns the clipboard content
Description
Sets the current contents of the clipboard to the specified transferable object and registers the specified clipboard owner as the owner of the new contents. If there is an existing owner registered, that owner is notified that it no longer holds ownership of the clipboard contents.


 Interface ClipboardOwner

Interface java.awt.datatransfer.ClipboardOwner

Interface Members | This Package | All Packages

public interface ClipboardOwner

Defines the interface for classes that will provide data to a clipboard.


 ClipboardOwner Members

ClipboardOwner Members

Interface Overview | This Package | All Packages

Methods
Name | Description
lostOwnership(Clipboard, Transferable) | Notifies this object that it is no longer the owner of the contents of the clipboard.


 ClipboardOwner.lostOwnership

ClipboardOwner.lostOwnership

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void lostOwnership( Clipboard clipboard, Transferable contents )
Parameters
clipboard
the clipboard that is no longer owned
contents
the contents which this owner had placed on the clipboard
Description
Notifies this object that it is no longer the owner of the contents of the clipboard.


 Class DataFlavor

Class java.awt.datatransfer.DataFlavor

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.datatransfer.DataFlavor

public class DataFlavor
extends Object

Each instance represents the opaque concept of a data format as would appear on a clipboard, during drag and drop, or in a file system.


 DataFlavor Members

DataFlavor Members

Class Overview | This Package | All Packages

Fields
Name | Description
plainTextFlavor | The DataFlavor representing plain text with unicode encoding, where: representationClass = InputStream mimeType = "text/plain; charset=unicode"
stringFlavor | The DataFlavor representing a Java Unicode String class, where: representationClass = java.lang.String mimeType = "application/x-java-serialized-object"

Constructors
Name | Description
DataFlavor(Class, String) | Construct a DataFlavor that represents a Java class The returned DataFlavor will have the following characteristics representationClass = representationClass mimeType = application/x-java-serialized-object
DataFlavor(String, String) | Construct a DataFlavor that represents a MimeType The returned DataFlavor will have the following characteristics: If the mimeType is "application/x-java-serialized-object; class=", the result is the same as calling new DataFlavor(Class:forName() as above otherwise: representationClass = InputStream mimeType = mimeType

Methods
Name | Description
equals(DataFlavor) |
getHumanPresentableName() | Returns the human presentable name for the data foramt that this DataFlavor represents.
getMimeType() | Returns the MIME type string for this DataFlavor
getRepresentationClass() | Returns the Class which objects supporting this DataFlavor will return when this DataFlavor is requested.
isMimeTypeEqual(DataFlavor) | Convenience function equivalent to calling: isMimeTypeEqual(dataFlavor.getMimeType());
isMimeTypeEqual(String) | Is the string representation of the MIME type passed in equivalent to the MIME type of this DataFlavor.
normalizeMimeType(String) | Called for each MIME type string to give DataFlavor subtypes the opportunity to change how the normalization of MIME types is accomplished.
normalizeMimeTypeParameter(String, String) | Called on DataFlavor for every MIME Type parameter to allow DataFlavor subclasses to handle special parameters like the text/plain charset parameters, whose values are case insensitive.
setHumanPresentableName(String) | Sets the human presentable name for the data format that this DataFlavor represents.


 DataFlavor.plainTextFlavor

DataFlavor.plainTextFlavor

Syntax
public static DataFlavor plainTextFlavor
Description
The DataFlavor representing plain text with unicode encoding, where:

representationClass = InputStream
mimeType = "text/plain; charset=unicode"


 DataFlavor.stringFlavor

DataFlavor.stringFlavor

Syntax
public static DataFlavor stringFlavor
Description
The DataFlavor representing a Java Unicode String class, where:

representationClass = java.lang.String
mimeType = "application/x-java-serialized-object"


 DataFlavor.DataFlavor

DataFlavor.DataFlavor

Syntax 1
public DataFlavor( Class representationClass, String humanPresentableName )
Parameters
representationClass
the class used to transfer data in this flavor
humanPresentableName
the human-readible string used to identify this flavor
Description
Construct a DataFlavor that represents a Java class

The returned DataFlavor will have the following characteristics

representationClass = representationClass
mimeType = application/x-java-serialized-object

Syntax 2
public DataFlavor( String mimeType, String humanPresentableName )
Parameters
mimeType
the string used to identify the MIME type for this flavor
humanPresentableName
the human-readible string used to identify this flavor
Description
Construct a DataFlavor that represents a MimeType

The returned DataFlavor will have the following characteristics:

If the mimeType is "application/x-java-serialized-object; class=", the result is the same as calling new DataFlavor(Class:forName() as above

otherwise:

representationClass = InputStream
mimeType = mimeType


 DataFlavor.equals

DataFlavor.equals

Syntax
public boolean equals( DataFlavor dataFlavor )


 DataFlavor.getHumanPresentableName

DataFlavor.getHumanPresentableName

Syntax
public String getHumanPresentableName()
Description
Returns the human presentable name for the data foramt that this DataFlavor represents. This name would be localized for different countries


 DataFlavor.getMimeType

DataFlavor.getMimeType

Syntax
public String getMimeType()
Description
Returns the MIME type string for this DataFlavor


 DataFlavor.getRepresentationClass

DataFlavor.getRepresentationClass

Syntax
public Class getRepresentationClass()
Description
Returns the Class which objects supporting this DataFlavor will return when this DataFlavor is requested.


 DataFlavor.isMimeTypeEqual

DataFlavor.isMimeTypeEqual

Syntax 1
public boolean isMimeTypeEqual( String mimeType )
Description
Is the string representation of the MIME type passed in equivalent to the MIME type of this DataFlavor. This may involve adding default attributes for some MIME types (like adding charset=US-ASCII to text/plain MIME types that have no charset parameter specified)

Syntax 2
public final boolean isMimeTypeEqual( DataFlavor dataFlavor )
Description
Convenience function equivalent to calling: isMimeTypeEqual(dataFlavor.getMimeType());


 DataFlavor.normalizeMimeType

DataFlavor.normalizeMimeType

Syntax
protected String normalizeMimeType( String mimeType )
Description
Called for each MIME type string to give DataFlavor subtypes the opportunity to change how the normalization of MIME types is accomplished. One possible use would be to add default parameter/value pairs in cases where none are present in the MIME type string passed in


 DataFlavor.normalizeMimeTypeParameter

DataFlavor.normalizeMimeTypeParameter

Syntax
protected String normalizeMimeTypeParameter( String parameterName, String parameterValue )
Description
Called on DataFlavor for every MIME Type parameter to allow DataFlavor subclasses to handle special parameters like the text/plain charset parameters, whose values are case insensitive. (MIME type parameter values are supposed to be case sensitive.

This method is called for each parameter name/value pair and should return the normalized representation of the parameterValue


 DataFlavor.setHumanPresentableName

DataFlavor.setHumanPresentableName

Syntax
public void setHumanPresentableName( String humanPresentableName )
Description
Sets the human presentable name for the data format that this DataFlavor represents. This name would be localized for different countries


 Class StringSelection

Class java.awt.datatransfer.StringSelection

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.datatransfer.StringSelection

public class StringSelection
extends Object
implements Transferable, ClipboardOwner

A class which implements the capability required to transfer a simple java String in plain text format.


 StringSelection Members

StringSelection Members

Class Overview | This Package | All Packages

Constructors
Name | Description
StringSelection(String) | Creates a transferable object capable of transferring the specified string in plain text format.

Methods
Name | Description
getTransferData(DataFlavor) | If the data was requested in the "java.lang.String" flavor, return the String representing the selection.
getTransferDataFlavors() | Returns the array of flavors in which it can provide the data.
isDataFlavorSupported(DataFlavor) | Returns whether the requested flavor is supported by this object.
lostOwnership(Clipboard, Transferable) |


 StringSelection.StringSelection

StringSelection.StringSelection

Syntax
public StringSelection( String data )
Description
Creates a transferable object capable of transferring the specified string in plain text format.


 StringSelection.getTransferData

StringSelection.getTransferData

Syntax
public synchronized Object getTransferData( DataFlavor flavor ) throws UnsupportedFlavorException, IOException
Parameters
flavor
the requested flavor for the data
Description
If the data was requested in the "java.lang.String" flavor, return the String representing the selection.

Exceptions
UnsupportedFlavorException if the requested data flavor is not supported in the "java.lang.String" flavor.


 StringSelection.getTransferDataFlavors

StringSelection.getTransferDataFlavors

Syntax
public synchronized DataFlavor[] getTransferDataFlavors()
Description
Returns the array of flavors in which it can provide the data.


 StringSelection.isDataFlavorSupported

StringSelection.isDataFlavorSupported

Syntax
public boolean isDataFlavorSupported( DataFlavor flavor )
Parameters
flavor
the requested flavor for the data
Description
Returns whether the requested flavor is supported by this object.


 StringSelection.lostOwnership

StringSelection.lostOwnership

Syntax
public void lostOwnership( Clipboard clipboard, Transferable contents )


 Interface Transferable

Interface java.awt.datatransfer.Transferable

Interface Members | This Package | All Packages

public interface Transferable

Defines the interface for classes that can be used to provide data for a transfer operation.


 Transferable Members

Transferable Members

Interface Overview | This Package | All Packages

Methods
Name | Description
getTransferData(DataFlavor) | Returns an object which represents the data to be transferred.
getTransferDataFlavors() | Returns an array of DataFlavor objects indicating the flavors the data can be provided in.
isDataFlavorSupported(DataFlavor) | Returns whether or not the specified data flavor is supported for this object.


 Transferable.getTransferData

Transferable.getTransferData

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Object getTransferData( DataFlavor flavor ) throws UnsupportedFlavorException, IOException
Parameters
flavor
the requested flavor for the data
Description
Returns an object which represents the data to be transferred. The class of the object returned is defined by the representation class of the flavor.

Exceptions
IOException if the data is no longer available in the requested flavor.
Exceptions
UnsupportedFlavorException if the requested data flavor is not supported.
See Also
getRepresentationClass


 Transferable.getTransferDataFlavors

Transferable.getTransferDataFlavors

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract DataFlavor[] getTransferDataFlavors()
Returns
an array of data flavors in which this data can be transferred
Description
Returns an array of DataFlavor objects indicating the flavors the data can be provided in. The array should be ordered according to preference for providing the data (from most richly descriptive to least descriptive).


 Transferable.isDataFlavorSupported

Transferable.isDataFlavorSupported

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isDataFlavorSupported( DataFlavor flavor )
Parameters
flavor
the requested flavor for the data
Returns
boolean indicating wjether or not the data flavor is supported
Description
Returns whether or not the specified data flavor is supported for this object.


 Class UnsupportedFlavorException

Class java.awt.datatransfer.UnsupportedFlavorException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.awt.datatransfer.UnsupportedFlavorException

public class UnsupportedFlavorException
extends Exception

Signals that the requested data is not supported in this flavor.

See Also:
getTransferData


 UnsupportedFlavorException Members

UnsupportedFlavorException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
UnsupportedFlavorException(DataFlavor) | Constructs an UnsupportedFlavorException.


 UnsupportedFlavorException.UnsupportedFlavorException

UnsupportedFlavorException.UnsupportedFlavorException

Syntax
public UnsupportedFlavorException( DataFlavor flavor )
Parameters
flavor
the flavor object which caused the exception
Description
Constructs an UnsupportedFlavorException.


 Package java.awt.event

Package java.awt.event

All Packages

Interfaces

  • ActionListener
  • AdjustmentListener
  • ComponentListener
  • ContainerListener
  • FocusListener
  • ItemListener
  • KeyListener
  • MouseListener
  • MouseMotionListener
  • TextListener
  • WindowListener

    • Classes

  • ActionEvent
  • AdjustmentEvent
  • ComponentAdapter
  • ComponentEvent
  • ContainerAdapter
  • ContainerEvent
  • FocusAdapter
  • FocusEvent
  • InputEvent
  • ItemEvent
  • KeyAdapter
  • KeyEvent
  • MouseAdapter
  • MouseEvent
  • MouseMotionAdapter
  • PaintEvent
  • TextEvent
  • WindowAdapter
  • WindowEvent


 Class ActionEvent

Class java.awt.event.ActionEvent

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.EventObject
           |
           +----java.awt.AWTEvent
                   |
                   +----java.awt.event.ActionEvent

public class ActionEvent
extends AWTEvent

The action semantic event.

See Also:
ActionListener


 ActionEvent Members

ActionEvent Members

Class Overview | This Package | All Packages

Fields
Name | Description
ACTION_FIRST | Marks the first integer id for the range of action event ids.
ACTION_LAST | Marks the last integer id for the range of action event ids.
ACTION_PERFORMED | An action performed event type.
ALT_MASK | The alt modifier constant.
CTRL_MASK | The control modifier constant.
META_MASK | The meta modifier constant.
SHIFT_MASK | The shift modifier constant.

Constructors
Name | Description
ActionEvent(Object, int, String) | Constructs an ActionEvent object with the specified source object.
ActionEvent(Object, int, String, int) | Constructs an ActionEvent object with the specified source object.

Methods
Name | Description
getActionCommand() | Returns the command name associated with this action.
getModifiers() | Returns the modifiers held down during this action event.
paramString() |


 ActionEvent.ACTION_FIRST

ActionEvent.ACTION_FIRST

Syntax
public static final int ACTION_FIRST
Description
Marks the first integer id for the range of action event ids.


 ActionEvent.ACTION_LAST

ActionEvent.ACTION_LAST

Syntax
public static final int ACTION_LAST
Description
Marks the last integer id for the range of action event ids.


 ActionEvent.ACTION_PERFORMED

ActionEvent.ACTION_PERFORMED

Syntax
public static final int ACTION_PERFORMED
Description
An action performed event type.


 ActionEvent.ALT_MASK

ActionEvent.ALT_MASK

Syntax
public static final int ALT_MASK
Description
The alt modifier constant.


 ActionEvent.CTRL_MASK

ActionEvent.CTRL_MASK

Syntax
public static final int CTRL_MASK
Description
The control modifier constant.


 ActionEvent.META_MASK

ActionEvent.META_MASK

Syntax
public static final int META_MASK
Description
The meta modifier constant.


 ActionEvent.SHIFT_MASK

ActionEvent.SHIFT_MASK

Syntax
public static final int SHIFT_MASK
Description
The shift modifier constant.


 ActionEvent.ActionEvent

ActionEvent.ActionEvent

Syntax 1
public ActionEvent( Object source, int id, String command )
Parameters
source
the object where the event originated
id
the type of event
command
the command string for this action event
Description
Constructs an ActionEvent object with the specified source object.

Syntax 2
public ActionEvent( Object source, int id, String command, int modifiers )
Parameters
source
the object where the event originated
id
the type of event
command
the command string for this action event
modifiers
the modifiers held down during this action
Description
Constructs an ActionEvent object with the specified source object.


 ActionEvent.getActionCommand

ActionEvent.getActionCommand

Syntax
public String getActionCommand()
Description
Returns the command name associated with this action.


 ActionEvent.getModifiers

ActionEvent.getModifiers

Syntax
public int getModifiers()
Description
Returns the modifiers held down during this action event.


 ActionEvent.paramString

ActionEvent.paramString

Syntax
public String paramString()
Overrides
paramString in class AWTEvent


 Interface ActionListener

Interface java.awt.event.ActionListener

Interface Members | This Package | All Packages

public interface ActionListener
extends EventListener

The listener interface for receiving action events.


 ActionListener Members

ActionListener Members

Interface Overview | This Package | All Packages

Methods
Name | Description
actionPerformed(ActionEvent) | Invoked when an action occurs.


 ActionListener.actionPerformed

ActionListener.actionPerformed

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void actionPerformed( ActionEvent e )
Description
Invoked when an action occurs.


 Class AdjustmentEvent

Class java.awt.event.AdjustmentEvent

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.EventObject
           |
           +----java.awt.AWTEvent
                   |
                   +----java.awt.event.AdjustmentEvent

public class AdjustmentEvent
extends AWTEvent

The adjustment event emitted by Adjustable objects.

See Also:
Adjustable, AdjustmentListener


 AdjustmentEvent Members

AdjustmentEvent Members

Class Overview | This Package | All Packages

Fields
Name | Description
ADJUSTMENT_FIRST | Marks the first integer id for the range of adjustment event ids.
ADJUSTMENT_LAST | Marks the last integer id for the range of adjustment event ids.
ADJUSTMENT_VALUE_CHANGED | The adjustment value changed event.
BLOCK_DECREMENT | The block decrement adjustment type.
BLOCK_INCREMENT | The block increment adjustment type.
TRACK | The absolute tracking adjustment type.
UNIT_DECREMENT | The unit decrement adjustment type.
UNIT_INCREMENT | The unit increment adjustment type.

Constructors
Name | Description
AdjustmentEvent(Adjustable, int, int, int) | Constructs a AdjustmentEvent object with the specified Adjustable source, type, and value.

Methods
Name | Description
getAdjustable() | Returns the Adjustable object where this event originated.
getAdjustmentType() | Returns the type of adjustment which caused the value changed event.
getValue() | Returns the current value in the adjustment event.
paramString() |


 AdjustmentEvent.ADJUSTMENT_FIRST

AdjustmentEvent.ADJUSTMENT_FIRST

Syntax
public static final int ADJUSTMENT_FIRST
Description
Marks the first integer id for the range of adjustment event ids.


 AdjustmentEvent.ADJUSTMENT_LAST

AdjustmentEvent.ADJUSTMENT_LAST

Syntax
public static final int ADJUSTMENT_LAST
Description
Marks the last integer id for the range of adjustment event ids.


 AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED

AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED

Syntax
public static final int ADJUSTMENT_VALUE_CHANGED
Description
The adjustment value changed event.


 AdjustmentEvent.BLOCK_DECREMENT

AdjustmentEvent.BLOCK_DECREMENT

Syntax
public static final int BLOCK_DECREMENT
Description
The block decrement adjustment type.


 AdjustmentEvent.BLOCK_INCREMENT

AdjustmentEvent.BLOCK_INCREMENT

Syntax
public static final int BLOCK_INCREMENT
Description
The block increment adjustment type.


 AdjustmentEvent.TRACK

AdjustmentEvent.TRACK

Syntax
public static final int TRACK
Description
The absolute tracking adjustment type.


 AdjustmentEvent.UNIT_DECREMENT

AdjustmentEvent.UNIT_DECREMENT

Syntax
public static final int UNIT_DECREMENT
Description
The unit decrement adjustment type.


 AdjustmentEvent.UNIT_INCREMENT

AdjustmentEvent.UNIT_INCREMENT

Syntax
public static final int UNIT_INCREMENT
Description
The unit increment adjustment type.


 AdjustmentEvent.AdjustmentEvent

AdjustmentEvent.AdjustmentEvent

Syntax
public AdjustmentEvent( Adjustable source, int id, int type, int value )
Parameters
source
the Adjustable object where the event originated
Description
Constructs a AdjustmentEvent object with the specified Adjustable source, type, and value.


 AdjustmentEvent.getAdjustable

AdjustmentEvent.getAdjustable

Syntax
public Adjustable getAdjustable()
Description
Returns the Adjustable object where this event originated.


 AdjustmentEvent.getAdjustmentType

AdjustmentEvent.getAdjustmentType

Syntax
public int getAdjustmentType()
Description
Returns the type of adjustment which caused the value changed event.

See Also
UNIT_INCREMENT, UNIT_DECREMENT, BLOCK_INCREMENT, BLOCK_DECREMENT, TRACK


 AdjustmentEvent.getValue

AdjustmentEvent.getValue

Syntax
public int getValue()
Description
Returns the current value in the adjustment event.


 AdjustmentEvent.paramString

AdjustmentEvent.paramString

Syntax
public String paramString()
Overrides
paramString in class AWTEvent


 Interface AdjustmentListener

Interface java.awt.event.AdjustmentListener

Interface Members | This Package | All Packages

public interface AdjustmentListener
extends EventListener

The listener interface for receiving adjustment events.


 AdjustmentListener Members

AdjustmentListener Members

Interface Overview | This Package | All Packages

Methods
Name | Description
adjustmentValueChanged(AdjustmentEvent) | Invoked when the value of the adjustable has changed.


 AdjustmentListener.adjustmentValueChanged

AdjustmentListener.adjustmentValueChanged

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void adjustmentValueChanged( AdjustmentEvent e )
Description
Invoked when the value of the adjustable has changed.


 Class ComponentAdapter

Class java.awt.event.ComponentAdapter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.event.ComponentAdapter

public abstract class ComponentAdapter
extends Object
implements ComponentListener

The adapter which receives component events. The methods in this class are empty; this class is provided as a convenience for easily creating listeners by extending this class and overriding only the methods of interest.


 ComponentAdapter Members

ComponentAdapter Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ComponentAdapter() |

Methods
Name | Description
componentHidden(ComponentEvent) |
componentMoved(ComponentEvent) |
componentResized(ComponentEvent) |
componentShown(ComponentEvent) |


 ComponentAdapter.ComponentAdapter

ComponentAdapter.ComponentAdapter

Syntax
public ComponentAdapter()


 ComponentAdapter.componentHidden

ComponentAdapter.componentHidden

Syntax
public void componentHidden( ComponentEvent e )


 ComponentAdapter.componentMoved

ComponentAdapter.componentMoved

Syntax
public void componentMoved( ComponentEvent e )


 ComponentAdapter.componentResized

ComponentAdapter.componentResized

Syntax
public void componentResized( ComponentEvent e )


 ComponentAdapter.componentShown

ComponentAdapter.componentShown

Syntax
public void componentShown( ComponentEvent e )


 Class ComponentEvent

Class java.awt.event.ComponentEvent

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.EventObject
           |
           +----java.awt.AWTEvent
                   |
                   +----java.awt.event.ComponentEvent

public class ComponentEvent
extends AWTEvent

The root event class for all component-level events. These events are provided for notification purposes ONLY; The AWT will automatically handle component moves and resizes internally so that GUI layout works properly regardless of whether a program is receiving these events or not.

See Also:
ComponentListener


 ComponentEvent Members

ComponentEvent Members

Class Overview | This Package | All Packages

Fields
Name | Description
COMPONENT_FIRST | Marks the first integer id for the range of component event ids.
COMPONENT_HIDDEN | The component hidden event type.
COMPONENT_LAST | Marks the last integer id for the range of component event ids.
COMPONENT_MOVED | The component moved event type.
COMPONENT_RESIZED | The component resized event type.
COMPONENT_SHOWN | The component shown event type.

Constructors
Name | Description
ComponentEvent(Component, int) | Constructs a ComponentEvent object with the specified source component and type.

Methods
Name | Description
getComponent() | Returns the component where this event originated.
paramString() |


 ComponentEvent.COMPONENT_FIRST

ComponentEvent.COMPONENT_FIRST

Syntax
public static final int COMPONENT_FIRST
Description
Marks the first integer id for the range of component event ids.


 ComponentEvent.COMPONENT_HIDDEN

ComponentEvent.COMPONENT_HIDDEN

Syntax
public static final int COMPONENT_HIDDEN
Description
The component hidden event type.


 ComponentEvent.COMPONENT_LAST

ComponentEvent.COMPONENT_LAST

Syntax
public static final int COMPONENT_LAST
Description
Marks the last integer id for the range of component event ids.


 ComponentEvent.COMPONENT_MOVED

ComponentEvent.COMPONENT_MOVED

Syntax
public static final int COMPONENT_MOVED
Description
The component moved event type.


 ComponentEvent.COMPONENT_RESIZED

ComponentEvent.COMPONENT_RESIZED

Syntax
public static final int COMPONENT_RESIZED
Description
The component resized event type.


 ComponentEvent.COMPONENT_SHOWN

ComponentEvent.COMPONENT_SHOWN

Syntax
public static final int COMPONENT_SHOWN
Description
The component shown event type.


 ComponentEvent.ComponentEvent

ComponentEvent.ComponentEvent

Syntax
public ComponentEvent( Component source, int id )
Parameters
source
the component where the event originated
Description
Constructs a ComponentEvent object with the specified source component and type.


 ComponentEvent.getComponent

ComponentEvent.getComponent

Syntax
public Component getComponent()
Description
Returns the component where this event originated.


 ComponentEvent.paramString

ComponentEvent.paramString

Syntax
public String paramString()
Overrides
paramString in class AWTEvent


 Interface ComponentListener

Interface java.awt.event.ComponentListener

Interface Members | This Package | All Packages

public interface ComponentListener
extends EventListener

The listener interface for receiving component events. Component events are provided for notification purposes ONLY; The AWT will automatically handle component moves and resizes internally so that GUI layout works properly regardless of whether a program registers a ComponentListener or not.


 ComponentListener Members

ComponentListener Members

Interface Overview | This Package | All Packages

Methods
Name | Description
componentHidden(ComponentEvent) | Invoked when component has been hidden.
componentMoved(ComponentEvent) | Invoked when component has been moved.
componentResized(ComponentEvent) | Invoked when component has been resized.
componentShown(ComponentEvent) | Invoked when component has been shown.


 ComponentListener.componentHidden

ComponentListener.componentHidden

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void componentHidden( ComponentEvent e )
Description
Invoked when component has been hidden.


 ComponentListener.componentMoved

ComponentListener.componentMoved

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void componentMoved( ComponentEvent e )
Description
Invoked when component has been moved.


 ComponentListener.componentResized

ComponentListener.componentResized

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void componentResized( ComponentEvent e )
Description
Invoked when component has been resized.


 ComponentListener.componentShown

ComponentListener.componentShown

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void componentShown( ComponentEvent e )
Description
Invoked when component has been shown.


 Class ContainerAdapter

Class java.awt.event.ContainerAdapter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.event.ContainerAdapter

public abstract class ContainerAdapter
extends Object
implements ContainerListener

The adapter which receives container events. The methods in this class are empty; this class is provided as a convenience for easily creating listeners by extending this class and overriding only the methods of interest.


 ContainerAdapter Members

ContainerAdapter Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ContainerAdapter() |

Methods
Name | Description
componentAdded(ContainerEvent) |
componentRemoved(ContainerEvent) |


 ContainerAdapter.ContainerAdapter

ContainerAdapter.ContainerAdapter

Syntax
public ContainerAdapter()


 ContainerAdapter.componentAdded

ContainerAdapter.componentAdded

Syntax
public void componentAdded( ContainerEvent e )


 ContainerAdapter.componentRemoved

ContainerAdapter.componentRemoved

Syntax
public void componentRemoved( ContainerEvent e )


 Class ContainerEvent

Class java.awt.event.ContainerEvent

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.EventObject
           |
           +----java.awt.AWTEvent
                   |
                   +----java.awt.event.ComponentEvent
                           |
                           +----java.awt.event.ContainerEvent

public class ContainerEvent
extends ComponentEvent

The class for container-level events. These events are provided for notification purposes ONLY; The AWT will automatically handle container add and remove operations internally.

See Also:
ContainerListener


 ContainerEvent Members

ContainerEvent Members

Class Overview | This Package | All Packages

Fields
Name | Description
COMPONENT_ADDED | The component moved event type.
COMPONENT_REMOVED | The component resized event type.
CONTAINER_FIRST | Marks the first integer id for the range of container event ids.
CONTAINER_LAST | Marks the last integer id for the range of container event ids.

Constructors
Name | Description
ContainerEvent(Component, int, Component) | Constructs a ContainerEvent object with the specified source container, type, and child which is being added or removed.

Methods
Name | Description
getChild() | Returns the child component that was added or removed in this event.
getContainer() | Returns the container where this event originated.
paramString() |


 ContainerEvent.COMPONENT_ADDED

ContainerEvent.COMPONENT_ADDED

Syntax
public static final int COMPONENT_ADDED
Description
The component moved event type.


 ContainerEvent.COMPONENT_REMOVED

ContainerEvent.COMPONENT_REMOVED

Syntax
public static final int COMPONENT_REMOVED
Description
The component resized event type.


 ContainerEvent.CONTAINER_FIRST

ContainerEvent.CONTAINER_FIRST

Syntax
public static final int CONTAINER_FIRST
Description
Marks the first integer id for the range of container event ids.


 ContainerEvent.CONTAINER_LAST

ContainerEvent.CONTAINER_LAST

Syntax
public static final int CONTAINER_LAST
Description
Marks the last integer id for the range of container event ids.


 ContainerEvent.ContainerEvent

ContainerEvent.ContainerEvent

Syntax
public ContainerEvent( Component source, int id, Component child )
Parameters
source
the container where the event originated
Description
Constructs a ContainerEvent object with the specified source container, type, and child which is being added or removed.


 ContainerEvent.getChild

ContainerEvent.getChild

Syntax
public Component getChild()
Description
Returns the child component that was added or removed in this event.


 ContainerEvent.getContainer

ContainerEvent.getContainer

Syntax
public Container getContainer()
Description
Returns the container where this event originated.


 ContainerEvent.paramString

ContainerEvent.paramString

Syntax
public String paramString()
Overrides
paramString in class ComponentEvent


 Interface ContainerListener

Interface java.awt.event.ContainerListener

Interface Members | This Package | All Packages

public interface ContainerListener
extends EventListener

The listener interface for receiving container events. Container events are provided for notification purposes ONLY; The AWT will automatically handle add and remove operations internally.


 ContainerListener Members

ContainerListener Members

Interface Overview | This Package | All Packages

Methods
Name | Description
componentAdded(ContainerEvent) | Invoked when a component has been added to the container.
componentRemoved(ContainerEvent) | Invoked when a component has been removed from the container.


 ContainerListener.componentAdded

ContainerListener.componentAdded

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void componentAdded( ContainerEvent e )
Description
Invoked when a component has been added to the container.


 ContainerListener.componentRemoved

ContainerListener.componentRemoved

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void componentRemoved( ContainerEvent e )
Description
Invoked when a component has been removed from the container.


 Class FocusAdapter

Class java.awt.event.FocusAdapter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.event.FocusAdapter

public abstract class FocusAdapter
extends Object
implements FocusListener

The adapter which receives focus events. The methods in this class are empty; this class is provided as a convenience for easily creating listeners by extending this class and overriding only the methods of interest.


 FocusAdapter Members

FocusAdapter Members

Class Overview | This Package | All Packages

Constructors
Name | Description
FocusAdapter() |

Methods
Name | Description
focusGained(FocusEvent) |
focusLost(FocusEvent) |


 FocusAdapter.FocusAdapter

FocusAdapter.FocusAdapter

Syntax
public FocusAdapter()


 FocusAdapter.focusGained

FocusAdapter.focusGained

Syntax
public void focusGained( FocusEvent e )


 FocusAdapter.focusLost

FocusAdapter.focusLost

Syntax
public void focusLost( FocusEvent e )


 Class FocusEvent

Class java.awt.event.FocusEvent

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.EventObject
           |
           +----java.awt.AWTEvent
                   |
                   +----java.awt.event.ComponentEvent
                           |
                           +----java.awt.event.FocusEvent

public class FocusEvent
extends ComponentEvent

The component-level focus event. There are two levels of focus change events: permanent and temporary. Permanent focus change events occur when focus is directly moved from one component to another, such as through calls to requestFocus() or as the user uses the Tab key to traverse components. Temporary focus change events occur when focus is temporarily gained or lost for a component as the indirect result of another operation, such as window deactivation or a scrollbar drag. In this case, the original focus state will automatically be restored once that operation is finished, or, for the case of window deactivation, when the window is reactivated. Both permanent and temporary focus events are delivered using the FOCUS_GAINED and FOCUS_LOST event ids; the levels may be distinguished in the event using the isTemporary() method.


 FocusEvent Members

FocusEvent Members

Class Overview | This Package | All Packages

Fields
Name | Description
FOCUS_FIRST | Marks the first integer id for the range of focus event ids.
FOCUS_GAINED | The focus gained event type.
FOCUS_LAST | Marks the last integer id for the range of focus event ids.
FOCUS_LOST | The focus lost event type.

Constructors
Name | Description
FocusEvent(Component, int) | Constructs a permanent-level FocusEvent object with the specified source component and type.
FocusEvent(Component, int, boolean) | Constructs a FocusEvent object with the specified source component, type, and whether or not the focus event is a temporary level event.

Methods
Name | Description
isTemporary() | Returns whether or not this focus change event is a temporary change.
paramString() |


 FocusEvent.FOCUS_FIRST

FocusEvent.FOCUS_FIRST

Syntax
public static final int FOCUS_FIRST
Description
Marks the first integer id for the range of focus event ids.


 FocusEvent.FOCUS_GAINED

FocusEvent.FOCUS_GAINED

Syntax
public static final int FOCUS_GAINED
Description
The focus gained event type.


 FocusEvent.FOCUS_LAST

FocusEvent.FOCUS_LAST

Syntax
public static final int FOCUS_LAST
Description
Marks the last integer id for the range of focus event ids.


 FocusEvent.FOCUS_LOST

FocusEvent.FOCUS_LOST

Syntax
public static final int FOCUS_LOST
Description
The focus lost event type.


 FocusEvent.FocusEvent

FocusEvent.FocusEvent

Syntax 1
public FocusEvent( Component source, int id, boolean temporary )
Parameters
source
the object where the event originated
Description
Constructs a FocusEvent object with the specified source component, type, and whether or not the focus event is a temporary level event.

Syntax 2
public FocusEvent( Component source, int id )
Parameters
source
the object where the event originated
Description
Constructs a permanent-level FocusEvent object with the specified source component and type.


 FocusEvent.isTemporary

FocusEvent.isTemporary

Syntax
public boolean isTemporary()
Description
Returns whether or not this focus change event is a temporary change.


 FocusEvent.paramString

FocusEvent.paramString

Syntax
public String paramString()
Overrides
paramString in class ComponentEvent


 Interface FocusListener

Interface java.awt.event.FocusListener

Interface Members | This Package | All Packages

public interface FocusListener
extends EventListener

The listener interface for receiving keyboard focus events on a component.


 FocusListener Members

FocusListener Members

Interface Overview | This Package | All Packages

Methods
Name | Description
focusGained(FocusEvent) | Invoked when a component gains the keyboard focus.
focusLost(FocusEvent) | Invoked when a component loses the keyboard focus.


 FocusListener.focusGained

FocusListener.focusGained

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void focusGained( FocusEvent e )
Description
Invoked when a component gains the keyboard focus.


 FocusListener.focusLost

FocusListener.focusLost

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void focusLost( FocusEvent e )
Description
Invoked when a component loses the keyboard focus.


 Class InputEvent

Class java.awt.event.InputEvent

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.EventObject
           |
           +----java.awt.AWTEvent
                   |
                   +----java.awt.event.ComponentEvent
                           |
                           +----java.awt.event.InputEvent

public abstract class InputEvent
extends ComponentEvent

The root event class for all component-level input events. Input events are delivered to listeners before they are processed normally by the source where they originated. This allows listeners and component subclasses to "consume" the event so that the source will not process them in their default manner. For example, consuming mousePressed events on a Button component will prevent the Button from being activated.


 InputEvent Members

InputEvent Members

Class Overview | This Package | All Packages

Fields
Name | Description
ALT_MASK | The alt key modifier constant.
BUTTON1_MASK | The mouse button1 modifier constant.
BUTTON2_MASK | The mouse button2 modifier constant.
BUTTON3_MASK | The mouse button3 modifier constant.
CTRL_MASK | The control key modifier constant.
META_MASK | The meta key modifier constant.
SHIFT_MASK | The shift key modifier constant.

Methods
Name | Description
consume() | Consumes this event so that it will not be processed in the default manner by the source which originated it.
getModifiers() | Returns the modifiers flag for this event.
getWhen() | Returns the timestamp of when this event occurred.
isAltDown() | Returns whether or not the Alt modifier is down on this event.
isConsumed() | Returns whether or not this event has been consumed.
isControlDown() | Returns whether or not the Control modifier is down on this event.
isMetaDown() | Returns whether or not the Meta modifier is down on this event.
isShiftDown() | Returns whether or not the Shift modifier is down on this event.


 InputEvent.ALT_MASK

InputEvent.ALT_MASK

Syntax
public static final int ALT_MASK
Description
The alt key modifier constant.


 InputEvent.BUTTON1_MASK

InputEvent.BUTTON1_MASK

Syntax
public static final int BUTTON1_MASK
Description
The mouse button1 modifier constant.


 InputEvent.BUTTON2_MASK

InputEvent.BUTTON2_MASK

Syntax
public static final int BUTTON2_MASK
Description
The mouse button2 modifier constant.


 InputEvent.BUTTON3_MASK

InputEvent.BUTTON3_MASK

Syntax
public static final int BUTTON3_MASK
Description
The mouse button3 modifier constant.


 InputEvent.CTRL_MASK

InputEvent.CTRL_MASK

Syntax
public static final int CTRL_MASK
Description
The control key modifier constant.


 InputEvent.META_MASK

InputEvent.META_MASK

Syntax
public static final int META_MASK
Description
The meta key modifier constant.


 InputEvent.SHIFT_MASK

InputEvent.SHIFT_MASK

Syntax
public static final int SHIFT_MASK
Description
The shift key modifier constant.


 InputEvent.consume

InputEvent.consume

Syntax
public void consume()
Description
Consumes this event so that it will not be processed in the default manner by the source which originated it.

Overrides
consume in class AWTEvent


 InputEvent.getModifiers

InputEvent.getModifiers

Syntax
public int getModifiers()
Description
Returns the modifiers flag for this event.


 InputEvent.getWhen

InputEvent.getWhen

Syntax
public long getWhen()
Description
Returns the timestamp of when this event occurred.


 InputEvent.isAltDown

InputEvent.isAltDown

Syntax
public boolean isAltDown()
Description
Returns whether or not the Alt modifier is down on this event.


 InputEvent.isConsumed

InputEvent.isConsumed

Syntax
public boolean isConsumed()
Description
Returns whether or not this event has been consumed.

Overrides
isConsumed in class AWTEvent
See Also
consume


 InputEvent.isControlDown

InputEvent.isControlDown

Syntax
public boolean isControlDown()
Description
Returns whether or not the Control modifier is down on this event.


 InputEvent.isMetaDown

InputEvent.isMetaDown

Syntax
public boolean isMetaDown()
Description
Returns whether or not the Meta modifier is down on this event.


 InputEvent.isShiftDown

InputEvent.isShiftDown

Syntax
public boolean isShiftDown()
Description
Returns whether or not the Shift modifier is down on this event.


 Class ItemEvent

Class java.awt.event.ItemEvent

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.EventObject
           |
           +----java.awt.AWTEvent
                   |
                   +----java.awt.event.ItemEvent

public class ItemEvent
extends AWTEvent

The item event emitted by ItemSelectable objects. This event is generated when an item is selected or de-selected.

See Also:
ItemSelectable, ItemListener


 ItemEvent Members

ItemEvent Members

Class Overview | This Package | All Packages

Fields
Name | Description
DESELECTED | The item de-selected state change type.
ITEM_FIRST | Marks the first integer id for the range of item event ids.
ITEM_LAST | Marks the last integer id for the range of item event ids.
ITEM_STATE_CHANGED | The item state changed event type.
SELECTED | The item selected state change type.

Constructors
Name | Description
ItemEvent(ItemSelectable, int, Object, int) | Constructs a ItemSelectEvent object with the specified ItemSelectable source, type, item, and item select state.

Methods
Name | Description
getItem() | Returns the item where the event occurred.
getItemSelectable() | Returns the ItemSelectable object where this event originated.
getStateChange() | Returns the state change type which generated the event.
paramString() |


 ItemEvent.DESELECTED

ItemEvent.DESELECTED

Syntax
public static final int DESELECTED
Description
The item de-selected state change type.


 ItemEvent.ITEM_FIRST

ItemEvent.ITEM_FIRST

Syntax
public static final int ITEM_FIRST
Description
Marks the first integer id for the range of item event ids.


 ItemEvent.ITEM_LAST

ItemEvent.ITEM_LAST

Syntax
public static final int ITEM_LAST
Description
Marks the last integer id for the range of item event ids.


 ItemEvent.ITEM_STATE_CHANGED

ItemEvent.ITEM_STATE_CHANGED

Syntax
public static final int ITEM_STATE_CHANGED
Description
The item state changed event type.


 ItemEvent.SELECTED

ItemEvent.SELECTED

Syntax
public static final int SELECTED
Description
The item selected state change type.


 ItemEvent.ItemEvent

ItemEvent.ItemEvent

Syntax
public ItemEvent( ItemSelectable source, int id, Object item, int stateChange )
Parameters
source
the ItemSelectable object where the event originated
Description
Constructs a ItemSelectEvent object with the specified ItemSelectable source, type, item, and item select state.


 ItemEvent.getItem

ItemEvent.getItem

Syntax
public Object getItem()
Description
Returns the item where the event occurred.


 ItemEvent.getItemSelectable

ItemEvent.getItemSelectable

Syntax
public ItemSelectable getItemSelectable()
Description
Returns the ItemSelectable object where this event originated.


 ItemEvent.getStateChange

ItemEvent.getStateChange

Syntax
public int getStateChange()
Description
Returns the state change type which generated the event.

See Also
SELECTED, DESELECTED


 ItemEvent.paramString

ItemEvent.paramString

Syntax
public String paramString()
Overrides
paramString in class AWTEvent


 Interface ItemListener

Interface java.awt.event.ItemListener

Interface Members | This Package | All Packages

public interface ItemListener
extends EventListener

The listener interface for receiving item events.

See Also:
ItemSelectable


 ItemListener Members

ItemListener Members

Interface Overview | This Package | All Packages

Methods
Name | Description
itemStateChanged(ItemEvent) | Invoked when an item's state has been changed.


 ItemListener.itemStateChanged

ItemListener.itemStateChanged

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void itemStateChanged( ItemEvent e )
Description
Invoked when an item's state has been changed.


 Class KeyAdapter

Class java.awt.event.KeyAdapter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.event.KeyAdapter

public abstract class KeyAdapter
extends Object
implements KeyListener

The adapter which receives keyboard events. The methods in this class are empty; this class is provided as a convenience for easily creating listeners by extending this class and overriding only the methods of interest.


 KeyAdapter Members

KeyAdapter Members

Class Overview | This Package | All Packages

Constructors
Name | Description
KeyAdapter() |

Methods
Name | Description
keyPressed(KeyEvent) |
keyReleased(KeyEvent) |
keyTyped(KeyEvent) |


 KeyAdapter.KeyAdapter

KeyAdapter.KeyAdapter

Syntax
public KeyAdapter()


 KeyAdapter.keyPressed

KeyAdapter.keyPressed

Syntax
public void keyPressed( KeyEvent e )


 KeyAdapter.keyReleased

KeyAdapter.keyReleased

Syntax
public void keyReleased( KeyEvent e )


 KeyAdapter.keyTyped

KeyAdapter.keyTyped

Syntax
public void keyTyped( KeyEvent e )


 Class KeyEvent

Class java.awt.event.KeyEvent

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.EventObject
           |
           +----java.awt.AWTEvent
                   |
                   +----java.awt.event.ComponentEvent
                           |
                           +----java.awt.event.InputEvent
                                   |
                                   +----java.awt.event.KeyEvent

public class KeyEvent
extends InputEvent

The component-level keyboard event.


 KeyEvent Members

KeyEvent Members

Class Overview | This Package | All Packages

Fields
Name | Description
CHAR_UNDEFINED | KEY_PRESSED and KEY_RELEASED events which do not map to a valid Unicode character do not have a defined keyChar.
KEY_FIRST | Marks the first integer id for the range of key event ids.
KEY_LAST | Marks the last integer id for the range of key event ids.
KEY_PRESSED | The key pressed event type.
KEY_RELEASED | The key released event type.
KEY_TYPED | The key typed event type.
VK_0 | VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39)
VK_1 |
VK_2 |
VK_3 |
VK_4 |
VK_5 |
VK_6 |
VK_7 |
VK_8 |
VK_9 |
VK_A | VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A)
VK_ACCEPT |
VK_ADD |
VK_ALT |
VK_B |
VK_BACK_QUOTE |
VK_BACK_SLASH |
VK_BACK_SPACE |
VK_C |
VK_CANCEL |
VK_CAPS_LOCK |
VK_CLEAR |
VK_CLOSE_BRACKET |
VK_COMMA |
VK_CONTROL |
VK_CONVERT |
VK_D |
VK_DECIMAL |
VK_DELETE |
VK_DIVIDE |
VK_DOWN |
VK_E |
VK_END |
VK_ENTER | Virtual key codes.
VK_EQUALS |
VK_ESCAPE |
VK_F |
VK_F1 |
VK_F10 |
VK_F11 |
VK_F12 |
VK_F2 |
VK_F3 |
VK_F4 |
VK_F5 |
VK_F6 |
VK_F7 |
VK_F8 |
VK_F9 |
VK_FINAL | for Asian Keyboard
VK_G |
VK_H |
VK_HELP |
VK_HOME |
VK_I |
VK_INSERT |
VK_J |
VK_K |
VK_KANA |
VK_KANJI |
VK_L |
VK_LEFT |
VK_M |
VK_META |
VK_MODECHANGE |
VK_MULTIPLY |
VK_N |
VK_NONCONVERT |
VK_NUM_LOCK |
VK_NUMPAD0 |
VK_NUMPAD1 |
VK_NUMPAD2 |
VK_NUMPAD3 |
VK_NUMPAD4 |
VK_NUMPAD5 |
VK_NUMPAD6 |
VK_NUMPAD7 |
VK_NUMPAD8 |
VK_NUMPAD9 |
VK_O |
VK_OPEN_BRACKET |
VK_P |
VK_PAGE_DOWN |
VK_PAGE_UP |
VK_PAUSE |
VK_PERIOD |
VK_PRINTSCREEN |
VK_Q |
VK_QUOTE |
VK_R |
VK_RIGHT |
VK_S |
VK_SCROLL_LOCK |
VK_SEMICOLON |
VK_SEPARATER |
VK_SHIFT |
VK_SLASH |
VK_SPACE |
VK_SUBTRACT |
VK_T |
VK_TAB |
VK_U |
VK_UNDEFINED | KEY_TYPED events do not have a defined keyCode.
VK_UP |
VK_V |
VK_W |
VK_X |
VK_Y |
VK_Z |

Constructors
Name | Description
KeyEvent(Component, int, long, int, int) |
KeyEvent(Component, int, long, int, int, char) | Constructs a KeyEvent object with the specified source component, type, modifiers, and key.

Methods
Name | Description
getKeyChar() | Returns the character associated with the key in this event.
getKeyCode() | Returns the integer key-code associated with the key in this event.
getKeyModifiersText(int) | Returns a String describing the modifier key(s), such as "Shift", or "Ctrl+Shift".
getKeyText(int) | Returns a String describing the keyCode, such as "HOME", "F1" or "A".
isActionKey() | Returns whether or not the key in this event is an "action" key, as defined in Event.java.
paramString() |
setKeyChar(char) |
setKeyCode(int) |
setModifiers(int) |


 KeyEvent.CHAR_UNDEFINED

KeyEvent.CHAR_UNDEFINED

Syntax
public static final char CHAR_UNDEFINED
Description
KEY_PRESSED and KEY_RELEASED events which do not map to a valid Unicode character do not have a defined keyChar.


 KeyEvent.KEY_FIRST

KeyEvent.KEY_FIRST

Syntax
public static final int KEY_FIRST
Description
Marks the first integer id for the range of key event ids.


 KeyEvent.KEY_LAST

KeyEvent.KEY_LAST

Syntax
public static final int KEY_LAST
Description
Marks the last integer id for the range of key event ids.


 KeyEvent.KEY_PRESSED

KeyEvent.KEY_PRESSED

Syntax
public static final int KEY_PRESSED
Description
The key pressed event type.


 KeyEvent.KEY_RELEASED

KeyEvent.KEY_RELEASED

Syntax
public static final int KEY_RELEASED
Description
The key released event type.


 KeyEvent.KEY_TYPED

KeyEvent.KEY_TYPED

Syntax
public static final int KEY_TYPED
Description
The key typed event type. This type is generated by a combination of a key press followed by a key release.


 KeyEvent.VK_0

KeyEvent.VK_0

Syntax
public static final int VK_0
Description
VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39)


 KeyEvent.VK_1

KeyEvent.VK_1

Syntax
public static final int VK_1


 KeyEvent.VK_2

KeyEvent.VK_2

Syntax
public static final int VK_2


 KeyEvent.VK_3

KeyEvent.VK_3

Syntax
public static final int VK_3


 KeyEvent.VK_4

KeyEvent.VK_4

Syntax
public static final int VK_4


 KeyEvent.VK_5

KeyEvent.VK_5

Syntax
public static final int VK_5


 KeyEvent.VK_6

KeyEvent.VK_6

Syntax
public static final int VK_6


 KeyEvent.VK_7

KeyEvent.VK_7

Syntax
public static final int VK_7


 KeyEvent.VK_8

KeyEvent.VK_8

Syntax
public static final int VK_8


 KeyEvent.VK_9

KeyEvent.VK_9

Syntax
public static final int VK_9


 KeyEvent.VK_A

KeyEvent.VK_A

Syntax
public static final int VK_A
Description
VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A)


 KeyEvent.VK_ACCEPT

KeyEvent.VK_ACCEPT

Syntax
public static final int VK_ACCEPT


 KeyEvent.VK_ADD

KeyEvent.VK_ADD

Syntax
public static final int VK_ADD


 KeyEvent.VK_ALT

KeyEvent.VK_ALT

Syntax
public static final int VK_ALT


 KeyEvent.VK_B

KeyEvent.VK_B

Syntax
public static final int VK_B


 KeyEvent.VK_BACK_QUOTE

KeyEvent.VK_BACK_QUOTE

Syntax
public static final int VK_BACK_QUOTE


 KeyEvent.VK_BACK_SLASH

KeyEvent.VK_BACK_SLASH

Syntax
public static final int VK_BACK_SLASH


 KeyEvent.VK_BACK_SPACE

KeyEvent.VK_BACK_SPACE

Syntax
public static final int VK_BACK_SPACE


 KeyEvent.VK_C

KeyEvent.VK_C

Syntax
public static final int VK_C


 KeyEvent.VK_CANCEL

KeyEvent.VK_CANCEL

Syntax
public static final int VK_CANCEL


 KeyEvent.VK_CAPS_LOCK

KeyEvent.VK_CAPS_LOCK

Syntax
public static final int VK_CAPS_LOCK


 KeyEvent.VK_CLEAR

KeyEvent.VK_CLEAR

Syntax
public static final int VK_CLEAR


 KeyEvent.VK_CLOSE_BRACKET

KeyEvent.VK_CLOSE_BRACKET

Syntax
public static final int VK_CLOSE_BRACKET


 KeyEvent.VK_COMMA

KeyEvent.VK_COMMA

Syntax
public static final int VK_COMMA


 KeyEvent.VK_CONTROL

KeyEvent.VK_CONTROL

Syntax
public static final int VK_CONTROL


 KeyEvent.VK_CONVERT

KeyEvent.VK_CONVERT

Syntax
public static final int VK_CONVERT


 KeyEvent.VK_D

KeyEvent.VK_D

Syntax
public static final int VK_D


 KeyEvent.VK_DECIMAL

KeyEvent.VK_DECIMAL

Syntax
public static final int VK_DECIMAL


 KeyEvent.VK_DELETE

KeyEvent.VK_DELETE

Syntax
public static final int VK_DELETE


 KeyEvent.VK_DIVIDE

KeyEvent.VK_DIVIDE

Syntax
public static final int VK_DIVIDE


 KeyEvent.VK_DOWN

KeyEvent.VK_DOWN

Syntax
public static final int VK_DOWN


 KeyEvent.VK_E

KeyEvent.VK_E

Syntax
public static final int VK_E


 KeyEvent.VK_END

KeyEvent.VK_END

Syntax
public static final int VK_END


 KeyEvent.VK_ENTER

KeyEvent.VK_ENTER

Syntax
public static final int VK_ENTER
Description
Virtual key codes. These codes report which keyboard key has been pressed, rather than any character generated by one or more keys being pressed. For example, pressing the Shift key will cause a KEY_PRESSED event with a VK_SHIFT keyCode, while pressing the 'a' key will result in a VK_A keyCode. After the 'a' key is released, a KEY_RELEASED event will be fired with VK_A, followed by a KEY_TYPED event with a keyChar value of 'A'. Key combinations which do not result in characters, such as action keys like F1, will not generate KEY_TYPED events. Note: not all keyboards or systems are capable of generating all virtual key codes. No attempt is made in Java to artificially generate these keys. WARNING: aside from those keys where are defined by the Java language (VK_ENTER, VK_BACK_SPACE, and VK_TAB), do not rely on the values of these constants. Sun reserves the right to change these values as needed to accomodate a wider range of keyboards in the future.


 KeyEvent.VK_EQUALS

KeyEvent.VK_EQUALS

Syntax
public static final int VK_EQUALS


 KeyEvent.VK_ESCAPE

KeyEvent.VK_ESCAPE

Syntax
public static final int VK_ESCAPE


 KeyEvent.VK_F

KeyEvent.VK_F

Syntax
public static final int VK_F


 KeyEvent.VK_F1

KeyEvent.VK_F1

Syntax
public static final int VK_F1


 KeyEvent.VK_F10

KeyEvent.VK_F10

Syntax
public static final int VK_F10


 KeyEvent.VK_F11

KeyEvent.VK_F11

Syntax
public static final int VK_F11


 KeyEvent.VK_F12

KeyEvent.VK_F12

Syntax
public static final int VK_F12


 KeyEvent.VK_F2

KeyEvent.VK_F2

Syntax
public static final int VK_F2


 KeyEvent.VK_F3

KeyEvent.VK_F3

Syntax
public static final int VK_F3


 KeyEvent.VK_F4

KeyEvent.VK_F4

Syntax
public static final int VK_F4


 KeyEvent.VK_F5

KeyEvent.VK_F5

Syntax
public static final int VK_F5


 KeyEvent.VK_F6

KeyEvent.VK_F6

Syntax
public static final int VK_F6


 KeyEvent.VK_F7

KeyEvent.VK_F7

Syntax
public static final int VK_F7


 KeyEvent.VK_F8

KeyEvent.VK_F8

Syntax
public static final int VK_F8


 KeyEvent.VK_F9

KeyEvent.VK_F9

Syntax
public static final int VK_F9


 KeyEvent.VK_FINAL

KeyEvent.VK_FINAL

Syntax
public static final int VK_FINAL
Description
for Asian Keyboard


 KeyEvent.VK_G

KeyEvent.VK_G

Syntax
public static final int VK_G


 KeyEvent.VK_H

KeyEvent.VK_H

Syntax
public static final int VK_H


 KeyEvent.VK_HELP

KeyEvent.VK_HELP

Syntax
public static final int VK_HELP


 KeyEvent.VK_HOME

KeyEvent.VK_HOME

Syntax
public static final int VK_HOME


 KeyEvent.VK_I

KeyEvent.VK_I

Syntax
public static final int VK_I


 KeyEvent.VK_INSERT

KeyEvent.VK_INSERT

Syntax
public static final int VK_INSERT


 KeyEvent.VK_J

KeyEvent.VK_J

Syntax
public static final int VK_J


 KeyEvent.VK_K

KeyEvent.VK_K

Syntax
public static final int VK_K


 KeyEvent.VK_KANA

KeyEvent.VK_KANA

Syntax
public static final int VK_KANA


 KeyEvent.VK_KANJI

KeyEvent.VK_KANJI

Syntax
public static final int VK_KANJI


 KeyEvent.VK_L

KeyEvent.VK_L

Syntax
public static final int VK_L


 KeyEvent.VK_LEFT

KeyEvent.VK_LEFT

Syntax
public static final int VK_LEFT


 KeyEvent.VK_M

KeyEvent.VK_M

Syntax
public static final int VK_M


 KeyEvent.VK_META

KeyEvent.VK_META

Syntax
public static final int VK_META


 KeyEvent.VK_MODECHANGE

KeyEvent.VK_MODECHANGE

Syntax
public static final int VK_MODECHANGE


 KeyEvent.VK_MULTIPLY

KeyEvent.VK_MULTIPLY

Syntax
public static final int VK_MULTIPLY


 KeyEvent.VK_N

KeyEvent.VK_N

Syntax
public static final int VK_N


 KeyEvent.VK_NONCONVERT

KeyEvent.VK_NONCONVERT

Syntax
public static final int VK_NONCONVERT


 KeyEvent.VK_NUM_LOCK

KeyEvent.VK_NUM_LOCK

Syntax
public static final int VK_NUM_LOCK


 KeyEvent.VK_NUMPAD0

KeyEvent.VK_NUMPAD0

Syntax
public static final int VK_NUMPAD0


 KeyEvent.VK_NUMPAD1

KeyEvent.VK_NUMPAD1

Syntax
public static final int VK_NUMPAD1


 KeyEvent.VK_NUMPAD2

KeyEvent.VK_NUMPAD2

Syntax
public static final int VK_NUMPAD2


 KeyEvent.VK_NUMPAD3

KeyEvent.VK_NUMPAD3

Syntax
public static final int VK_NUMPAD3


 KeyEvent.VK_NUMPAD4

KeyEvent.VK_NUMPAD4

Syntax
public static final int VK_NUMPAD4


 KeyEvent.VK_NUMPAD5

KeyEvent.VK_NUMPAD5

Syntax
public static final int VK_NUMPAD5


 KeyEvent.VK_NUMPAD6

KeyEvent.VK_NUMPAD6

Syntax
public static final int VK_NUMPAD6


 KeyEvent.VK_NUMPAD7

KeyEvent.VK_NUMPAD7

Syntax
public static final int VK_NUMPAD7


 KeyEvent.VK_NUMPAD8

KeyEvent.VK_NUMPAD8

Syntax
public static final int VK_NUMPAD8


 KeyEvent.VK_NUMPAD9

KeyEvent.VK_NUMPAD9

Syntax
public static final int VK_NUMPAD9


 KeyEvent.VK_O

KeyEvent.VK_O

Syntax
public static final int VK_O


 KeyEvent.VK_OPEN_BRACKET

KeyEvent.VK_OPEN_BRACKET

Syntax
public static final int VK_OPEN_BRACKET


 KeyEvent.VK_P

KeyEvent.VK_P

Syntax
public static final int VK_P


 KeyEvent.VK_PAGE_DOWN

KeyEvent.VK_PAGE_DOWN

Syntax
public static final int VK_PAGE_DOWN


 KeyEvent.VK_PAGE_UP

KeyEvent.VK_PAGE_UP

Syntax
public static final int VK_PAGE_UP


 KeyEvent.VK_PAUSE

KeyEvent.VK_PAUSE

Syntax
public static final int VK_PAUSE


 KeyEvent.VK_PERIOD

KeyEvent.VK_PERIOD

Syntax
public static final int VK_PERIOD


 KeyEvent.VK_PRINTSCREEN

KeyEvent.VK_PRINTSCREEN

Syntax
public static final int VK_PRINTSCREEN


 KeyEvent.VK_Q

KeyEvent.VK_Q

Syntax
public static final int VK_Q


 KeyEvent.VK_QUOTE

KeyEvent.VK_QUOTE

Syntax
public static final int VK_QUOTE


 KeyEvent.VK_R

KeyEvent.VK_R

Syntax
public static final int VK_R


 KeyEvent.VK_RIGHT

KeyEvent.VK_RIGHT

Syntax
public static final int VK_RIGHT


 KeyEvent.VK_S

KeyEvent.VK_S

Syntax
public static final int VK_S


 KeyEvent.VK_SCROLL_LOCK

KeyEvent.VK_SCROLL_LOCK

Syntax
public static final int VK_SCROLL_LOCK


 KeyEvent.VK_SEMICOLON

KeyEvent.VK_SEMICOLON

Syntax
public static final int VK_SEMICOLON


 KeyEvent.VK_SEPARATER

KeyEvent.VK_SEPARATER

Syntax
public static final int VK_SEPARATER


 KeyEvent.VK_SHIFT

KeyEvent.VK_SHIFT

Syntax
public static final int VK_SHIFT


 KeyEvent.VK_SLASH

KeyEvent.VK_SLASH

Syntax
public static final int VK_SLASH


 KeyEvent.VK_SPACE

KeyEvent.VK_SPACE

Syntax
public static final int VK_SPACE


 KeyEvent.VK_SUBTRACT

KeyEvent.VK_SUBTRACT

Syntax
public static final int VK_SUBTRACT


 KeyEvent.VK_T

KeyEvent.VK_T

Syntax
public static final int VK_T


 KeyEvent.VK_TAB

KeyEvent.VK_TAB

Syntax
public static final int VK_TAB


 KeyEvent.VK_U

KeyEvent.VK_U

Syntax
public static final int VK_U


 KeyEvent.VK_UNDEFINED

KeyEvent.VK_UNDEFINED

Syntax
public static final int VK_UNDEFINED
Description
KEY_TYPED events do not have a defined keyCode.


 KeyEvent.VK_UP

KeyEvent.VK_UP

Syntax
public static final int VK_UP


 KeyEvent.VK_V

KeyEvent.VK_V

Syntax
public static final int VK_V


 KeyEvent.VK_W

KeyEvent.VK_W

Syntax
public static final int VK_W


 KeyEvent.VK_X

KeyEvent.VK_X

Syntax
public static final int VK_X


 KeyEvent.VK_Y

KeyEvent.VK_Y

Syntax
public static final int VK_Y


 KeyEvent.VK_Z

KeyEvent.VK_Z

Syntax
public static final int VK_Z


 KeyEvent.KeyEvent

KeyEvent.KeyEvent

Syntax 1
public KeyEvent( Component source, int id, long when, int modifiers, int keyCode, char keyChar )
Parameters
source
the object where the event originated
Description
Constructs a KeyEvent object with the specified source component, type, modifiers, and key.

Syntax 2
public KeyEvent( Component source, int id, long when, int modifiers, int keyCode )


 KeyEvent.getKeyChar

KeyEvent.getKeyChar

Syntax
public char getKeyChar()
Description
Returns the character associated with the key in this event. If no valid Unicode character exists for this key event, keyChar is CHAR_UNDEFINED.


 KeyEvent.getKeyCode

KeyEvent.getKeyCode

Syntax
public int getKeyCode()
Description
Returns the integer key-code associated with the key in this event. For KEY_TYPED events, keyCode is VK_UNDEFINED.


 KeyEvent.getKeyModifiersText

KeyEvent.getKeyModifiersText

Syntax
public static String getKeyModifiersText( int modifiers )
Description
Returns a String describing the modifier key(s), such as "Shift", or "Ctrl+Shift". These strings can be localized by changing the awt.properties file.


 KeyEvent.getKeyText

KeyEvent.getKeyText

Syntax
public static String getKeyText( int keyCode )
Description
Returns a String describing the keyCode, such as "HOME", "F1" or "A". These strings can be localized by changing the awt.properties file.


 KeyEvent.isActionKey

KeyEvent.isActionKey

Syntax
public boolean isActionKey()
Description
Returns whether or not the key in this event is an "action" key, as defined in Event.java.


 KeyEvent.paramString

KeyEvent.paramString

Syntax
public String paramString()
Overrides
paramString in class ComponentEvent


 KeyEvent.setKeyChar

KeyEvent.setKeyChar

Syntax
public void setKeyChar( char keyChar )


 KeyEvent.setKeyCode

KeyEvent.setKeyCode

Syntax
public void setKeyCode( int keyCode )


 KeyEvent.setModifiers

KeyEvent.setModifiers

Syntax
public void setModifiers( int modifiers )


 Interface KeyListener

Interface java.awt.event.KeyListener

Interface Members | This Package | All Packages

public interface KeyListener
extends EventListener

The listener interface for receiving keyboard events.


 KeyListener Members

KeyListener Members

Interface Overview | This Package | All Packages

Methods
Name | Description
keyPressed(KeyEvent) | Invoked when a key has been pressed.
keyReleased(KeyEvent) | Invoked when a key has been released.
keyTyped(KeyEvent) | Invoked when a key has been typed.


 KeyListener.keyPressed

KeyListener.keyPressed

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void keyPressed( KeyEvent e )
Description
Invoked when a key has been pressed.


 KeyListener.keyReleased

KeyListener.keyReleased

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void keyReleased( KeyEvent e )
Description
Invoked when a key has been released.


 KeyListener.keyTyped

KeyListener.keyTyped

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void keyTyped( KeyEvent e )
Description
Invoked when a key has been typed. This event occurs when a key press is followed by a key release.


 Class MouseAdapter

Class java.awt.event.MouseAdapter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.event.MouseAdapter

public abstract class MouseAdapter
extends Object
implements MouseListener

The adapter which receives mouse events. The methods in this class are empty; this class is provided as a convenience for easily creating listeners by extending this class and overriding only the methods of interest.


 MouseAdapter Members

MouseAdapter Members

Class Overview | This Package | All Packages

Constructors
Name | Description
MouseAdapter() |

Methods
Name | Description
mouseClicked(MouseEvent) |
mouseEntered(MouseEvent) |
mouseExited(MouseEvent) |
mousePressed(MouseEvent) |
mouseReleased(MouseEvent) |


 MouseAdapter.MouseAdapter

MouseAdapter.MouseAdapter

Syntax
public MouseAdapter()


 MouseAdapter.mouseClicked

MouseAdapter.mouseClicked

Syntax
public void mouseClicked( MouseEvent e )


 MouseAdapter.mouseEntered

MouseAdapter.mouseEntered

Syntax
public void mouseEntered( MouseEvent e )


 MouseAdapter.mouseExited

MouseAdapter.mouseExited

Syntax
public void mouseExited( MouseEvent e )


 MouseAdapter.mousePressed

MouseAdapter.mousePressed

Syntax
public void mousePressed( MouseEvent e )


 MouseAdapter.mouseReleased

MouseAdapter.mouseReleased

Syntax
public void mouseReleased( MouseEvent e )


 Class MouseEvent

Class java.awt.event.MouseEvent

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.EventObject
           |
           +----java.awt.AWTEvent
                   |
                   +----java.awt.event.ComponentEvent
                           |
                           +----java.awt.event.InputEvent
                                   |
                                   +----java.awt.event.MouseEvent

public class MouseEvent
extends InputEvent

The mouse event.


 MouseEvent Members

MouseEvent Members

Class Overview | This Package | All Packages

Fields
Name | Description
MOUSE_CLICKED | The mouse clicked event type.
MOUSE_DRAGGED | The mouse dragged event type.
MOUSE_ENTERED | The mouse entered event type.
MOUSE_EXITED | The mouse exited event type.
MOUSE_FIRST | Marks the first integer id for the range of mouse event ids.
MOUSE_LAST | Marks the last integer id for the range of mouse event ids.
MOUSE_MOVED | The mouse moved event type.
MOUSE_PRESSED | The mouse pressed event type.
MOUSE_RELEASED | The mouse released event type.

Constructors
Name | Description
MouseEvent(Component, int, long, int, int, int, int, boolean) | Constructs a MouseEvent object with the specified source component, type, modifiers, coordinates, and click count.

Methods
Name | Description
getClickCount() | Return the number of mouse clicks associated with this event.
getPoint() | Returns the x,y position of the event relative to the source component.
getX() | Returns the x position of the event relative to the source component.
getY() | Returns the y position of the event relative to the source component.
isPopupTrigger() | Returns whether or not this mouse event is the popup-menu trigger event for the platform.
paramString() |
translatePoint(int, int) | Translates the coordinate position of the event by x, y.


 MouseEvent.MOUSE_CLICKED

MouseEvent.MOUSE_CLICKED

Syntax
public static final int MOUSE_CLICKED
Description
The mouse clicked event type.


 MouseEvent.MOUSE_DRAGGED

MouseEvent.MOUSE_DRAGGED

Syntax
public static final int MOUSE_DRAGGED
Description
The mouse dragged event type.


 MouseEvent.MOUSE_ENTERED

MouseEvent.MOUSE_ENTERED

Syntax
public static final int MOUSE_ENTERED
Description
The mouse entered event type.


 MouseEvent.MOUSE_EXITED

MouseEvent.MOUSE_EXITED

Syntax
public static final int MOUSE_EXITED
Description
The mouse exited event type.


 MouseEvent.MOUSE_FIRST

MouseEvent.MOUSE_FIRST

Syntax
public static final int MOUSE_FIRST
Description
Marks the first integer id for the range of mouse event ids.


 MouseEvent.MOUSE_LAST

MouseEvent.MOUSE_LAST

Syntax
public static final int MOUSE_LAST
Description
Marks the last integer id for the range of mouse event ids.


 MouseEvent.MOUSE_MOVED

MouseEvent.MOUSE_MOVED

Syntax
public static final int MOUSE_MOVED
Description
The mouse moved event type.


 MouseEvent.MOUSE_PRESSED

MouseEvent.MOUSE_PRESSED

Syntax
public static final int MOUSE_PRESSED
Description
The mouse pressed event type.


 MouseEvent.MOUSE_RELEASED

MouseEvent.MOUSE_RELEASED

Syntax
public static final int MOUSE_RELEASED
Description
The mouse released event type.


 MouseEvent.MouseEvent

MouseEvent.MouseEvent

Syntax
public MouseEvent( Component source, int id, long when, int modifiers, int x, int y, int clickCount, boolean popupTrigger )
Parameters
source
the object where the event originated
Description
Constructs a MouseEvent object with the specified source component, type, modifiers, coordinates, and click count.


 MouseEvent.getClickCount

MouseEvent.getClickCount

Syntax
public int getClickCount()
Description
Return the number of mouse clicks associated with this event.


 MouseEvent.getPoint

MouseEvent.getPoint

Syntax
public Point getPoint()
Description
Returns the x,y position of the event relative to the source component.


 MouseEvent.getX

MouseEvent.getX

Syntax
public int getX()
Description
Returns the x position of the event relative to the source component.


 MouseEvent.getY

MouseEvent.getY

Syntax
public int getY()
Description
Returns the y position of the event relative to the source component.


 MouseEvent.isPopupTrigger

MouseEvent.isPopupTrigger

Syntax
public boolean isPopupTrigger()
Description
Returns whether or not this mouse event is the popup-menu trigger event for the platform.


 MouseEvent.paramString

MouseEvent.paramString

Syntax
public String paramString()
Overrides
paramString in class ComponentEvent


 MouseEvent.translatePoint

MouseEvent.translatePoint

Syntax
public synchronized void translatePoint( int x, int y )
Parameters
x
the x value added to the current x coordinate position
y
the y value added to the current y coordinate position
Description
Translates the coordinate position of the event by x, y.


 Interface MouseListener

Interface java.awt.event.MouseListener

Interface Members | This Package | All Packages

public interface MouseListener
extends EventListener

The listener interface for receiving mouse events on a component.


 MouseListener Members

MouseListener Members

Interface Overview | This Package | All Packages

Methods
Name | Description
mouseClicked(MouseEvent) | Invoked when the mouse has been clicked on a component.
mouseEntered(MouseEvent) | Invoked when the mouse enters a component.
mouseExited(MouseEvent) | Invoked when the mouse exits a component.
mousePressed(MouseEvent) | Invoked when a mouse button has been pressed on a component.
mouseReleased(MouseEvent) | Invoked when a mouse button has been released on a component.


 MouseListener.mouseClicked

MouseListener.mouseClicked

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void mouseClicked( MouseEvent e )
Description
Invoked when the mouse has been clicked on a component.


 MouseListener.mouseEntered

MouseListener.mouseEntered

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void mouseEntered( MouseEvent e )
Description
Invoked when the mouse enters a component.


 MouseListener.mouseExited

MouseListener.mouseExited

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void mouseExited( MouseEvent e )
Description
Invoked when the mouse exits a component.


 MouseListener.mousePressed

MouseListener.mousePressed

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void mousePressed( MouseEvent e )
Description
Invoked when a mouse button has been pressed on a component.


 MouseListener.mouseReleased

MouseListener.mouseReleased

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void mouseReleased( MouseEvent e )
Description
Invoked when a mouse button has been released on a component.


 Class MouseMotionAdapter

Class java.awt.event.MouseMotionAdapter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.event.MouseMotionAdapter

public abstract class MouseMotionAdapter
extends Object
implements MouseMotionListener

The adapter which receives mouse motion events. The methods in this class are empty; this class is provided as a convenience for easily creating listeners by extending this class and overriding only the methods of interest.


 MouseMotionAdapter Members

MouseMotionAdapter Members

Class Overview | This Package | All Packages

Constructors
Name | Description
MouseMotionAdapter() |

Methods
Name | Description
mouseDragged(MouseEvent) |
mouseMoved(MouseEvent) |


 MouseMotionAdapter.MouseMotionAdapter

MouseMotionAdapter.MouseMotionAdapter

Syntax
public MouseMotionAdapter()


 MouseMotionAdapter.mouseDragged

MouseMotionAdapter.mouseDragged

Syntax
public void mouseDragged( MouseEvent e )


 MouseMotionAdapter.mouseMoved

MouseMotionAdapter.mouseMoved

Syntax
public void mouseMoved( MouseEvent e )


 Interface MouseMotionListener

Interface java.awt.event.MouseMotionListener

Interface Members | This Package | All Packages

public interface MouseMotionListener
extends EventListener

The listener interface for receiving mouse motion events on a component.


 MouseMotionListener Members

MouseMotionListener Members

Interface Overview | This Package | All Packages

Methods
Name | Description
mouseDragged(MouseEvent) | Invoked when a mouse button is pressed on a component and then dragged.
mouseMoved(MouseEvent) | Invoked when the mouse button has been moved on a component (with no buttons no down).


 MouseMotionListener.mouseDragged

MouseMotionListener.mouseDragged

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void mouseDragged( MouseEvent e )
Description
Invoked when a mouse button is pressed on a component and then dragged. Mouse drag events will continue to be delivered to the component where the first originated until the mouse button is released (regardless of whether the mouse position is within the bounds of the component).


 MouseMotionListener.mouseMoved

MouseMotionListener.mouseMoved

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void mouseMoved( MouseEvent e )
Description
Invoked when the mouse button has been moved on a component (with no buttons no down).


 Class PaintEvent

Class java.awt.event.PaintEvent

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.EventObject
           |
           +----java.awt.AWTEvent
                   |
                   +----java.awt.event.ComponentEvent
                           |
                           +----java.awt.event.PaintEvent

public class PaintEvent
extends ComponentEvent

The component-level paint event. This event is a special type which is used to ensure that paint/update method calls are serialized along with the other events delivered from the event queue. This event is not designed to be used with the Event Listener model; programs should continue to override paint/update methods in order render themselves properly.


 PaintEvent Members

PaintEvent Members

Class Overview | This Package | All Packages

Fields
Name | Description
PAINT | The paint event type.
PAINT_FIRST | Marks the first integer id for the range of paint event ids.
PAINT_LAST | Marks the last integer id for the range of paint event ids.
UPDATE | The update event type.

Constructors
Name | Description
PaintEvent(Component, int, Rectangle) | Constructs a PaintEvent object with the specified source component and type.

Methods
Name | Description
getUpdateRect() | Returns the rectangle representing the area which needs to be repainted in response to this event.
paramString() |
setUpdateRect(Rectangle) | Sets the rectangle representing the area which needs to be repainted in response to this event.


 PaintEvent.PAINT

PaintEvent.PAINT

Syntax
public static final int PAINT
Description
The paint event type.


 PaintEvent.PAINT_FIRST

PaintEvent.PAINT_FIRST

Syntax
public static final int PAINT_FIRST
Description
Marks the first integer id for the range of paint event ids.


 PaintEvent.PAINT_LAST

PaintEvent.PAINT_LAST

Syntax
public static final int PAINT_LAST
Description
Marks the last integer id for the range of paint event ids.


 PaintEvent.UPDATE

PaintEvent.UPDATE

Syntax
public static final int UPDATE
Description
The update event type.


 PaintEvent.PaintEvent

PaintEvent.PaintEvent

Syntax
public PaintEvent( Component source, int id, Rectangle updateRect )
Parameters
source
the object where the event originated
Description
Constructs a PaintEvent object with the specified source component and type.


 PaintEvent.getUpdateRect

PaintEvent.getUpdateRect

Syntax
public Rectangle getUpdateRect()
Description
Returns the rectangle representing the area which needs to be repainted in response to this event.


 PaintEvent.paramString

PaintEvent.paramString

Syntax
public String paramString()
Overrides
paramString in class ComponentEvent


 PaintEvent.setUpdateRect

PaintEvent.setUpdateRect

Syntax
public void setUpdateRect( Rectangle updateRect )
Parameters
updateRect
the rectangle area which needs to be repainted
Description
Sets the rectangle representing the area which needs to be repainted in response to this event.


 Class TextEvent

Class java.awt.event.TextEvent

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.EventObject
           |
           +----java.awt.AWTEvent
                   |
                   +----java.awt.event.TextEvent

public class TextEvent
extends AWTEvent

The text event emitted by TextComponents.

See Also:
TextComponent, TextEventListener


 TextEvent Members

TextEvent Members

Class Overview | This Package | All Packages

Fields
Name | Description
TEXT_FIRST | Marks the first integer id for the range of adjustment event ids.
TEXT_LAST | Marks the last integer id for the range of adjustment event ids.
TEXT_VALUE_CHANGED | The adjustment value changed event.

Constructors
Name | Description
TextEvent(Object, int) | Constructs a TextEvent object with the specified TextComponent source, and type.

Methods
Name | Description
paramString() |


 TextEvent.TEXT_FIRST

TextEvent.TEXT_FIRST

Syntax
public static final int TEXT_FIRST
Description
Marks the first integer id for the range of adjustment event ids.


 TextEvent.TEXT_LAST

TextEvent.TEXT_LAST

Syntax
public static final int TEXT_LAST
Description
Marks the last integer id for the range of adjustment event ids.


 TextEvent.TEXT_VALUE_CHANGED

TextEvent.TEXT_VALUE_CHANGED

Syntax
public static final int TEXT_VALUE_CHANGED
Description
The adjustment value changed event.


 TextEvent.TextEvent

TextEvent.TextEvent

Syntax
public TextEvent( Object source, int id )
Parameters
source
the TextComponent where the event originated
Description
Constructs a TextEvent object with the specified TextComponent source, and type.


 TextEvent.paramString

TextEvent.paramString

Syntax
public String paramString()
Overrides
paramString in class AWTEvent


 Interface TextListener

Interface java.awt.event.TextListener

Interface Members | This Package | All Packages

public interface TextListener
extends EventListener

The listener interface for receiving adjustment events.


 TextListener Members

TextListener Members

Interface Overview | This Package | All Packages

Methods
Name | Description
textValueChanged(TextEvent) | Invoked when the value of the text has changed.


 TextListener.textValueChanged

TextListener.textValueChanged

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void textValueChanged( TextEvent e )
Description
Invoked when the value of the text has changed.


 Class WindowAdapter

Class java.awt.event.WindowAdapter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.event.WindowAdapter

public abstract class WindowAdapter
extends Object
implements WindowListener

The adapter which receives window events. The methods in this class are empty; this class is provided as a convenience for easily creating listeners by extending this class and overriding only the methods of interest.


 WindowAdapter Members

WindowAdapter Members

Class Overview | This Package | All Packages

Constructors
Name | Description
WindowAdapter() |

Methods
Name | Description
windowActivated(WindowEvent) |
windowClosed(WindowEvent) |
windowClosing(WindowEvent) |
windowDeactivated(WindowEvent) |
windowDeiconified(WindowEvent) |
windowIconified(WindowEvent) |
windowOpened(WindowEvent) |


 WindowAdapter.WindowAdapter

WindowAdapter.WindowAdapter

Syntax
public WindowAdapter()


 WindowAdapter.windowActivated

WindowAdapter.windowActivated

Syntax
public void windowActivated( WindowEvent e )


 WindowAdapter.windowClosed

WindowAdapter.windowClosed

Syntax
public void windowClosed( WindowEvent e )


 WindowAdapter.windowClosing

WindowAdapter.windowClosing

Syntax
public void windowClosing( WindowEvent e )


 WindowAdapter.windowDeactivated

WindowAdapter.windowDeactivated

Syntax
public void windowDeactivated( WindowEvent e )


 WindowAdapter.windowDeiconified

WindowAdapter.windowDeiconified

Syntax
public void windowDeiconified( WindowEvent e )


 WindowAdapter.windowIconified

WindowAdapter.windowIconified

Syntax
public void windowIconified( WindowEvent e )


 WindowAdapter.windowOpened

WindowAdapter.windowOpened

Syntax
public void windowOpened( WindowEvent e )


 Class WindowEvent

Class java.awt.event.WindowEvent

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.EventObject
           |
           +----java.awt.AWTEvent
                   |
                   +----java.awt.event.ComponentEvent
                           |
                           +----java.awt.event.WindowEvent

public class WindowEvent
extends ComponentEvent

The window-level event.


 WindowEvent Members

WindowEvent Members

Class Overview | This Package | All Packages

Fields
Name | Description
WINDOW_ACTIVATED | The window activated event type.
WINDOW_CLOSED | The window closed event type.
WINDOW_CLOSING | The window closing event type.
WINDOW_DEACTIVATED | The window deactivated event type.
WINDOW_DEICONIFIED | The window deiconified event type.
WINDOW_FIRST | Marks the first integer id for the range of window event ids.
WINDOW_ICONIFIED | The window iconified event type.
WINDOW_LAST | Marks the last integer id for the range of window event ids.
WINDOW_OPENED | The window opened event type.

Constructors
Name | Description
WindowEvent(Window, int) | Constructs a WindowEvent object with the specified source window and type.

Methods
Name | Description
getWindow() | Returns the window where this event originated.
paramString() |


 WindowEvent.WINDOW_ACTIVATED

WindowEvent.WINDOW_ACTIVATED

Syntax
public static final int WINDOW_ACTIVATED
Description
The window activated event type.


 WindowEvent.WINDOW_CLOSED

WindowEvent.WINDOW_CLOSED

Syntax
public static final int WINDOW_CLOSED
Description
The window closed event type. This event is delivered after the window has been closed as the result of a call to hide or destroy.


 WindowEvent.WINDOW_CLOSING

WindowEvent.WINDOW_CLOSING

Syntax
public static final int WINDOW_CLOSING
Description
The window closing event type. This event is delivered when the user selects "Quit" from the window's system menu. If the program does not explicitly hide or destroy the window as a result of this event, the window close operation will be cancelled.


 WindowEvent.WINDOW_DEACTIVATED

WindowEvent.WINDOW_DEACTIVATED

Syntax
public static final int WINDOW_DEACTIVATED
Description
The window deactivated event type.


 WindowEvent.WINDOW_DEICONIFIED

WindowEvent.WINDOW_DEICONIFIED

Syntax
public static final int WINDOW_DEICONIFIED
Description
The window deiconified event type.


 WindowEvent.WINDOW_FIRST

WindowEvent.WINDOW_FIRST

Syntax
public static final int WINDOW_FIRST
Description
Marks the first integer id for the range of window event ids.


 WindowEvent.WINDOW_ICONIFIED

WindowEvent.WINDOW_ICONIFIED

Syntax
public static final int WINDOW_ICONIFIED
Description
The window iconified event type.


 WindowEvent.WINDOW_LAST

WindowEvent.WINDOW_LAST

Syntax
public static final int WINDOW_LAST
Description
Marks the last integer id for the range of window event ids.


 WindowEvent.WINDOW_OPENED

WindowEvent.WINDOW_OPENED

Syntax
public static final int WINDOW_OPENED
Description
The window opened event type. This event is delivered only the first time a window is made visible.


 WindowEvent.WindowEvent

WindowEvent.WindowEvent

Syntax
public WindowEvent( Window source, int id )
Parameters
source
the component where the event originated
Description
Constructs a WindowEvent object with the specified source window and type.


 WindowEvent.getWindow

WindowEvent.getWindow

Syntax
public Window getWindow()
Description
Returns the window where this event originated.


 WindowEvent.paramString

WindowEvent.paramString

Syntax
public String paramString()
Overrides
paramString in class ComponentEvent


 Interface WindowListener

Interface java.awt.event.WindowListener

Interface Members | This Package | All Packages

public interface WindowListener
extends EventListener

The listener interface for receiving window events.


 WindowListener Members

WindowListener Members

Interface Overview | This Package | All Packages

Methods
Name | Description
windowActivated(WindowEvent) | Invoked when a window is activated.
windowClosed(WindowEvent) | Invoked when a window has been closed.
windowClosing(WindowEvent) | Invoked when a window is in the process of being closed.
windowDeactivated(WindowEvent) | Invoked when a window is de-activated.
windowDeiconified(WindowEvent) | Invoked when a window is de-iconified.
windowIconified(WindowEvent) | Invoked when a window is iconified.
windowOpened(WindowEvent) | Invoked when a window has been opened.


 WindowListener.windowActivated

WindowListener.windowActivated

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void windowActivated( WindowEvent e )
Description
Invoked when a window is activated.


 WindowListener.windowClosed

WindowListener.windowClosed

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void windowClosed( WindowEvent e )
Description
Invoked when a window has been closed.


 WindowListener.windowClosing

WindowListener.windowClosing

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void windowClosing( WindowEvent e )
Description
Invoked when a window is in the process of being closed. The close operation can be overridden at this point.


 WindowListener.windowDeactivated

WindowListener.windowDeactivated

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void windowDeactivated( WindowEvent e )
Description
Invoked when a window is de-activated.


 WindowListener.windowDeiconified

WindowListener.windowDeiconified

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void windowDeiconified( WindowEvent e )
Description
Invoked when a window is de-iconified.


 WindowListener.windowIconified

WindowListener.windowIconified

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void windowIconified( WindowEvent e )
Description
Invoked when a window is iconified.


 WindowListener.windowOpened

WindowListener.windowOpened

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void windowOpened( WindowEvent e )
Description
Invoked when a window has been opened.


 Package java.awt.image

Package java.awt.image

All Packages

Interfaces

  • ImageConsumer
  • ImageObserver
  • ImageProducer

    • Classes

  • AreaAveragingScaleFilter
  • ColorModel
  • CropImageFilter
  • DirectColorModel
  • FilteredImageSource
  • ImageFilter
  • IndexColorModel
  • MemoryImageSource
  • PixelGrabber
  • RGBImageFilter
  • ReplicateScaleFilter


 Class AreaAveragingScaleFilter

Class java.awt.image.AreaAveragingScaleFilter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.image.ImageFilter
           |
           +----java.awt.image.ReplicateScaleFilter
                   |
                   +----java.awt.image.AreaAveragingScaleFilter

public class AreaAveragingScaleFilter
extends ReplicateScaleFilter

An ImageFilter class for scaling images using a simple area averaging algorithm that produces smoother results than the nearest neighbor algorithm. This class extends the basic ImageFilter Class to scale an existing image and provide a source for a new image containing the resampled image. The pixels in the source image are blended to produce pixels for an image of the specified size. The blending process is analogous to scaling up the source image to a multiple of the destination size using pixel replication and then scaling it back down to the destination size by simply averaging all the pixels in the supersized image that fall within a given pixel of the destination image. If the data from the source is not delivered in TopDownLeftRight order then the filter will back off to a simple pixel replication behavior and utilize the requestTopDownLeftRightResend() method to refilter the pixels in a better way at the end. It is meant to be used in conjunction with a FilteredImageSource object to produce scaled versions of existing images.

See Also:
FilteredImageSource, ReplicateImageFilter, ImageFilter


 AreaAveragingScaleFilter Members

AreaAveragingScaleFilter Members

Class Overview | This Package | All Packages

Constructors
Name | Description
AreaAveragingScaleFilter(int, int) | Constructs an AreaAveragingScaleFilter that scales the pixels from its source Image as specified by the width and height parameters.

Methods
Name | Description
setHints(int) | Detect if the data is being delivered with the necessary hints to allow the averaging algorithm to do its work.
setPixels(int, int, int, int, ColorModel, byte[], int, int) | Combine the components for the delivered byte pixels into the accumulation arrays and send on any averaged data for rows of pixels that are complete.
setPixels(int, int, int, int, ColorModel, int[], int, int) | Combine the components for the delivered int pixels into the accumulation arrays and send on any averaged data for rows of pixels that are complete.


 AreaAveragingScaleFilter.AreaAveragingScaleFilter

AreaAveragingScaleFilter.AreaAveragingScaleFilter

Syntax
public AreaAveragingScaleFilter( int width, int height )
Parameters
width
the target width to scale the image
height
the target height to scale the image
Description
Constructs an AreaAveragingScaleFilter that scales the pixels from its source Image as specified by the width and height parameters.


 AreaAveragingScaleFilter.setHints

AreaAveragingScaleFilter.setHints

Syntax
public void setHints( int hints )
Description
Detect if the data is being delivered with the necessary hints to allow the averaging algorithm to do its work.

Overrides
setHints in class ImageFilter
See Also
setHints


 AreaAveragingScaleFilter.setPixels

AreaAveragingScaleFilter.setPixels

Syntax 1
public void setPixels( int x, int y, int w, int h, ColorModel model, byte pixels[], int off, int scansize )
Description
Combine the components for the delivered byte pixels into the accumulation arrays and send on any averaged data for rows of pixels that are complete. If the correct hints were not specified in the setHints call then relay the work to our superclass which is capable of scaling pixels regardless of the delivery hints.

Overrides
setPixels in class ReplicateScaleFilter
See Also
ReplicateScaleFilter

Syntax 2
public void setPixels( int x, int y, int w, int h, ColorModel model, int pixels[], int off, int scansize )
Description
Combine the components for the delivered int pixels into the accumulation arrays and send on any averaged data for rows of pixels that are complete. If the correct hints were not specified in the setHints call then relay the work to our superclass which is capable of scaling pixels regardless of the delivery hints.

Overrides
setPixels in class ReplicateScaleFilter
See Also
ReplicateScaleFilter


 Class ColorModel

Class java.awt.image.ColorModel

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.image.ColorModel

public abstract class ColorModel
extends Object

A class that encapsulates the methods for translating from pixel values to alpha, red, green, and blue color components for an image. This class is abstract.

See Also:
IndexColorModel, DirectColorModel


 ColorModel Members

ColorModel Members

Class Overview | This Package | All Packages

Fields
Name | Description
pixel_bits |

Constructors
Name | Description
ColorModel(int) | Constructs a ColorModel which describes a pixel of the specified number of bits.

Methods
Name | Description
finalize() | Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
getAlpha(int) | The subclass must provide a function which provides the alpha color compoment for the specified pixel.
getBlue(int) | The subclass must provide a function which provides the blue color compoment for the specified pixel.
getGreen(int) | The subclass must provide a function which provides the green color compoment for the specified pixel.
getPixelSize() | Returns the number of bits per pixel described by this ColorModel.
getRed(int) | The subclass must provide a function which provides the red color compoment for the specified pixel.
getRGB(int) | Returns the color of the pixel in the default RGB color model.
getRGBdefault() | Return a ColorModel which describes the default format for integer RGB values used throughout the AWT image interfaces.


 ColorModel.pixel_bits

ColorModel.pixel_bits

Syntax
protected int pixel_bits


 ColorModel.ColorModel

ColorModel.ColorModel

Syntax
public ColorModel( int bits )
Description
Constructs a ColorModel which describes a pixel of the specified number of bits.


 ColorModel.finalize

ColorModel.finalize

Syntax
public void finalize()
Description
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

Overrides
finalize in class Object


 ColorModel.getAlpha

ColorModel.getAlpha

Syntax
public abstract int getAlpha( int pixel )
Returns
The alpha transparency value ranging from 0 to 255
Description
The subclass must provide a function which provides the alpha color compoment for the specified pixel.


 ColorModel.getBlue

ColorModel.getBlue

Syntax
public abstract int getBlue( int pixel )
Returns
The blue color component ranging from 0 to 255
Description
The subclass must provide a function which provides the blue color compoment for the specified pixel.


 ColorModel.getGreen

ColorModel.getGreen

Syntax
public abstract int getGreen( int pixel )
Returns
The green color component ranging from 0 to 255
Description
The subclass must provide a function which provides the green color compoment for the specified pixel.


 ColorModel.getPixelSize

ColorModel.getPixelSize

Syntax
public int getPixelSize()
Description
Returns the number of bits per pixel described by this ColorModel.


 ColorModel.getRed

ColorModel.getRed

Syntax
public abstract int getRed( int pixel )
Returns
The red color component ranging from 0 to 255
Description
The subclass must provide a function which provides the red color compoment for the specified pixel.


 ColorModel.getRGB

ColorModel.getRGB

Syntax
public int getRGB( int pixel )
Description
Returns the color of the pixel in the default RGB color model.

See Also
getRGBdefault


 ColorModel.getRGBdefault

ColorModel.getRGBdefault

Syntax
public static ColorModel getRGBdefault()
Description
Return a ColorModel which describes the default format for integer RGB values used throughout the AWT image interfaces. The format for the RGB values is an integer with 8 bits each of alpha, red, green, and blue color components ordered correspondingly from the most significant byte to the least significant byte, as in: 0xAARRGGBB


 Class CropImageFilter

Class java.awt.image.CropImageFilter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.image.ImageFilter
           |
           +----java.awt.image.CropImageFilter

public class CropImageFilter
extends ImageFilter

An ImageFilter class for cropping images. This class extends the basic ImageFilter Class to extract a given rectangular region of an existing Image and provide a source for a new image containing just the extracted region. It is meant to be used in conjunction with a FilteredImageSource object to produce cropped versions of existing images.

See Also:
FilteredImageSource, ImageFilter


 CropImageFilter Members

CropImageFilter Members

Class Overview | This Package | All Packages

Constructors
Name | Description
CropImageFilter(int, int, int, int) | Constructs a CropImageFilter that extracts the absolute rectangular region of pixels from its source Image as specified by the x, y, w, and h parameters.

Methods
Name | Description
setDimensions(int, int) | Override the source image's dimensions and pass the dimensions of the rectangular cropped region to the ImageConsumer.
setPixels(int, int, int, int, ColorModel, byte[], int, int) | Determine whether the delivered byte pixels intersect the region to be extracted and passes through only that subset of pixels that appear in the output region.
setPixels(int, int, int, int, ColorModel, int[], int, int) | Determine if the delivered int pixels intersect the region to be extracted and pass through only that subset of pixels that appear in the output region.
setProperties(Hashtable) | Passes along the properties from the source object after adding a property indicating the cropped region.


 CropImageFilter.CropImageFilter

CropImageFilter.CropImageFilter

Syntax
public CropImageFilter( int x, int y, int w, int h )
Parameters
x
the x location of the top of the rectangle to be extracted
y
the y location of the top of the rectangle to be extracted
w
the width of the rectangle to be extracted
h
the height of the rectangle to be extracted
Description
Constructs a CropImageFilter that extracts the absolute rectangular region of pixels from its source Image as specified by the x, y, w, and h parameters.


 CropImageFilter.setDimensions

CropImageFilter.setDimensions

Syntax
public void setDimensions( int w, int h )
Description
Override the source image's dimensions and pass the dimensions of the rectangular cropped region to the ImageConsumer.

Overrides
setDimensions in class ImageFilter
See Also
ImageConsumer


 CropImageFilter.setPixels

CropImageFilter.setPixels

Syntax 1
public void setPixels( int x, int y, int w, int h, ColorModel model, byte pixels[], int off, int scansize )
Description
Determine whether the delivered byte pixels intersect the region to be extracted and passes through only that subset of pixels that appear in the output region.

Overrides
setPixels in class ImageFilter

Syntax 2
public void setPixels( int x, int y, int w, int h, ColorModel model, int pixels[], int off, int scansize )
Description
Determine if the delivered int pixels intersect the region to be extracted and pass through only that subset of pixels that appear in the output region.

Overrides
setPixels in class ImageFilter


 CropImageFilter.setProperties

CropImageFilter.setProperties

Syntax
public void setProperties( Hashtable props )
Description
Passes along the properties from the source object after adding a property indicating the cropped region.

Overrides
setProperties in class ImageFilter


 Class DirectColorModel

Class java.awt.image.DirectColorModel

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.image.ColorModel
           |
           +----java.awt.image.DirectColorModel

public class DirectColorModel
extends ColorModel

A ColorModel class that specifies a translation from pixel values to alpha, red, green, and blue color components for pixels which have the color components embedded directly in the bits of the pixel itself. This color model is similar to an X11 TrueColor visual.

Many of the methods in this class are final. This is because the underlying native graphics code makes assumptions about the layout and operation of this class and those assumptions are reflected in the implementations of the methods here that are marked final. You can subclass this class for other reaons, but you cannot override or modify the behaviour of those methods.

See Also:
ColorModel


 DirectColorModel Members

DirectColorModel Members

Class Overview | This Package | All Packages

Constructors
Name | Description
DirectColorModel(int, int, int, int) | Constructs a DirectColorModel from the given masks specifying which bits in the pixel contain the red, green and blue color components.
DirectColorModel(int, int, int, int, int) | Constructs a DirectColorModel from the given masks specifying which bits in the pixel contain the alhpa, red, green and blue color components.

Methods
Name | Description
getAlpha(int) | Return the alpha transparency value for the specified pixel in the range 0-255.
getAlphaMask() | Returns the mask indicating which bits in a pixel contain the alpha transparency component.
getBlue(int) | Returns the blue color compoment for the specified pixel in the range 0-255.
getBlueMask() | Returns the mask indicating which bits in a pixel contain the blue color component.
getGreen(int) | Returns the green color compoment for the specified pixel in the range 0-255.
getGreenMask() | Returns the mask indicating which bits in a pixel contain the green color component.
getRed(int) | Returns the red color compoment for the specified pixel in the range 0-255.
getRedMask() | Returns the mask indicating which bits in a pixel contain the red color component.
getRGB(int) | Returns the color of the pixel in the default RGB color model.


 DirectColorModel.DirectColorModel

DirectColorModel.DirectColorModel

Syntax 1
public DirectColorModel( int bits, int rmask, int gmask, int bmask )
Description
Constructs a DirectColorModel from the given masks specifying which bits in the pixel contain the red, green and blue color components. Pixels described by this color model will all have alpha components of 255 (fully opaque). All of the bits in each mask must be contiguous and fit in the specified number of least significant bits of the integer.

Syntax 2
public DirectColorModel( int bits, int rmask, int gmask, int bmask, int amask )
Description
Constructs a DirectColorModel from the given masks specifying which bits in the pixel contain the alhpa, red, green and blue color components. All of the bits in each mask must be contiguous and fit in the specified number of least significant bits of the integer.


 DirectColorModel.getAlpha

DirectColorModel.getAlpha

Syntax
public final int getAlpha( int pixel )
Description
Return the alpha transparency value for the specified pixel in the range 0-255.

Overrides
getAlpha in class ColorModel


 DirectColorModel.getAlphaMask

DirectColorModel.getAlphaMask

Syntax
public final int getAlphaMask()
Description
Returns the mask indicating which bits in a pixel contain the alpha transparency component.


 DirectColorModel.getBlue

DirectColorModel.getBlue

Syntax
public final int getBlue( int pixel )
Description
Returns the blue color compoment for the specified pixel in the range 0-255.

Overrides
getBlue in class ColorModel


 DirectColorModel.getBlueMask

DirectColorModel.getBlueMask

Syntax
public final int getBlueMask()
Description
Returns the mask indicating which bits in a pixel contain the blue color component.


 DirectColorModel.getGreen

DirectColorModel.getGreen

Syntax
public final int getGreen( int pixel )
Description
Returns the green color compoment for the specified pixel in the range 0-255.

Overrides
getGreen in class ColorModel


 DirectColorModel.getGreenMask

DirectColorModel.getGreenMask

Syntax
public final int getGreenMask()
Description
Returns the mask indicating which bits in a pixel contain the green color component.


 DirectColorModel.getRed

DirectColorModel.getRed

Syntax
public final int getRed( int pixel )
Description
Returns the red color compoment for the specified pixel in the range 0-255.

Overrides
getRed in class ColorModel


 DirectColorModel.getRedMask

DirectColorModel.getRedMask

Syntax
public final int getRedMask()
Description
Returns the mask indicating which bits in a pixel contain the red color component.


 DirectColorModel.getRGB

DirectColorModel.getRGB

Syntax
public final int getRGB( int pixel )
Description
Returns the color of the pixel in the default RGB color model.

Overrides
getRGB in class ColorModel
See Also
getRGBdefault


 Class FilteredImageSource

Class java.awt.image.FilteredImageSource

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.image.FilteredImageSource

public class FilteredImageSource
extends Object
implements ImageProducer

This class is an implementation of the ImageProducer interface which takes an existing image and a filter object and uses them to produce image data for a new filtered version of the original image. Here is an example which filters an image by swapping the red and blue compents:

    Image src = getImage("doc:///demo/images/duke/T1.gif");
    ImageFilter colorfilter = new RedBlueSwapFilter();
    Image img = createImage(new FilteredImageSource(src.getSource(),
                            colorfilter));

See Also:
ImageProducer


 FilteredImageSource Members

FilteredImageSource Members

Class Overview | This Package | All Packages

Constructors
Name | Description
FilteredImageSource(ImageProducer, ImageFilter) | Constructs an ImageProducer object from an existing ImageProducer and a filter object.

Methods
Name | Description
addConsumer(ImageConsumer) | Adds an ImageConsumer to the list of consumers interested in data for this image.
isConsumer(ImageConsumer) | Determines whether an ImageConsumer is on the list of consumers currently interested in data for this image.
removeConsumer(ImageConsumer) | Removes an ImageConsumer from the list of consumers interested in data for this image.
requestTopDownLeftRightResend(ImageConsumer) | Requests that a given ImageConsumer have the image data delivered one more time in top-down, left-right order.
startProduction(ImageConsumer) | Adds an ImageConsumer to the list of consumers interested in data for this image, and immediately starts delivery of the image data through the ImageConsumer interface.


 FilteredImageSource.FilteredImageSource

FilteredImageSource.FilteredImageSource

Syntax
public FilteredImageSource( ImageProducer orig, ImageFilter imgf )
Description
Constructs an ImageProducer object from an existing ImageProducer and a filter object.

See Also
ImageFilter, createImage


 FilteredImageSource.addConsumer

FilteredImageSource.addConsumer

Syntax
public synchronized void addConsumer( ImageConsumer ic )
Description
Adds an ImageConsumer to the list of consumers interested in data for this image.

See Also
ImageConsumer


 FilteredImageSource.isConsumer

FilteredImageSource.isConsumer

Syntax
public synchronized boolean isConsumer( ImageConsumer ic )
Returns
true if the ImageConsumer is on the list; false otherwise
Description
Determines whether an ImageConsumer is on the list of consumers currently interested in data for this image.

See Also
ImageConsumer


 FilteredImageSource.removeConsumer

FilteredImageSource.removeConsumer

Syntax
public synchronized void removeConsumer( ImageConsumer ic )
Description
Removes an ImageConsumer from the list of consumers interested in data for this image.

See Also
ImageConsumer


 FilteredImageSource.requestTopDownLeftRightResend

FilteredImageSource.requestTopDownLeftRightResend

Syntax
public void requestTopDownLeftRightResend( ImageConsumer ic )
Description
Requests that a given ImageConsumer have the image data delivered one more time in top-down, left-right order. The request is handed to the ImageFilter for further processing, since the ability to preserve the pixel ordering depends on the filter.

See Also
ImageConsumer


 FilteredImageSource.startProduction

FilteredImageSource.startProduction

Syntax
public void startProduction( ImageConsumer ic )
Description
Adds an ImageConsumer to the list of consumers interested in data for this image, and immediately starts delivery of the image data through the ImageConsumer interface.

See Also
ImageConsumer


 Interface ImageConsumer

Interface java.awt.image.ImageConsumer

Interface Members | This Package | All Packages

public interface ImageConsumer

The interface for objects expressing interest in image data through the ImageProducer interfaces. When a consumer is added to an image producer, the producer delivers all of the data about the image using the method calls defined in this interface.

See Also:
ImageProducer


 ImageConsumer Members

ImageConsumer Members

Interface Overview | This Package | All Packages

Fields
Name | Description
COMPLETESCANLINES | The pixels will be delivered in (multiples of) complete scanlines at a time.
IMAGEABORTED | The image creation process was deliberately aborted.
IMAGEERROR | An error was encountered while producing the image.
RANDOMPIXELORDER | The pixels will be delivered in a random order.
SINGLEFRAME | The image contain a single static image.
SINGLEFRAMEDONE | One frame of the image is complete but there are more frames to be delivered.
SINGLEPASS | The pixels will be delivered in a single pass.
STATICIMAGEDONE | The image is complete and there are no more pixels or frames to be delivered.
TOPDOWNLEFTRIGHT | The pixels will be delivered in top-down, left-to-right order.

Methods
Name | Description
imageComplete(int) | The imageComplete method is called when the ImageProducer is finished delivering all of the pixels that the source image contains, or when a single frame of a multi-frame animation has been completed, or when an error in loading or producing the image has occured.
setColorModel(ColorModel) | The ColorModel object used for the majority of the pixels reported using the setPixels method calls.
setDimensions(int, int) | The dimensions of the source image are reported using the setDimensions method call.
setHints(int) | The ImageProducer can deliver the pixels in any order, but the ImageConsumer may be able to scale or convert the pixels to the destination ColorModel more efficiently or with higher quality if it knows some information about how the pixels will be delivered up front.
setPixels(int, int, int, int, ColorModel, byte[], int, int) | The pixels of the image are delivered using one or more calls to the setPixels method.
setPixels(int, int, int, int, ColorModel, int[], int, int) | The pixels of the image are delivered using one or more calls to the setPixels method.
setProperties(Hashtable) | Sets the extensible list of properties associated with this image.


 ImageConsumer.COMPLETESCANLINES

ImageConsumer.COMPLETESCANLINES

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int COMPLETESCANLINES
Description
The pixels will be delivered in (multiples of) complete scanlines at a time.

See Also
setHints


 ImageConsumer.IMAGEABORTED

ImageConsumer.IMAGEABORTED

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int IMAGEABORTED
Description
The image creation process was deliberately aborted.

See Also
imageComplete


 ImageConsumer.IMAGEERROR

ImageConsumer.IMAGEERROR

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int IMAGEERROR
Description
An error was encountered while producing the image.

See Also
imageComplete


 ImageConsumer.RANDOMPIXELORDER

ImageConsumer.RANDOMPIXELORDER

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int RANDOMPIXELORDER
Description
The pixels will be delivered in a random order. This tells the ImageConsumer not to use any optimizations that depend on the order of pixel delivery, which should be the default assumption in the absence of any call to the setHints method.

See Also
setHints


 ImageConsumer.SINGLEFRAME

ImageConsumer.SINGLEFRAME

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int SINGLEFRAME
Description
The image contain a single static image. The pixels will be defined in calls to the setPixels methods and then the imageComplete method will be called with the STATICIMAGEDONE flag after which no more image data will be delivered. An example of an image type which would not meet these criteria would be the output of a video feed, or the representation of a 3D rendering being manipulated by the user. The end of each frame in those types of images will be indicated by calling imageComplete with the SINGLEFRAMEDONE flag.

See Also
setHints, imageComplete


 ImageConsumer.SINGLEFRAMEDONE

ImageConsumer.SINGLEFRAMEDONE

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int SINGLEFRAMEDONE
Description
One frame of the image is complete but there are more frames to be delivered.

See Also
imageComplete


 ImageConsumer.SINGLEPASS

ImageConsumer.SINGLEPASS

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int SINGLEPASS
Description
The pixels will be delivered in a single pass. Each pixel will appear in only one call to any of the setPixels methods. An example of an image format which does not meet this criterion is a progressive JPEG image which defines pixels in multiple passes, each more refined than the previous.

See Also
setHints


 ImageConsumer.STATICIMAGEDONE

ImageConsumer.STATICIMAGEDONE

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int STATICIMAGEDONE
Description
The image is complete and there are no more pixels or frames to be delivered.

See Also
imageComplete


 ImageConsumer.TOPDOWNLEFTRIGHT

ImageConsumer.TOPDOWNLEFTRIGHT

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int TOPDOWNLEFTRIGHT
Description
The pixels will be delivered in top-down, left-to-right order.

See Also
setHints


 ImageConsumer.imageComplete

ImageConsumer.imageComplete

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void imageComplete( int status )
Description
The imageComplete method is called when the ImageProducer is finished delivering all of the pixels that the source image contains, or when a single frame of a multi-frame animation has been completed, or when an error in loading or producing the image has occured. The ImageConsumer should remove itself from the list of consumers registered with the ImageProducer at this time, unless it is interested in successive frames.

See Also
removeConsumer


 ImageConsumer.setColorModel

ImageConsumer.setColorModel

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setColorModel( ColorModel model )
Description
The ColorModel object used for the majority of the pixels reported using the setPixels method calls. Note that each set of pixels delivered using setPixels contains its own ColorModel object, so no assumption should be made that this model will be the only one used in delivering pixel values. A notable case where multiple ColorModel objects may be seen is a filtered image when for each set of pixels that it filters, the filter determines whether the pixels can be sent on untouched, using the original ColorModel, or whether the pixels should be modified (filtered) and passed on using a ColorModel more convenient for the filtering process.

See Also
ColorModel


 ImageConsumer.setDimensions

ImageConsumer.setDimensions

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setDimensions( int width, int height )
Description
The dimensions of the source image are reported using the setDimensions method call.


 ImageConsumer.setHints

ImageConsumer.setHints

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setHints( int hintflags )
Description
The ImageProducer can deliver the pixels in any order, but the ImageConsumer may be able to scale or convert the pixels to the destination ColorModel more efficiently or with higher quality if it knows some information about how the pixels will be delivered up front. The setHints method should be called before any calls to any of the setPixels methods with a bit mask of hints about the manner in which the pixels will be delivered. If the ImageProducer does not follow the guidelines for the indicated hint, the results are undefined.


 ImageConsumer.setPixels

ImageConsumer.setPixels

Interface Overview | Interface Members | This Package | All Packages

Syntax 1
public abstract void setPixels( int x, int y, int w, int h, ColorModel model, byte pixels[], int off, int scansize )
Description
The pixels of the image are delivered using one or more calls to the setPixels method. Each call specifies the location and size of the rectangle of source pixels that are contained in the array of pixels. The specified ColorModel object should be used to convert the pixels into their corresponding color and alpha components. Pixel (m,n) is stored in the pixels array at index (n * scansize + m + off). The pixels delivered using this method are all stored as bytes.

See Also
ColorModel

Syntax 2
public abstract void setPixels( int x, int y, int w, int h, ColorModel model, int pixels[], int off, int scansize )
Description
The pixels of the image are delivered using one or more calls to the setPixels method. Each call specifies the location and size of the rectangle of source pixels that are contained in the array of pixels. The specified ColorModel object should be used to convert the pixels into their corresponding color and alpha components. Pixel (m,n) is stored in the pixels array at index (n * scansize + m + off). The pixels delivered using this method are all stored as ints.

See Also
ColorModel


 ImageConsumer.setProperties

ImageConsumer.setProperties

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setProperties( Hashtable props )
Description
Sets the extensible list of properties associated with this image.


 Class ImageFilter

Class java.awt.image.ImageFilter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.image.ImageFilter

public class ImageFilter
extends Object
implements ImageConsumer, Cloneable

This class implements a filter for the set of interface methods that are used to deliver data from an ImageProducer to an ImageConsumer. It is meant to be used in conjunction with a FilteredImageSource object to produce filtered versions of existing images. It is a base class that provides the calls needed to implement a "Null filter" which has no effect on the data being passed through. Filters should subclass this class and override the methods which deal with the data that needs to be filtered and modify it as necessary.

See Also:
FilteredImageSource, ImageConsumer


 ImageFilter Members

ImageFilter Members

Class Overview | This Package | All Packages

Fields
Name | Description
consumer | The consumer of the particular image data stream for which this instance of the ImageFilter is filtering data.

Constructors
Name | Description
ImageFilter() |

Methods
Name | Description
clone() | Clones this object.
getFilterInstance(ImageConsumer) | Returns a unique instance of an ImageFilter object which will actually perform the filtering for the specified ImageConsumer.
imageComplete(int) | Filters the information provided in the imageComplete method of the ImageConsumer interface.
resendTopDownLeftRight(ImageProducer) | Responds to a request for a TopDownLeftRight (TDLR) ordered resend of the pixel data from an ImageConsumer.
setColorModel(ColorModel) | Filter the information provided in the setColorModel method of the ImageConsumer interface.
setDimensions(int, int) | Filters the information provided in the setDimensions method of the ImageConsumer interface.
setHints(int) | Filters the information provided in the setHints method of the ImageConsumer interface.
setPixels(int, int, int, int, ColorModel, byte[], int, int) | Filters the information provided in the setPixels method of the ImageConsumer interface which takes an array of bytes.
setPixels(int, int, int, int, ColorModel, int[], int, int) | Filters the information provided in the setPixels method of the ImageConsumer interface which takes an array of integers.
setProperties(Hashtable) | Passes the properties from the source object along after adding a property indicating the stream of filters it has been run through.


 ImageFilter.consumer

ImageFilter.consumer

Syntax
protected ImageConsumer consumer
Description
The consumer of the particular image data stream for which this instance of the ImageFilter is filtering data. It is not initialized during the constructor, but rather during the getFilterInstance() method call when the FilteredImageSource is creating a unique instance of this object for a particular image data stream.

See Also
getFilterInstance, ImageConsumer


 ImageFilter.ImageFilter

ImageFilter.ImageFilter

Syntax
public ImageFilter()


 ImageFilter.clone

ImageFilter.clone

Syntax
public Object clone()
Description
Clones this object.

Overrides
clone in class Object


 ImageFilter.getFilterInstance

ImageFilter.getFilterInstance

Syntax
public ImageFilter getFilterInstance( ImageConsumer ic )
Description
Returns a unique instance of an ImageFilter object which will actually perform the filtering for the specified ImageConsumer. The default implementation just clones this object.


 ImageFilter.imageComplete

ImageFilter.imageComplete

Syntax
public void imageComplete( int status )
Description
Filters the information provided in the imageComplete method of the ImageConsumer interface.

See Also
imageComplete


 ImageFilter.resendTopDownLeftRight

ImageFilter.resendTopDownLeftRight

Syntax
public void resendTopDownLeftRight( ImageProducer ip )
Parameters
ip
The ImageProducer that is feeding this instance of the filter - also the ImageProducer that the request should be forwarded to if necessary.
Description
Responds to a request for a TopDownLeftRight (TDLR) ordered resend of the pixel data from an ImageConsumer. The ImageFilter can respond to this request in one of three ways.
  1. If the filter can determine that it will forward the pixels in TDLR order if its upstream producer object sends them in TDLR order, then the request is automatically forwarded by default to the indicated ImageProducer using this filter as the requesting ImageConsumer, so no override is necessary.
  2. If the filter can resend the pixels in the right order on its own (presumably because the generated pixels have been saved in some sort of buffer), then it can override this method and simply resend the pixels in TDLR order as specified in the ImageProducer API.
  3. If the filter simply returns from this method then the request will be ignored and no resend will occur.

See Also
requestTopDownLeftRightResend


 ImageFilter.setColorModel

ImageFilter.setColorModel

Syntax
public void setColorModel( ColorModel model )
Description
Filter the information provided in the setColorModel method of the ImageConsumer interface.

See Also
setColorModel


 ImageFilter.setDimensions

ImageFilter.setDimensions

Syntax
public void setDimensions( int width, int height )
Description
Filters the information provided in the setDimensions method of the ImageConsumer interface.

See Also
setDimensions


 ImageFilter.setHints

ImageFilter.setHints

Syntax
public void setHints( int hints )
Description
Filters the information provided in the setHints method of the ImageConsumer interface.

See Also
setHints


 ImageFilter.setPixels

ImageFilter.setPixels

Syntax 1
public void setPixels( int x, int y, int w, int h, ColorModel model, byte pixels[], int off, int scansize )
Description
Filters the information provided in the setPixels method of the ImageConsumer interface which takes an array of bytes.

See Also
setPixels

Syntax 2
public void setPixels( int x, int y, int w, int h, ColorModel model, int pixels[], int off, int scansize )
Description
Filters the information provided in the setPixels method of the ImageConsumer interface which takes an array of integers.

See Also
setPixels


 ImageFilter.setProperties

ImageFilter.setProperties

Syntax
public void setProperties( Hashtable props )
Description
Passes the properties from the source object along after adding a property indicating the stream of filters it has been run through.


 Interface ImageObserver

Interface java.awt.image.ImageObserver

Interface Members | This Package | All Packages

public interface ImageObserver

An asynchronous update interface for receiving notifications about Image information as the Image is constructed.


 ImageObserver Members

ImageObserver Members

Interface Overview | This Package | All Packages

Fields
Name | Description
ABORT | An image which was being tracked asynchronously was aborted before production was complete.
ALLBITS | A static image which was previously drawn is now complete and can be drawn again in its final form.
ERROR | An image which was being tracked asynchronously has encountered an error.
FRAMEBITS | Another complete frame of a multi-frame image which was previously drawn is now available to be drawn again.
HEIGHT | The height of the base image is now available and can be taken from the height argument to the imageUpdate callback method.
PROPERTIES | The properties of the image are now available.
SOMEBITS | More pixels needed for drawing a scaled variation of the image are available.
WIDTH | The width of the base image is now available and can be taken from the width argument to the imageUpdate callback method.

Methods
Name | Description
imageUpdate(Image, int, int, int, int, int) | This method is called when information about an image which was previously requested using an asynchronous interface becomes available.


 ImageObserver.ABORT

ImageObserver.ABORT

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int ABORT
Description
An image which was being tracked asynchronously was aborted before production was complete. No more information will become available without further action to trigger another image production sequence. If the ERROR flag was not also set in this image update, then accessing any of the data in the image will restart the production again, probably from the beginning.

See Also
imageUpdate


 ImageObserver.ALLBITS

ImageObserver.ALLBITS

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int ALLBITS
Description
A static image which was previously drawn is now complete and can be drawn again in its final form. The x, y, width, and height arguments to the imageUpdate callback method should be ignored.

See Also
drawImage, imageUpdate


 ImageObserver.ERROR

ImageObserver.ERROR

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int ERROR
Description
An image which was being tracked asynchronously has encountered an error. No further information will become available and drawing the image will fail. As a convenience, the ABORT flag will be indicated at the same time to indicate that the image production was aborted.

See Also
imageUpdate


 ImageObserver.FRAMEBITS

ImageObserver.FRAMEBITS

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int FRAMEBITS
Description
Another complete frame of a multi-frame image which was previously drawn is now available to be drawn again. The x, y, width, and height arguments to the imageUpdate callback method should be ignored.

See Also
drawImage, imageUpdate


 ImageObserver.HEIGHT

ImageObserver.HEIGHT

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int HEIGHT
Description
The height of the base image is now available and can be taken from the height argument to the imageUpdate callback method.

See Also
getHeight, imageUpdate


 ImageObserver.PROPERTIES

ImageObserver.PROPERTIES

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int PROPERTIES
Description
The properties of the image are now available.

See Also
getProperty, imageUpdate


 ImageObserver.SOMEBITS

ImageObserver.SOMEBITS

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int SOMEBITS
Description
More pixels needed for drawing a scaled variation of the image are available. The bounding box of the new pixels can be taken from the x, y, width, and height arguments to the imageUpdate callback method.

See Also
drawImage, imageUpdate


 ImageObserver.WIDTH

ImageObserver.WIDTH

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int WIDTH
Description
The width of the base image is now available and can be taken from the width argument to the imageUpdate callback method.

See Also
getWidth, imageUpdate


 ImageObserver.imageUpdate

ImageObserver.imageUpdate

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean imageUpdate( Image img, int infoflags, int x, int y, int width, int height )
Description
This method is called when information about an image which was previously requested using an asynchronous interface becomes available. Asynchronous interfaces are method calls such as getWidth(ImageObserver) and drawImage(img, x, y, ImageObserver) which take an ImageObserver object as an argument. Those methods register the caller as interested either in information about the overall image itself (in the case of getWidth(ImageObserver)) or about an output version of an image (in the case of the drawImage(img, x, y, [w, h,] ImageObserver) call).

This method should return true if further updates are needed or false if the required information has been acquired. The image which was being tracked is passed in using the img argument. Various constants are combined to form the infoflags argument which indicates what information about the image is now available. The interpretation of the x, y, width, and height arguments depends on the contents of the infoflags argument.

See Also
getWidth, getHeight, drawImage


 Interface ImageProducer

Interface java.awt.image.ImageProducer

Interface Members | This Package | All Packages

public interface ImageProducer

The interface for objects which can produce the image data for Images. Each image contains an ImageProducer which is used to reconstruct the image whenever it is needed, for example, when a new size of the Image is scaled, or when the width or height of the Image is being requested.

See Also:
ImageConsumer


 ImageProducer Members

ImageProducer Members

Interface Overview | This Package | All Packages

Methods
Name | Description
addConsumer(ImageConsumer) | This method is used to register an ImageConsumer with the ImageProducer for access to the image data during a later reconstruction of the Image.
isConsumer(ImageConsumer) | This method determines if a given ImageConsumer object is currently registered with this ImageProducer as one of its consumers.
removeConsumer(ImageConsumer) | This method removes the given ImageConsumer object from the list of consumers currently registered to receive image data.
requestTopDownLeftRightResend(ImageConsumer) | This method is used by an ImageConsumer to request that the ImageProducer attempt to resend the image data one more time in TOPDOWNLEFTRIGHT order so that higher quality conversion algorithms which depend on receiving pixels in order can be used to produce a better output version of the image.
startProduction(ImageConsumer) | This method both registers the given ImageConsumer object as a consumer and starts an immediate reconstruction of the image data which will then be delivered to this consumer and any other consumer which may have already been registered with the producer.


 ImageProducer.addConsumer

ImageProducer.addConsumer

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void addConsumer( ImageConsumer ic )
Description
This method is used to register an ImageConsumer with the ImageProducer for access to the image data during a later reconstruction of the Image. The ImageProducer may, at its discretion, start delivering the image data to the consumer using the ImageConsumer interface immediately, or when the next available image reconstruction is triggered by a call to the startProduction method.

See Also
startProduction


 ImageProducer.isConsumer

ImageProducer.isConsumer

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isConsumer( ImageConsumer ic )
Description
This method determines if a given ImageConsumer object is currently registered with this ImageProducer as one of its consumers.


 ImageProducer.removeConsumer

ImageProducer.removeConsumer

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void removeConsumer( ImageConsumer ic )
Description
This method removes the given ImageConsumer object from the list of consumers currently registered to receive image data. It is not considered an error to remove a consumer that is not currently registered. The ImageProducer should stop sending data to this consumer as soon as is feasible.


 ImageProducer.requestTopDownLeftRightResend

ImageProducer.requestTopDownLeftRightResend

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void requestTopDownLeftRightResend( ImageConsumer ic )
Description
This method is used by an ImageConsumer to request that the ImageProducer attempt to resend the image data one more time in TOPDOWNLEFTRIGHT order so that higher quality conversion algorithms which depend on receiving pixels in order can be used to produce a better output version of the image. The ImageProducer is free to ignore this call if it cannot resend the data in that order. If the data can be resent, then the ImageProducer should respond by executing the following minimum set of ImageConsumer method calls:
    ic.setHints(TOPDOWNLEFTRIGHT | < otherhints >);
    ic.setPixels(...);	// As many times as needed
    ic.imageComplete();

See Also
setHints


 ImageProducer.startProduction

ImageProducer.startProduction

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void startProduction( ImageConsumer ic )
Description
This method both registers the given ImageConsumer object as a consumer and starts an immediate reconstruction of the image data which will then be delivered to this consumer and any other consumer which may have already been registered with the producer. This method differs from the addConsumer method in that a reproduction of the image data should be triggered as soon as possible.

See Also
addConsumer


 Class IndexColorModel

Class java.awt.image.IndexColorModel

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.image.ColorModel
           |
           +----java.awt.image.IndexColorModel

public class IndexColorModel
extends ColorModel

A ColorModel class that specifies a translation from pixel values to alpha, red, green, and blue color components for pixels which represent indices into a fixed colormap. An optional transparent pixel value can be supplied which indicates a completely transparent pixel, regardless of any alpha value recorded for that pixel value. This color model is similar to an X11 PseudoColor visual.

Many of the methods in this class are final. The reason for this is that the underlying native graphics code makes assumptions about the layout and operation of this class and those assumptions are reflected in the implementations of the methods here that are marked final. You can subclass this class for other reaons, but you cannot override or modify the behaviour of those methods.

See Also:
ColorModel


 IndexColorModel Members

IndexColorModel Members

Class Overview | This Package | All Packages

Constructors
Name | Description
IndexColorModel(int, int, byte[], byte[], byte[]) | Constructs an IndexColorModel from the given arrays of red, green, and blue components.
IndexColorModel(int, int, byte[], byte[], byte[], byte[]) | Constructs an IndexColorModel from the given arrays of red, green, blue and alpha components.
IndexColorModel(int, int, byte[], byte[], byte[], int) | Constructs an IndexColorModel from the given arrays of red, green, and blue components.
IndexColorModel(int, int, byte[], int, boolean) | Constructs an IndexColorModel from a single arrays of packed red, green, blue and optional alpha components.
IndexColorModel(int, int, byte[], int, boolean, int) | Constructs an IndexColorModel from a single arrays of packed red, green, blue and optional alpha components.

Methods
Name | Description
getAlpha(int) | Returns the alpha transparency value for the specified pixel in the range 0-255.
getAlphas(byte[]) | Copies the array of alpha transparency values into the given array.
getBlue(int) | Returns the blue color compoment for the specified pixel in the range 0-255.
getBlues(byte[]) | Copies the array of blue color components into the given array.
getGreen(int) | Returns the green color compoment for the specified pixel in the range 0-255.
getGreens(byte[]) | Copies the array of green color components into the given array.
getMapSize() | Returns the size of the color component arrays in this IndexColorModel.
getRed(int) | Returns the red color compoment for the specified pixel in the range 0-255.
getReds(byte[]) | Copies the array of red color components into the given array.
getRGB(int) | Returns the color of the pixel in the default RGB color model.
getTransparentPixel() | Returns the index of the transparent pixel in this IndexColorModel or -1 if there is no transparent pixel.


 IndexColorModel.IndexColorModel

IndexColorModel.IndexColorModel

Syntax 1
public IndexColorModel( int bits, int size, byte r[], byte g[], byte b[] )
Parameters
bits
The number of bits each pixel occupies.
size
The size of the color component arrays.
r
The array of red color components.
g
The array of green color components.
b
The array of blue color components.
Description
Constructs an IndexColorModel from the given arrays of red, green, and blue components. Pixels described by this color model will all have alpha components of 255 (fully opaque). All of the arrays specifying the color components must have at least the specified number of entries.

Syntax 2
public IndexColorModel( int bits, int size, byte r[], byte g[], byte b[], int trans )
Parameters
bits
The number of bits each pixel occupies.
size
The size of the color component arrays.
r
The array of red color components.
g
The array of green color components.
b
The array of blue color components.
trans
The index of the transparent pixel.
Description
Constructs an IndexColorModel from the given arrays of red, green, and blue components. Pixels described by this color model will all have alpha components of 255 (fully opaque), except for the indicated transparent pixel. All of the arrays specifying the color components must have at least the specified number of entries.

Syntax 3
public IndexColorModel( int bits, int size, byte r[], byte g[], byte b[], byte a[] )
Parameters
bits
The number of bits each pixel occupies.
size
The size of the color component arrays.
r
The array of red color components.
g
The array of green color components.
b
The array of blue color components.
a
The array of alpha value components.
Description
Constructs an IndexColorModel from the given arrays of red, green, blue and alpha components. All of the arrays specifying the color components must have at least the specified number of entries.

Syntax 4
public IndexColorModel( int bits, int size, byte cmap[], int start, boolean hasalpha )
Parameters
bits
The number of bits each pixel occupies.
size
The size of the color component arrays.
cmap
The array of color components.
start
The starting offset of the first color component.
hasalpha
Indicates whether alpha values are contained in the cmap array.
Description
Constructs an IndexColorModel from a single arrays of packed red, green, blue and optional alpha components. The array must have enough values in it to fill all of the needed component arrays of the specified size.

Syntax 5
public IndexColorModel( int bits, int size, byte cmap[], int start, boolean hasalpha, int trans )
Parameters
bits
The number of bits each pixel occupies.
size
The size of the color component arrays.
cmap
The array of color components.
start
The starting offset of the first color component.
hasalpha
Indicates whether alpha values are contained in the cmap array.
trans
The index of the fully transparent pixel.
Description
Constructs an IndexColorModel from a single arrays of packed red, green, blue and optional alpha components. The specified transparent index represents a pixel which will be considered entirely transparent regardless of any alpha value specified for it. The array must have enough values in it to fill all of the needed component arrays of the specified size.


 IndexColorModel.getAlpha

IndexColorModel.getAlpha

Syntax
public final int getAlpha( int pixel )
Description
Returns the alpha transparency value for the specified pixel in the range 0-255.

Overrides
getAlpha in class ColorModel


 IndexColorModel.getAlphas

IndexColorModel.getAlphas

Syntax
public final void getAlphas( byte a[] )
Description
Copies the array of alpha transparency values into the given array. Only the initial entries of the array as specified by getMapSize() will be written.


 IndexColorModel.getBlue

IndexColorModel.getBlue

Syntax
public final int getBlue( int pixel )
Description
Returns the blue color compoment for the specified pixel in the range 0-255.

Overrides
getBlue in class ColorModel


 IndexColorModel.getBlues

IndexColorModel.getBlues

Syntax
public final void getBlues( byte b[] )
Description
Copies the array of blue color components into the given array. Only the initial entries of the array as specified by getMapSize() will be written.


 IndexColorModel.getGreen

IndexColorModel.getGreen

Syntax
public final int getGreen( int pixel )
Description
Returns the green color compoment for the specified pixel in the range 0-255.

Overrides
getGreen in class ColorModel


 IndexColorModel.getGreens

IndexColorModel.getGreens

Syntax
public final void getGreens( byte g[] )
Description
Copies the array of green color components into the given array. Only the initial entries of the array as specified by getMapSize() are written.


 IndexColorModel.getMapSize

IndexColorModel.getMapSize

Syntax
public final int getMapSize()
Description
Returns the size of the color component arrays in this IndexColorModel.


 IndexColorModel.getRed

IndexColorModel.getRed

Syntax
public final int getRed( int pixel )
Description
Returns the red color compoment for the specified pixel in the range 0-255.

Overrides
getRed in class ColorModel


 IndexColorModel.getReds

IndexColorModel.getReds

Syntax
public final void getReds( byte r[] )
Description
Copies the array of red color components into the given array. Only the initial entries of the array as specified by getMapSize() are written.


 IndexColorModel.getRGB

IndexColorModel.getRGB

Syntax
public final int getRGB( int pixel )
Description
Returns the color of the pixel in the default RGB color model.

Overrides
getRGB in class ColorModel
See Also
getRGBdefault


 IndexColorModel.getTransparentPixel

IndexColorModel.getTransparentPixel

Syntax
public final int getTransparentPixel()
Description
Returns the index of the transparent pixel in this IndexColorModel or -1 if there is no transparent pixel.


 Class MemoryImageSource

Class java.awt.image.MemoryImageSource

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.image.MemoryImageSource

public class MemoryImageSource
extends Object
implements ImageProducer

This class is an implementation of the ImageProducer interface which uses an array to produce pixel values for an Image. Here is an example which calculates a 100x100 image representing a fade from black to blue along the X axis and a fade from black to red along the Y axis:

    int w = 100;
    int h = 100;
    int pix[] = new int[w * h];
    int index = 0;
    for (int y = 0; y < h; y++) {
        int red = (y * 255) / (h - 1);
        for (int x = 0; x < w; x++) {
        int blue = (x * 255) / (w - 1);
        pix[index++] = (255 << 24) | (red << 16) | blue;
        }
    }
    Image img = createImage(new MemoryImageSource(w, h, pix, 0, w));
The MemoryImageSource is also capable of managing a memory image which varies over time to allow animation or custom rendering. Here is an example showing how to set up the animation source and signal changes in the data (adapted from the MemoryAnimationSourceDemo by Garth Dickie):
    int pixels[];
    MemoryImageSource source;
    public void init() {
        int width = 50;
        int height = 50;
        int size = width * height;
        pixels = new int[size];
        int value = getBackground().getRGB();
        for (int i = 0; i < size; i++) {
        pixels[i] = value;
        }
        source = new MemoryImageSource(width, height, pixels, 0, width);
        source.setAnimated(true);
        image = createImage(source);
    }
    public void run() {
        Thread me = Thread.currentThread( );
        me.setPriority(Thread.MIN_PRIORITY);
        while (true) {
        try {
            thread.sleep(10);
        } catch( InterruptedException e ) {
            return;
        }
        // Modify the values in the pixels array at (x, y, w, h)
        // Send the new data to the interested ImageConsumers
        source.newPixels(x, y, w, h);
        }
    }

See Also:
ImageProducer


 MemoryImageSource Members

MemoryImageSource Members

Class Overview | This Package | All Packages

Constructors
Name | Description
MemoryImageSource(int, int, ColorModel, byte[], int, int) | Constructs an ImageProducer object which uses an array of bytes to produce data for an Image object.
MemoryImageSource(int, int, ColorModel, byte[], int, int, Hashtable) | Constructs an ImageProducer object which uses an array of bytes to produce data for an Image object.
MemoryImageSource(int, int, ColorModel, int[], int, int) | Constructs an ImageProducer object which uses an array of integers to produce data for an Image object.
MemoryImageSource(int, int, ColorModel, int[], int, int, Hashtable) | Constructs an ImageProducer object which uses an array of integers to produce data for an Image object.
MemoryImageSource(int, int, int[], int, int) | Constructs an ImageProducer object which uses an array of integers in the default RGB ColorModel to produce data for an Image object.
MemoryImageSource(int, int, int[], int, int, Hashtable) | Constructs an ImageProducer object which uses an array of integers in the default RGB ColorModel to produce data for an Image object.

Methods
Name | Description
addConsumer(ImageConsumer) | Adds an ImageConsumer to the list of consumers interested in data for this image.
isConsumer(ImageConsumer) | Determine if an ImageConsumer is on the list of consumers currently interested in data for this image.
newPixels() | Send a whole new buffer of pixels to any ImageConsumers that are currently interested in the data for this image and notify them that an animation frame is complete.
newPixels(byte[], ColorModel, int, int) | Change to a new byte array to hold the pixels for this image.
newPixels(int, int, int, int) | Send a rectangular region of the buffer of pixels to any ImageConsumers that are currently interested in the data for this image and notify them that an animation frame is complete.
newPixels(int, int, int, int, boolean) | Send a rectangular region of the buffer of pixels to any ImageConsumers that are currently interested in the data for this image.
newPixels(int[], ColorModel, int, int) | Change to a new int array to hold the pixels for this image.
removeConsumer(ImageConsumer) | Remove an ImageConsumer from the list of consumers interested in data for this image.
requestTopDownLeftRightResend(ImageConsumer) | Requests that a given ImageConsumer have the image data delivered one more time in top-down, left-right order.
setAnimated(boolean) | Change this memory image into a multi-frame animation or a single-frame static image depending on the animated parameter.
setFullBufferUpdates(boolean) | Specify whether this animated memory image should always be updated by sending the complete buffer of pixels whenever there is a change.
startProduction(ImageConsumer) | Adds an ImageConsumer to the list of consumers interested in data for this image, and immediately start delivery of the image data through the ImageConsumer interface.


 MemoryImageSource.MemoryImageSource

MemoryImageSource.MemoryImageSource

Syntax 1
public MemoryImageSource( int w, int h, ColorModel cm, byte pix[], int off, int scan )
Description
Constructs an ImageProducer object which uses an array of bytes to produce data for an Image object.

See Also
createImage

Syntax 2
public MemoryImageSource( int w, int h, ColorModel cm, byte pix[], int off, int scan, Hashtable props )
Description
Constructs an ImageProducer object which uses an array of bytes to produce data for an Image object.

See Also
createImage

Syntax 3
public MemoryImageSource( int w, int h, ColorModel cm, int pix[], int off, int scan )
Description
Constructs an ImageProducer object which uses an array of integers to produce data for an Image object.

See Also
createImage

Syntax 4
public MemoryImageSource( int w, int h, ColorModel cm, int pix[], int off, int scan, Hashtable props )
Description
Constructs an ImageProducer object which uses an array of integers to produce data for an Image object.

See Also
createImage

Syntax 5
public MemoryImageSource( int w, int h, int pix[], int off, int scan )
Description
Constructs an ImageProducer object which uses an array of integers in the default RGB ColorModel to produce data for an Image object.

See Also
createImage, getRGBdefault

Syntax 6
public MemoryImageSource( int w, int h, int pix[], int off, int scan, Hashtable props )
Description
Constructs an ImageProducer object which uses an array of integers in the default RGB ColorModel to produce data for an Image object.

See Also
createImage, getRGBdefault


 MemoryImageSource.addConsumer

MemoryImageSource.addConsumer

Syntax
public synchronized void addConsumer( ImageConsumer ic )
Description
Adds an ImageConsumer to the list of consumers interested in data for this image.

See Also
ImageConsumer


 MemoryImageSource.isConsumer

MemoryImageSource.isConsumer

Syntax
public synchronized boolean isConsumer( ImageConsumer ic )
Returns
true if the ImageConsumer is on the list; false otherwise
Description
Determine if an ImageConsumer is on the list of consumers currently interested in data for this image.

See Also
ImageConsumer


 MemoryImageSource.newPixels

MemoryImageSource.newPixels

Syntax 1
public void newPixels()
Description
Send a whole new buffer of pixels to any ImageConsumers that are currently interested in the data for this image and notify them that an animation frame is complete. This method only has effect if the animation flag has been turned on through the setAnimated() method.

See Also
ImageConsumer, setAnimated

Syntax 2
public synchronized void newPixels( int x, int y, int w, int h )
Parameters
x
the x coordinate of the upper left corner of the rectangle of pixels to be sent
y
the y coordinate of the upper left corner of the rectangle of pixels to be sent
w
the width of the rectangle of pixels to be sent
h
the height of the rectangle of pixels to be sent
Description
Send a rectangular region of the buffer of pixels to any ImageConsumers that are currently interested in the data for this image and notify them that an animation frame is complete. This method only has effect if the animation flag has been turned on through the setAnimated() method. If the full buffer update flag was turned on with the setFullBufferUpdates() method then the rectangle parameters will be ignored and the entire buffer will always be sent.

See Also
ImageConsumer, setAnimated, setFullBufferUpdates

Syntax 3
public synchronized void newPixels( int x, int y, int w, int h, boolean framenotify )
Parameters
x
the x coordinate of the upper left corner of the rectangle of pixels to be sent
y
the y coordinate of the upper left corner of the rectangle of pixels to be sent
w
the width of the rectangle of pixels to be sent
h
the height of the rectangle of pixels to be sent
framenotify
true if the consumers should be sent a SINGLEFRAMEDONE notification
Description
Send a rectangular region of the buffer of pixels to any ImageConsumers that are currently interested in the data for this image. If the framenotify parameter is true then the consumers are also notified that an animation frame is complete. This method only has effect if the animation flag has been turned on through the setAnimated() method. If the full buffer update flag was turned on with the setFullBufferUpdates() method then the rectangle parameters will be ignored and the entire buffer will always be sent.

See Also
ImageConsumer, setAnimated, setFullBufferUpdates

Syntax 4
public synchronized void newPixels( byte newpix[], ColorModel newmodel, int offset, int scansize )
Description
Change to a new byte array to hold the pixels for this image. If the animation flag has been turned on through the setAnimated() method, then the new pixels will be immediately delivered to any ImageConsumers that are currently interested in the data for this image.

See Also
setAnimated

Syntax 5
public synchronized void newPixels( int newpix[], ColorModel newmodel, int offset, int scansize )
Description
Change to a new int array to hold the pixels for this image. If the animation flag has been turned on through the setAnimated() method, then the new pixels will be immediately delivered to any ImageConsumers that are currently interested in the data for this image.

See Also
setAnimated


 MemoryImageSource.removeConsumer

MemoryImageSource.removeConsumer

Syntax
public synchronized void removeConsumer( ImageConsumer ic )
Description
Remove an ImageConsumer from the list of consumers interested in data for this image.

See Also
ImageConsumer


 MemoryImageSource.requestTopDownLeftRightResend

MemoryImageSource.requestTopDownLeftRightResend

Syntax
public void requestTopDownLeftRightResend( ImageConsumer ic )
Description
Requests that a given ImageConsumer have the image data delivered one more time in top-down, left-right order.

See Also
ImageConsumer


 MemoryImageSource.setAnimated

MemoryImageSource.setAnimated

Syntax
public synchronized void setAnimated( boolean animated )
Parameters
animated
true if the image is a multi-frame animation
Description
Change this memory image into a multi-frame animation or a single-frame static image depending on the animated parameter.

This method should be called immediately after the MemoryImageSource is constructed and before an image is created with it to ensure that all ImageConsumers will receive the correct multi-frame data. If an ImageConsumer is added to this ImageProducer before this flag is set then that ImageConsumer will see only a snapshot of the pixel data that was available when it connected.


 MemoryImageSource.setFullBufferUpdates

MemoryImageSource.setFullBufferUpdates

Syntax
public synchronized void setFullBufferUpdates( boolean fullbuffers )
Parameters
fullbuffers
true if the complete pixel buffer should always be sent
Description
Specify whether this animated memory image should always be updated by sending the complete buffer of pixels whenever there is a change. This flag is ignored if the animation flag is not turned on through the setAnimated() method.

This method should be called immediately after the MemoryImageSource is constructed and before an image is created with it to ensure that all ImageConsumers will receive the correct pixel delivery hints.

See Also
setAnimated


 MemoryImageSource.startProduction

MemoryImageSource.startProduction

Syntax
public void startProduction( ImageConsumer ic )
Description
Adds an ImageConsumer to the list of consumers interested in data for this image, and immediately start delivery of the image data through the ImageConsumer interface.

See Also
ImageConsumer


 Class PixelGrabber

Class java.awt.image.PixelGrabber

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.image.PixelGrabber

public class PixelGrabber
extends Object
implements ImageConsumer

The PixelGrabber class implements an ImageConsumer which can be attached to an Image or ImageProducer object to retrieve a subset of the pixels in that image. Here is an example:

 public void handlesinglepixel(int x, int y, int pixel) {
    int alpha = (pixel >> 24) & 0xff;
    int red   = (pixel >> 16) & 0xff;
    int green = (pixel >>  8) & 0xff;
    int blue  = (pixel      ) & 0xff;
    // Deal with the pixel as necessary...
 }
 public void handlepixels(Image img, int x, int y, int w, int h) {
    int[] pixels = new int[w * h];
    PixelGrabber pg = new PixelGrabber(img, x, y, w, h, pixels, 0, w);
    try {
        pg.grabPixels();
    } catch (InterruptedException e) {
        System.err.println("interrupted waiting for pixels!");
        return;
    }
    if ((pg.getStatus() & ImageObserver.ABORT) != 0) {
        System.err.println("image fetch aborted or errored");
        return;
    }
    for (int j = 0; j < h; j++) {
        for (int i = 0; i < w; i++) {
        handlesinglepixel(x+i, y+j, pixels[j * w + i]);
        }
    }
 }

See Also:
getRGBdefault


 PixelGrabber Members

PixelGrabber Members

Class Overview | This Package | All Packages

Constructors
Name | Description
PixelGrabber(Image, int, int, int, int, boolean) | Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the specified image.
PixelGrabber(Image, int, int, int, int, int[], int, int) | Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the specified image into the given array.
PixelGrabber(ImageProducer, int, int, int, int, int[], int, int) | Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the image produced by the specified ImageProducer into the given array.

Methods
Name | Description
abortGrabbing() | Request the PixelGrabber to abort the image fetch.
getColorModel() | Get the ColorModel for the pixels stored in the array.
getHeight() | Get the height of the pixel buffer (after adjusting for image height).
getPixels() | Get the pixel buffer.
getStatus() | Return the status of the pixels.
getWidth() | Get the width of the pixel buffer (after adjusting for image width).
grabPixels() | Request the Image or ImageProducer to start delivering pixels and wait for all of the pixels in the rectangle of interest to be delivered.
grabPixels(long) | Request the Image or ImageProducer to start delivering pixels and wait for all of the pixels in the rectangle of interest to be delivered or until the specified timeout has elapsed.
imageComplete(int) | The imageComplete method is part of the ImageConsumer API which this class must implement to retrieve the pixels.
setColorModel(ColorModel) | The setColorModel method is part of the ImageConsumer API which this class must implement to retrieve the pixels.
setDimensions(int, int) | The setDimensions method is part of the ImageConsumer API which this class must implement to retrieve the pixels.
setHints(int) | The setHints method is part of the ImageConsumer API which this class must implement to retrieve the pixels.
setPixels(int, int, int, int, ColorModel, byte[], int, int) | The setPixels method is part of the ImageConsumer API which this class must implement to retrieve the pixels.
setPixels(int, int, int, int, ColorModel, int[], int, int) | The setPixels method is part of the ImageConsumer API which this class must implement to retrieve the pixels.
setProperties(Hashtable) | The setProperties method is part of the ImageConsumer API which this class must implement to retrieve the pixels.
startGrabbing() | Request the PixelGrabber to start fetching the pixels.
status() | DEPRECATED: Replaced by getStatus().


 PixelGrabber.PixelGrabber

PixelGrabber.PixelGrabber

Syntax 1
public PixelGrabber( Image img, int x, int y, int w, int h, int pix[], int off, int scansize )
Parameters
img
the image to retrieve pixels from
x
the x coordinate of the upper left corner of the rectangle of pixels to retrieve from the image, relative to the default (unscaled) size of the image
y
the y coordinate of the upper left corner of the rectangle of pixels to retrieve from the image
w
the width of the rectangle of pixels to retrieve
h
the height of the rectangle of pixels to retrieve
pix
the array of integers which are to be used to hold the RGB pixels retrieved from the image
off
the offset into the array of where to store the first pixel
scansize
the distance from one row of pixels to the next in the array
Description
Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the specified image into the given array. The pixels are stored into the array in the default RGB ColorModel. The RGB data for pixel (i, j) where (i, j) is inside the rectangle (x, y, w, h) is stored in the array at pix[(j - y) * scansize + (i - x) + off].

See Also
getRGBdefault

Syntax 2
public PixelGrabber( ImageProducer ip, int x, int y, int w, int h, int pix[], int off, int scansize )
Parameters
img
the image to retrieve pixels from
x
the x coordinate of the upper left corner of the rectangle of pixels to retrieve from the image, relative to the default (unscaled) size of the image
y
the y coordinate of the upper left corner of the rectangle of pixels to retrieve from the image
w
the width of the rectangle of pixels to retrieve
h
the height of the rectangle of pixels to retrieve
pix
the array of integers which are to be used to hold the RGB pixels retrieved from the image
off
the offset into the array of where to store the first pixel
scansize
the distance from one row of pixels to the next in the array
Description
Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the image produced by the specified ImageProducer into the given array. The pixels are stored into the array in the default RGB ColorModel. The RGB data for pixel (i, j) where (i, j) is inside the rectangle (x, y, w, h) is stored in the array at pix[(j - y) * scansize + (i - x) + off].

See Also
getRGBdefault

Syntax 3
public PixelGrabber( Image img, int x, int y, int w, int h, boolean forceRGB )
Parameters
img
the image to retrieve the image data from
x
the x coordinate of the upper left corner of the rectangle of pixels to retrieve from the image, relative to the default (unscaled) size of the image
y
the y coordinate of the upper left corner of the rectangle of pixels to retrieve from the image
w
the width of the rectangle of pixels to retrieve
h
the height of the rectangle of pixels to retrieve
forceRGB
true if the pixels should always be converted to the default RGB ColorModel
Description
Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the specified image. The pixels are accumulated in the original ColorModel if the same ColorModel is used for every call to setPixels, otherwise the pixels are accumulated in the default RGB ColorModel. If the forceRGB parameter is true, then the pixels will be accumulated in the default RGB ColorModel anywya. A buffer is allocated by the PixelGrabber to hold the pixels in either case. If (w < 0) or (h < 0), then they will default to the remaining width and height of the source data when that information is delivered.


 PixelGrabber.abortGrabbing

PixelGrabber.abortGrabbing

Syntax
public synchronized void abortGrabbing()
Description
Request the PixelGrabber to abort the image fetch.


 PixelGrabber.getColorModel

PixelGrabber.getColorModel

Syntax
public synchronized ColorModel getColorModel()
Returns
the ColorModel object used for storing the pixels
Description
Get the ColorModel for the pixels stored in the array. If the PixelGrabber was constructed with an explicit pixel buffer then this method will always return the default RGB ColorModel, otherwise it may return null until the ColorModel used by the ImageProducer is known. Since the PixelGrabber may fall back on accumulating the data in the default RGB ColorModel at any time if the source image uses more than one ColorModel to deliver the data, the ColorModel object returned by this method may change over time until the image grab is complete.

See Also
getStatus, getRGBdefault


 PixelGrabber.getHeight

PixelGrabber.getHeight

Syntax
public synchronized int getHeight()
Returns
the final height used for the pixel buffer or -1 if the height is not yet known
Description
Get the height of the pixel buffer (after adjusting for image height). If no width was specified for the rectangle of pixels to grab then then this information will only be available after the image has delivered the dimensions.

See Also
getStatus


 PixelGrabber.getPixels

PixelGrabber.getPixels

Syntax
public synchronized Object getPixels()
Returns
either a byte array or an int array
Description
Get the pixel buffer. If the PixelGrabber was not constructed with an explicit pixel buffer to hold the pixels then this method will return null until the size and format of the image data is known. Since the PixelGrabber may fall back on accumulating the data in the default RGB ColorModel at any time if the source image uses more than one ColorModel to deliver the data, the array object returned by this method may change over time until the image grab is complete.

See Also
getStatus


 PixelGrabber.getStatus

PixelGrabber.getStatus

Syntax
public synchronized int getStatus()
Returns
the bitwise OR of all relevant ImageObserver flags
Description
Return the status of the pixels. The ImageObserver flags representing the available pixel information are returned.

See Also
ImageObserver


 PixelGrabber.getWidth

PixelGrabber.getWidth

Syntax
public synchronized int getWidth()
Returns
the final width used for the pixel buffer or -1 if the width is not yet known
Description
Get the width of the pixel buffer (after adjusting for image width). If no width was specified for the rectangle of pixels to grab then then this information will only be available after the image has delivered the dimensions.

See Also
getStatus


 PixelGrabber.grabPixels

PixelGrabber.grabPixels

Syntax 1
public boolean grabPixels() throws InterruptedException
Returns
true if the pixels were successfully grabbed, false on abort, error or timeout
Description
Request the Image or ImageProducer to start delivering pixels and wait for all of the pixels in the rectangle of interest to be delivered.

Exceptions
InterruptedException Another thread has interrupted this thread.

Syntax 2
public synchronized boolean grabPixels( long ms ) throws InterruptedException
Parameters
ms
the number of milliseconds to wait for the image pixels to arrive before timing out
Returns
true if the pixels were successfully grabbed, false on abort, error or timeout
Description
Request the Image or ImageProducer to start delivering pixels and wait for all of the pixels in the rectangle of interest to be delivered or until the specified timeout has elapsed.

Exceptions
InterruptedException Another thread has interrupted this thread.


 PixelGrabber.imageComplete

PixelGrabber.imageComplete

Syntax
public synchronized void imageComplete( int status )
Description
The imageComplete method is part of the ImageConsumer API which this class must implement to retrieve the pixels.


 PixelGrabber.setColorModel

PixelGrabber.setColorModel

Syntax
public void setColorModel( ColorModel model )
Description
The setColorModel method is part of the ImageConsumer API which this class must implement to retrieve the pixels.


 PixelGrabber.setDimensions

PixelGrabber.setDimensions

Syntax
public void setDimensions( int width, int height )
Description
The setDimensions method is part of the ImageConsumer API which this class must implement to retrieve the pixels.


 PixelGrabber.setHints

PixelGrabber.setHints

Syntax
public void setHints( int hints )
Description
The setHints method is part of the ImageConsumer API which this class must implement to retrieve the pixels.


 PixelGrabber.setPixels

PixelGrabber.setPixels

Syntax 1
public void setPixels( int srcX, int srcY, int srcW, int srcH, ColorModel model, byte pixels[], int srcOff, int srcScan )
Description
The setPixels method is part of the ImageConsumer API which this class must implement to retrieve the pixels.

Syntax 2
public void setPixels( int srcX, int srcY, int srcW, int srcH, ColorModel model, int pixels[], int srcOff, int srcScan )
Description
The setPixels method is part of the ImageConsumer API which this class must implement to retrieve the pixels.


 PixelGrabber.setProperties

PixelGrabber.setProperties

Syntax
public void setProperties( Hashtable props )
Description
The setProperties method is part of the ImageConsumer API which this class must implement to retrieve the pixels.


 PixelGrabber.startGrabbing

PixelGrabber.startGrabbing

Syntax
public synchronized void startGrabbing()
Description
Request the PixelGrabber to start fetching the pixels.


 PixelGrabber.status

PixelGrabber.status

Syntax
public synchronized int status()
Description
DEPRECATED: Replaced by getStatus().


 Class RGBImageFilter

Class java.awt.image.RGBImageFilter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.image.ImageFilter
           |
           +----java.awt.image.RGBImageFilter

public abstract class RGBImageFilter
extends ImageFilter

This class provides an easy way to create an ImageFilter which modifies the pixels of an image in the default RGB ColorModel. It is meant to be used in conjunction with a FilteredImageSource object to produce filtered versions of existing images. It is an abstract class that provides the calls needed to channel all of the pixel data through a single method which converts pixels one at a time in the default RGB ColorModel regardless of the ColorModel being used by the ImageProducer. The only method which needs to be defined to create a useable image filter is the filterRGB method. Here is an example of a definition of a filter which swaps the red and blue components of an image:

    class RedBlueSwapFilter extends RGBImageFilter {
        public RedBlueSwapFilter() {
        // The filter's operation does not depend on the
        // pixel's location, so IndexColorModels can be
        // filtered directly.
        canFilterIndexColorModel = true;
        }
        public int filterRGB(int x, int y, int rgb) {
        return ((rgb & 0xff00ff00)
            | ((rgb & 0xff0000) >> 16)
            | ((rgb & 0xff) << 16));
        }
    }

See Also:
FilteredImageSource, ImageFilter, getRGBdefault


 RGBImageFilter Members

RGBImageFilter Members

Class Overview | This Package | All Packages

Fields
Name | Description
canFilterIndexColorModel | This boolean indicates whether or not it is acceptable to apply the color filtering of the filterRGB method to the color table entries of an IndexColorModel object in lieu of pixel by pixel filtering.
newmodel |
origmodel |

Constructors
Name | Description
RGBImageFilter() |

Methods
Name | Description
filterIndexColorModel(IndexColorModel) | Filters an IndexColorModel object by running each entry in its color tables through the filterRGB function that RGBImageFilter subclasses must provide.
filterRGB(int, int, int) | Subclasses must specify a method to convert a single input pixel in the default RGB ColorModel to a single output pixel.
filterRGBPixels(int, int, int, int, int[], int, int) | Filters a buffer of pixels in the default RGB ColorModel by passing them one by one through the filterRGB method.
setColorModel(ColorModel) | If the ColorModel is an IndexColorModel, and the subclass has set the canFilterIndexColorModel flag to true, we substitute a filtered version of the color model here and wherever that original ColorModel object appears in the setPixels methods.
setPixels(int, int, int, int, ColorModel, byte[], int, int) | If the ColorModel object is the same one that has already been converted, then simply passes the pixels through with the converted ColorModel.
setPixels(int, int, int, int, ColorModel, int[], int, int) | If the ColorModel object is the same one that has already been converted, then simply passes the pixels through with the converted ColorModel, otherwise converts the buffer of integer pixels to the default RGB ColorModel and passes the converted buffer to the filterRGBPixels method to be converted one by one.
substituteColorModel(ColorModel, ColorModel) | Registers two ColorModel objects for substitution.


 RGBImageFilter.canFilterIndexColorModel

RGBImageFilter.canFilterIndexColorModel

Syntax
protected boolean canFilterIndexColorModel
Description
This boolean indicates whether or not it is acceptable to apply the color filtering of the filterRGB method to the color table entries of an IndexColorModel object in lieu of pixel by pixel filtering. Subclasses should set this variable to true in their constructor if their filterRGB method does not depend on the coordinate of the pixel being filtered.

See Also
substituteColorModel, filterRGB, IndexColorModel


 RGBImageFilter.newmodel

RGBImageFilter.newmodel

Syntax
protected ColorModel newmodel


 RGBImageFilter.origmodel

RGBImageFilter.origmodel

Syntax
protected ColorModel origmodel


 RGBImageFilter.RGBImageFilter

RGBImageFilter.RGBImageFilter

Syntax
public RGBImageFilter()


 RGBImageFilter.filterIndexColorModel

RGBImageFilter.filterIndexColorModel

Syntax
public IndexColorModel filterIndexColorModel( IndexColorModel icm )
Parameters
icm
the IndexColorModel object to be filtered
Returns
a new IndexColorModel representing the filtered colors
Description
Filters an IndexColorModel object by running each entry in its color tables through the filterRGB function that RGBImageFilter subclasses must provide. Uses coordinates of -1 to indicate that a color table entry is being filtered rather than an actual pixel value.


 RGBImageFilter.filterRGB

RGBImageFilter.filterRGB

Syntax
public abstract int filterRGB( int x, int y, int rgb )
Description
Subclasses must specify a method to convert a single input pixel in the default RGB ColorModel to a single output pixel.

See Also
getRGBdefault, filterRGBPixels


 RGBImageFilter.filterRGBPixels

RGBImageFilter.filterRGBPixels

Syntax
public void filterRGBPixels( int x, int y, int w, int h, int pixels[], int off, int scansize )
Description
Filters a buffer of pixels in the default RGB ColorModel by passing them one by one through the filterRGB method.

See Also
getRGBdefault, filterRGB


 RGBImageFilter.setColorModel

RGBImageFilter.setColorModel

Syntax
public void setColorModel( ColorModel model )
Description
If the ColorModel is an IndexColorModel, and the subclass has set the canFilterIndexColorModel flag to true, we substitute a filtered version of the color model here and wherever that original ColorModel object appears in the setPixels methods. Otherwise overrides the default ColorModel used by the ImageProducer and specifies the default RGB ColorModel instead.

Overrides
setColorModel in class ImageFilter
See Also
ImageConsumer, getRGBdefault


 RGBImageFilter.setPixels

RGBImageFilter.setPixels

Syntax 1
public void setPixels( int x, int y, int w, int h, ColorModel model, byte pixels[], int off, int scansize )
Description
If the ColorModel object is the same one that has already been converted, then simply passes the pixels through with the converted ColorModel. Otherwise converts the buffer of byte pixels to the default RGB ColorModel and passes the converted buffer to the filterRGBPixels method to be converted one by one.

Overrides
setPixels in class ImageFilter
See Also
getRGBdefault, filterRGBPixels

Syntax 2
public void setPixels( int x, int y, int w, int h, ColorModel model, int pixels[], int off, int scansize )
Description
If the ColorModel object is the same one that has already been converted, then simply passes the pixels through with the converted ColorModel, otherwise converts the buffer of integer pixels to the default RGB ColorModel and passes the converted buffer to the filterRGBPixels method to be converted one by one. Converts a buffer of integer pixels to the default RGB ColorModel and passes the converted buffer to the filterRGBPixels method.

Overrides
setPixels in class ImageFilter
See Also
getRGBdefault, filterRGBPixels


 RGBImageFilter.substituteColorModel

RGBImageFilter.substituteColorModel

Syntax
public void substituteColorModel( ColorModel oldcm, ColorModel newcm )
Parameters
oldcm
the ColorModel object to be replaced on the fly
newcm
the ColorModel object to replace oldcm on the fly
Description
Registers two ColorModel objects for substitution. If the oldcm is encountered during any of the setPixels methods, the newcm is substituted and the pixels passed through untouched (but with the new ColorModel object).


 Class ReplicateScaleFilter

Class java.awt.image.ReplicateScaleFilter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.awt.image.ImageFilter
           |
           +----java.awt.image.ReplicateScaleFilter

public class ReplicateScaleFilter
extends ImageFilter

An ImageFilter class for scaling images using the simplest algorithm. This class extends the basic ImageFilter Class to scale an existing image and provide a source for a new image containing the resampled image. The pixels in the source image are sampled to produce pixels for an image of the specified size by replicating rows and columns of pixels to scale up or omitting rows and columns of pixels to scale down. It is meant to be used in conjunction with a FilteredImageSource object to produce scaled versions of existing images.

See Also:
FilteredImageSource, ImageFilter


 ReplicateScaleFilter Members

ReplicateScaleFilter Members

Class Overview | This Package | All Packages

Fields
Name | Description
destHeight |
destWidth |
outpixbuf |
srccols |
srcHeight |
srcrows |
srcWidth |

Constructors
Name | Description
ReplicateScaleFilter(int, int) | Constructs a ReplicateScaleFilter that scales the pixels from its source Image as specified by the width and height parameters.

Methods
Name | Description
setDimensions(int, int) | Override the dimensions of the source image and pass the dimensions of the new scaled size to the ImageConsumer.
setPixels(int, int, int, int, ColorModel, byte[], int, int) | Choose which rows and columns of the delivered byte pixels are needed for the destination scaled image and pass through just those rows and columns that are needed, replicated as necessary.
setPixels(int, int, int, int, ColorModel, int[], int, int) | Choose which rows and columns of the delivered int pixels are needed for the destination scaled image and pass through just those rows and columns that are needed, replicated as necessary.
setProperties(Hashtable) | Passes along the properties from the source object after adding a property indicating the scale applied.


 ReplicateScaleFilter.destHeight

ReplicateScaleFilter.destHeight

Syntax
protected int destHeight


 ReplicateScaleFilter.destWidth

ReplicateScaleFilter.destWidth

Syntax
protected int destWidth


 ReplicateScaleFilter.outpixbuf

ReplicateScaleFilter.outpixbuf

Syntax
protected Object outpixbuf


 ReplicateScaleFilter.srccols

ReplicateScaleFilter.srccols

Syntax
protected int srccols[]


 ReplicateScaleFilter.srcHeight

ReplicateScaleFilter.srcHeight

Syntax
protected int srcHeight


 ReplicateScaleFilter.srcrows

ReplicateScaleFilter.srcrows

Syntax
protected int srcrows[]


 ReplicateScaleFilter.srcWidth

ReplicateScaleFilter.srcWidth

Syntax
protected int srcWidth


 ReplicateScaleFilter.ReplicateScaleFilter

ReplicateScaleFilter.ReplicateScaleFilter

Syntax
public ReplicateScaleFilter( int width, int height )
Parameters
width
the target width to scale the image
height
the target height to scale the image
Description
Constructs a ReplicateScaleFilter that scales the pixels from its source Image as specified by the width and height parameters.


 ReplicateScaleFilter.setDimensions

ReplicateScaleFilter.setDimensions

Syntax
public void setDimensions( int w, int h )
Description
Override the dimensions of the source image and pass the dimensions of the new scaled size to the ImageConsumer.

Overrides
setDimensions in class ImageFilter
See Also
ImageConsumer


 ReplicateScaleFilter.setPixels

ReplicateScaleFilter.setPixels

Syntax 1
public void setPixels( int x, int y, int w, int h, ColorModel model, byte pixels[], int off, int scansize )
Description
Choose which rows and columns of the delivered byte pixels are needed for the destination scaled image and pass through just those rows and columns that are needed, replicated as necessary.

Overrides
setPixels in class ImageFilter

Syntax 2
public void setPixels( int x, int y, int w, int h, ColorModel model, int pixels[], int off, int scansize )
Description
Choose which rows and columns of the delivered int pixels are needed for the destination scaled image and pass through just those rows and columns that are needed, replicated as necessary.

Overrides
setPixels in class ImageFilter


 ReplicateScaleFilter.setProperties

ReplicateScaleFilter.setProperties

Syntax
public void setProperties( Hashtable props )
Description
Passes along the properties from the source object after adding a property indicating the scale applied.

Overrides
setProperties in class ImageFilter


 Package java.beans

Package java.beans

All Packages

Interfaces

  • BeanInfo
  • Customizer
  • PropertyChangeListener
  • PropertyEditor
  • VetoableChangeListener
  • Visibility

    • Classes

  • BeanDescriptor
  • Beans
  • EventSetDescriptor
  • FeatureDescriptor
  • IndexedPropertyDescriptor
  • Introspector
  • MethodDescriptor
  • ParameterDescriptor
  • PropertyChangeEvent
  • PropertyChangeSupport
  • PropertyDescriptor
  • PropertyEditorManager
  • PropertyEditorSupport
  • SimpleBeanInfo
  • VetoableChangeSupport

    • Exceptions

  • IntrospectionException
  • PropertyVetoException


 Class BeanDescriptor

Class java.beans.BeanDescriptor

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.beans.FeatureDescriptor
           |
           +----java.beans.BeanDescriptor

public class BeanDescriptor
extends FeatureDescriptor

A BeanDescriptor provides global information about a "bean", including its Java class, its displayName, etc.

This is one of the kinds of descriptor returned by a BeanInfo object, which also returns descriptors for properties, method, and events.


 BeanDescriptor Members

BeanDescriptor Members

Class Overview | This Package | All Packages

Constructors
Name | Description
BeanDescriptor(Class) | Create a BeanDescriptor for a bean that doesn't have a customizer.
BeanDescriptor(Class, Class) | Create a BeanDescriptor for a bean that has a customizer.

Methods
Name | Description
getBeanClass() |
getCustomizerClass() |


 BeanDescriptor.BeanDescriptor

BeanDescriptor.BeanDescriptor

Syntax 1
public BeanDescriptor( Class beanClass )
Parameters
beanClass
The Class object of the Java class that implements the bean. For example sun.beans.OurButton.class.
Description
Create a BeanDescriptor for a bean that doesn't have a customizer.

Syntax 2
public BeanDescriptor( Class beanClass, Class customizerClass )
Parameters
beanClass
The Class object of the Java class that implements the bean. For example sun.beans.OurButton.class.
customizerClass
The Class object of the Java class that implements the bean's Customizer. For example sun.beans.OurButtonCustomizer.class.
Description
Create a BeanDescriptor for a bean that has a customizer.


 BeanDescriptor.getBeanClass

BeanDescriptor.getBeanClass

Syntax
public Class getBeanClass()
Returns
The Class object for the bean.


 BeanDescriptor.getCustomizerClass

BeanDescriptor.getCustomizerClass

Syntax
public Class getCustomizerClass()
Returns
The Class object for the bean's customizer. This may be null if the bean doesn't have a customizer.


 Interface BeanInfo

Interface java.beans.BeanInfo

Interface Members | This Package | All Packages

public interface BeanInfo

A bean implementor who wishes to provide explicit information about their bean may provide a BeanInfo class that implements this BeanInfo interface and provides explicit information about the methods, properties, events, etc, of their bean.

A bean implementor doesn't need to provide a complete set of explicit information. You can pick and choose which information you want to provide and the rest will be obtained by automatic analysis using low-level reflection of the bean classes' methods and applying standard design patterns.

You get the opportunity to provide lots and lots of different information as part of the various XyZDescriptor classes. But don't panic, you only really need to provide the minimal core information required by the various constructors.

See also the SimpleBeanInfo class which provides a convenient "noop" base class for BeanInfo classes, which you can override for those specific places where you want to return explicit info.

To learn about all the behaviour of a bean see the Introspector class.


 BeanInfo Members

BeanInfo Members

Interface Overview | This Package | All Packages

Fields
Name | Description
ICON_COLOR_16x16 | Constant to indicate a 16 x 16 color icon.
ICON_COLOR_32x32 | Constant to indicate a 32 x 32 color icon.
ICON_MONO_16x16 | Constant to indicate a 16 x 16 monochrome icon.
ICON_MONO_32x32 | Constant to indicate a 32 x 32 monochrome icon.

Methods
Name | Description
getAdditionalBeanInfo() | This method allows a BeanInfo object to return an arbitrary collection of other BeanInfo objects that provide additional information on the current bean.
getBeanDescriptor() |
getDefaultEventIndex() | A bean may have a "default" event that is the event that will mostly commonly be used by human's when using the bean.
getDefaultPropertyIndex() | A bean may have a "default" property that is the property that will mostly commonly be initially chosen for update by human's who are customizing the bean.
getEventSetDescriptors() |
getIcon(int) | This method returns an image object that can be used to represent the bean in toolboxes, toolbars, etc.
getMethodDescriptors() |
getPropertyDescriptors() |


 BeanInfo.ICON_COLOR_16x16

BeanInfo.ICON_COLOR_16x16

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int ICON_COLOR_16x16
Description
Constant to indicate a 16 x 16 color icon.


 BeanInfo.ICON_COLOR_32x32

BeanInfo.ICON_COLOR_32x32

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int ICON_COLOR_32x32
Description
Constant to indicate a 32 x 32 color icon.


 BeanInfo.ICON_MONO_16x16

BeanInfo.ICON_MONO_16x16

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int ICON_MONO_16x16
Description
Constant to indicate a 16 x 16 monochrome icon.


 BeanInfo.ICON_MONO_32x32

BeanInfo.ICON_MONO_32x32

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int ICON_MONO_32x32
Description
Constant to indicate a 32 x 32 monochrome icon.


 BeanInfo.getAdditionalBeanInfo

BeanInfo.getAdditionalBeanInfo

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract BeanInfo[] getAdditionalBeanInfo()
Returns
an array of BeanInfo objects. May return null.
Description
This method allows a BeanInfo object to return an arbitrary collection of other BeanInfo objects that provide additional information on the current bean.

If there are conflicts or overlaps between the information provided by different BeanInfo objects, then the current BeanInfo takes precedence over the getAdditionalBeanInfo objects, and later elements in the array take precedence over earlier ones.


 BeanInfo.getBeanDescriptor

BeanInfo.getBeanDescriptor

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract BeanDescriptor getBeanDescriptor()
Returns
A BeanDescriptor providing overall information about the bean, such as its displayName, its customizer, etc. May return null if the information should be obtained by automatic analysis.


 BeanInfo.getDefaultEventIndex

BeanInfo.getDefaultEventIndex

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getDefaultEventIndex()
Returns
Index of default event in the EventSetDescriptor array returned by getEventSetDescriptors.

Returns -1 if there is no default event.

Description
A bean may have a "default" event that is the event that will mostly commonly be used by human's when using the bean.


 BeanInfo.getDefaultPropertyIndex

BeanInfo.getDefaultPropertyIndex

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getDefaultPropertyIndex()
Returns
Index of default property in the PropertyDescriptor array returned by getPropertyDescriptors.

Returns -1 if there is no default property.

Description
A bean may have a "default" property that is the property that will mostly commonly be initially chosen for update by human's who are customizing the bean.


 BeanInfo.getEventSetDescriptors

BeanInfo.getEventSetDescriptors

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract EventSetDescriptor[] getEventSetDescriptors()
Returns
An array of EventSetDescriptors describing the kinds of events fired by this bean. May return null if the information should be obtained by automatic analysis.


 BeanInfo.getIcon

BeanInfo.getIcon

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Image getIcon( int iconKind )
Parameters
iconKind
The kind of icon requested. This should be one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, ICON_MONO_16x16, or ICON_MONO_32x32.
Returns
An image object representing the requested icon. May return null if no suitable icon is available.
Description
This method returns an image object that can be used to represent the bean in toolboxes, toolbars, etc. Icon images will typically be GIFs, but may in future include other formats.

Beans aren't required to provide icons and may return null from this method.

There are four possible flavors of icons (16x16 color, 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only support a single icon we recommend supporting 16x16 color.

We recommend that icons have a "transparent" background so they can be rendered onto an existing background.


 BeanInfo.getMethodDescriptors

BeanInfo.getMethodDescriptors

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract MethodDescriptor[] getMethodDescriptors()
Returns
An array of MethodDescriptors describing the externally visible methods supported by this bean. May return null if the information should be obtained by automatic analysis.


 BeanInfo.getPropertyDescriptors

BeanInfo.getPropertyDescriptors

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract PropertyDescriptor[] getPropertyDescriptors()
Returns
An array of PropertyDescriptors describing the editable properties supported by this bean. May return null if the information should be obtained by automatic analysis.

If a property is indexed, then its entry in the result array will belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. A client of getPropertyDescriptors can use "instanceof" to check if a given PropertyDescriptor is an IndexedPropertyDescriptor.


 Class Beans

Class java.beans.Beans

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.beans.Beans

public class Beans
extends Object

This class provides some general purpose beans control methods.


 Beans Members

Beans Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Beans() |

Methods
Name | Description
getInstanceOf(Object, Class) | From a given bean, obtain an object representing a specified type view of that source object.
instantiate(ClassLoader, String) | Instantiate a bean.
isDesignTime() | Test if we are in design-mode.
isGuiAvailable() |
isInstanceOf(Object, Class) | Check if a bean can be viewed as a given target type.
setDesignTime(boolean) | Used to indicate whether of not we are running in an application builder environment.
setGuiAvailable(boolean) | Used to indicate whether of not we are running in an environment where GUI interaction is available.


 Beans.Beans

Beans.Beans

Syntax
public Beans()


 Beans.getInstanceOf

Beans.getInstanceOf

Syntax
public static Object getInstanceOf( Object bean, Class targetType )
Parameters
obj
Object from which we want to obtain a view.
targetType
The type of view we'd like to get.
Description
From a given bean, obtain an object representing a specified type view of that source object.

The result may be the same object or a different object. If the requested target view isn't available then the given bean is returned.

This method is provided in Beans 1.0 as a hook to allow the addition of more flexible bean behaviour in the future.


 Beans.instantiate

Beans.instantiate

Syntax
public static Object instantiate( ClassLoader cls, String beanName ) throws IOException, ClassNotFoundException
Parameters
classLoader
the class-loader from which we should create the bean. If this is null, then the system class-loader is used.
beanName
the name of the bean within the class-loader. For example "sun.beanbox.foobah"
Description
Instantiate a bean.

The bean is created based on a name relative to a class-loader. This name should be a dot-separated name such as "a.b.c".

In Beans 1.0 the given name can indicate either a serialized object or a class. Other mechanisms may be added in the future. In beans 1.0 we first try to treat the beanName as a serialized object name then as a class name.

When using the beanName as a serialized object name we convert the given beanName to a resource pathname and add a trailing ".ser" suffix. We then try to load a serialized object from that resource.

For example, given a beanName of "x.y", Beans.instantiate would first try to read a serialized object from the resource "x/y.ser" and if that failed it would try to load the class "x.y" and create an instance of that class.

If the bean is a subtype of java.applet.Applet, then it is given some special initialization. First, it is supplied with a default AppletStub and AppletContext. Second, if it was instantiated from a classname the applet's "init" method is called. (If the bean was deserialized this step is skipped.)

Note that for beans which are applets, it is the caller's responsiblity to call "start" on the applet. For correct behaviour, this should be done after the applet has been added into a visible AWT container.

Note that applets created via beans.instantiate run in a slightly different environment than applets running inside browsers. In particular, bean applets have no access to "parameters", so they may wish to provide property get/set methods to set parameter values. We advise bean-applet developers to test their bean-applets against both the JDK appletviewer (for a reference browser environment) and the BDK BeanBox (for a reference bean container).

Exceptions
ClassNotFoundException if the class of a serialized object could not be found.
Exceptions
IOException if an I/O error occurs.


 Beans.isDesignTime

Beans.isDesignTime

Syntax
public static boolean isDesignTime()
Returns
True if we are running in an application construction environment.
Description
Test if we are in design-mode.


 Beans.isGuiAvailable

Beans.isGuiAvailable

Syntax
public static boolean isGuiAvailable()
Returns
True if we are running in an environment where beans can assume that an interactive GUI is available, so they can pop up dialog boxes, etc. This will normally return true in a windowing environment, and will normally return false in a server environment or if an application is running as part of a batch job.


 Beans.isInstanceOf

Beans.isInstanceOf

Syntax
public static boolean isInstanceOf( Object bean, Class targetType )
Parameters
bean
Bean from which we want to obtain a view.
targetType
The type of view we'd like to get.
Returns
"true" if the given bean supports the given targetType.
Description
Check if a bean can be viewed as a given target type. The result will be true if the Beans.getInstanceof method can be used on the given bean to obtain an object that represents the specified targetType type view.


 Beans.setDesignTime

Beans.setDesignTime

Syntax
public static void setDesignTime( boolean isDesignTime ) throws SecurityException
Parameters
isDesignTime
True if we're in an application builder tool.
Description
Used to indicate whether of not we are running in an application builder environment. Note that this method is security checked and is not available to (for example) untrusted applets.


 Beans.setGuiAvailable

Beans.setGuiAvailable

Syntax
public static void setGuiAvailable( boolean isGuiAvailable ) throws SecurityException
Parameters
isGuiAvailable
True if GUI interaction is available.
Description
Used to indicate whether of not we are running in an environment where GUI interaction is available. Note that this method is security checked and is not available to (for example) untrusted applets.


 Interface Customizer

Interface java.beans.Customizer

Interface Members | This Package | All Packages

public interface Customizer

A customizer class provides a complete custom GUI for customizing a target Java Bean.

Each customizer should inherit from the java.awt.Component class so it can be instantiated inside an AWT dialog or panel.

Each customizer should have a null constructor.


 Customizer Members

Customizer Members

Interface Overview | This Package | All Packages

Methods
Name | Description
addPropertyChangeListener(PropertyChangeListener) | Register a listener for the PropertyChange event.
removePropertyChangeListener(PropertyChangeListener) | Remove a listener for the PropertyChange event.
setObject(Object) | Set the object to be customized.


 Customizer.addPropertyChangeListener

Customizer.addPropertyChangeListener

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void addPropertyChangeListener( PropertyChangeListener listener )
Parameters
listener
An object to be invoked when a PropertyChange event is fired.
Description
Register a listener for the PropertyChange event. The customizer should fire a PropertyChange event whenever it changes the target bean in a way that might require the displayed properties to be refreshed.


 Customizer.removePropertyChangeListener

Customizer.removePropertyChangeListener

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void removePropertyChangeListener( PropertyChangeListener listener )
Parameters
listener
The PropertyChange listener to be removed.
Description
Remove a listener for the PropertyChange event.


 Customizer.setObject

Customizer.setObject

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setObject( Object bean )
Parameters
bean
The object to be customized.
Description
Set the object to be customized. This method should be called only once, before the Customizer has been added to any parent AWT container.


 Class EventSetDescriptor

Class java.beans.EventSetDescriptor

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.beans.FeatureDescriptor
           |
           +----java.beans.EventSetDescriptor

public class EventSetDescriptor
extends FeatureDescriptor

An EventSetDescriptor describes a group of events that a given Java bean fires.

The given group of events are all delivered as method calls on a single event listener interface, and an event listener object can be registered via a call on a registration method supplied by the event source.


 EventSetDescriptor Members

EventSetDescriptor Members

Class Overview | This Package | All Packages

Constructors
Name | Description
EventSetDescriptor(Class, String, Class, String) | This constructor creates an EventSetDescriptor assuming that you are following the most simple standard design pattern where a named event "fred" is (1) delivered as a call on the single method of interface FredListener, (2) has a single argument of type FredEvent, and (3) where the FredListener may be registered with a call on an addFredListener method of the source component and removed with a call on a removeFredListener method.
EventSetDescriptor(Class, String, Class, String[], String, String) | This constructor creates an EventSetDescriptor from scratch using string names.
EventSetDescriptor(String, Class, Method[], Method, Method) | This constructor creates an EventSetDescriptor from scratch using java.lang.reflect.Method and java.lang.Class objects.
EventSetDescriptor(String, Class, MethodDescriptor[], Method, Method) | This constructor creates an EventSetDescriptor from scratch using java.lang.reflect.MethodDescriptor and java.lang.Class objects.

Methods
Name | Description
getAddListenerMethod() |
getListenerMethodDescriptors() |
getListenerMethods() |
getListenerType() |
getRemoveListenerMethod() |
isInDefaultEventSet() | Report if an event set is in the "default set".
isUnicast() | Normally event sources are multicast.
setInDefaultEventSet(boolean) | Mark an event set as being in the "default" set (or not).
setUnicast(boolean) | Mark an event set as unicast (or not).


 EventSetDescriptor.EventSetDescriptor

EventSetDescriptor.EventSetDescriptor

Syntax 1
public EventSetDescriptor( Class sourceClass, String eventSetName, Class listenerType, String listenerMethodName ) throws IntrospectionException
Parameters
sourceClass
The class firing the event.
eventSetName
The programmatic name of the event. E.g. "fred". Note that this should normally start with a lower-case character.
listenerType
The target interface that events will get delivered to.
listenerMethodName
The method that will get called when the event gets delivered to its target listener interface.
Description
This constructor creates an EventSetDescriptor assuming that you are following the most simple standard design pattern where a named event "fred" is (1) delivered as a call on the single method of interface FredListener, (2) has a single argument of type FredEvent, and (3) where the FredListener may be registered with a call on an addFredListener method of the source component and removed with a call on a removeFredListener method.

Exceptions
IntrospectionException if an exception occurs during introspection.

Syntax 2
public EventSetDescriptor( Class sourceClass, String eventSetName, Class listenerType, String listenerMethodNames[], String addListenerMethodName, String removeListenerMethodName ) throws IntrospectionException
Parameters
sourceClass
The class firing the event.
eventSetName
The programmatic name of the event set. Note that this should normally start with a lower-case character.
listenerType
The Class of the target interface that events will get delivered to.
listenerMethodNames
The names of the methods that will get called when the event gets delivered to its target listener interface.
addListenerMethodName
The name of the method on the event source that can be used to register an event listener object.
removeListenerMethodName
The name of the method on the event source that can be used to de-register an event listener object.
Description
This constructor creates an EventSetDescriptor from scratch using string names.

Exceptions
IntrospectionException if an exception occurs during introspection.

Syntax 3
public EventSetDescriptor( String eventSetName, Class listenerType, Method listenerMethods[], Method addListenerMethod, Method removeListenerMethod ) throws IntrospectionException
Parameters
eventSetName
The programmatic name of the event set.
listenerType
The Class for the listener interface.
listenerMethods
An array of Method objects describing each of the event handling methods in the target listener.
addListenerMethod
The method on the event source that can be used to register an event listener object.
removeListenerMethod
The method on the event source that can be used to de-register an event listener object.
Description
This constructor creates an EventSetDescriptor from scratch using java.lang.reflect.Method and java.lang.Class objects.

Exceptions
IntrospectionException if an exception occurs during introspection.

Syntax 4
public EventSetDescriptor( String eventSetName, Class listenerType, MethodDescriptor listenerMethodDescriptors[], Method addListenerMethod, Method removeListenerMethod ) throws IntrospectionException
Parameters
eventSetName
The programmatic name of the event set.
listenerType
The Class for the listener interface.
listenerMethodDescriptors
An array of MethodDescriptor objects describing each of the event handling methods in the target listener.
addListenerMethod
The method on the event source that can be used to register an event listener object.
removeListenerMethod
The method on the event source that can be used to de-register an event listener object.
Description
This constructor creates an EventSetDescriptor from scratch using java.lang.reflect.MethodDescriptor and java.lang.Class objects.

Exceptions
IntrospectionException if an exception occurs during introspection.


 EventSetDescriptor.getAddListenerMethod

EventSetDescriptor.getAddListenerMethod

Syntax
public Method getAddListenerMethod()
Returns
The method used to register a listener at the event source.


 EventSetDescriptor.getListenerMethodDescriptors

EventSetDescriptor.getListenerMethodDescriptors

Syntax
public MethodDescriptor[] getListenerMethodDescriptors()
Returns
An array of MethodDescriptor objects for the target methods within the target listener interface that will get called when events are fired.


 EventSetDescriptor.getListenerMethods

EventSetDescriptor.getListenerMethods

Syntax
public Method[] getListenerMethods()
Returns
An array of Method objects for the target methods within the target listener interface that will get called when events are fired.


 EventSetDescriptor.getListenerType

EventSetDescriptor.getListenerType

Syntax
public Class getListenerType()
Returns
The Class object for the target interface that will get invoked when the event is fired.


 EventSetDescriptor.getRemoveListenerMethod

EventSetDescriptor.getRemoveListenerMethod

Syntax
public Method getRemoveListenerMethod()
Returns
The method used to register a listener at the event source.


 EventSetDescriptor.isInDefaultEventSet

EventSetDescriptor.isInDefaultEventSet

Syntax
public boolean isInDefaultEventSet()
Returns
True if the event set is in the "default set". Defaults to "true".
Description
Report if an event set is in the "default set".


 EventSetDescriptor.isUnicast

EventSetDescriptor.isUnicast

Syntax
public boolean isUnicast()
Returns
True if the event set is unicast. Defaults to "false".
Description
Normally event sources are multicast. However there are some exceptions that are strictly unicast.


 EventSetDescriptor.setInDefaultEventSet

EventSetDescriptor.setInDefaultEventSet

Syntax
public void setInDefaultEventSet( boolean inDefaultEventSet )
Parameters
unicast
True if the event set is unicast.
Description
Mark an event set as being in the "default" set (or not). By default this is true.


 EventSetDescriptor.setUnicast

EventSetDescriptor.setUnicast

Syntax
public void setUnicast( boolean unicast )
Parameters
unicast
True if the event set is unicast.
Description
Mark an event set as unicast (or not).


 Class FeatureDescriptor

Class java.beans.FeatureDescriptor

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.beans.FeatureDescriptor

public class FeatureDescriptor
extends Object

The FeatureDescriptor class is the common baseclass for PropertyDescriptor, EventSetDescriptor, and MethodDescriptor, etc.

It supports some common information that can be set and retrieved for any of the introspection descriptors.

In addition it provides an extension mechanism so that arbitrary attribute/value pairs can be associated with a design feature.


 FeatureDescriptor Members

FeatureDescriptor Members

Class Overview | This Package | All Packages

Constructors
Name | Description
FeatureDescriptor() |

Methods
Name | Description
attributeNames() |
getDisplayName() |
getName() |
getShortDescription() |
getValue(String) | Retrieve a named attribute with this feature.
isExpert() | The "expert" flag is used to distinguish between those features that are intended for expert users from those that are intended for normal users.
isHidden() | The "hidden" flag is used to identify features that are intended only for tool use, and which should not be exposed to humans.
setDisplayName(String) |
setExpert(boolean) | The "expert" flag is used to distinguish between features that are intended for expert users from those that are intended for normal users.
setHidden(boolean) | The "hidden" flag is used to identify features that are intended only for tool use, and which should not be exposed to humans.
setName(String) |
setShortDescription(String) | You can associate a short descriptive string with a feature.
setValue(String, Object) | Associate a named attribute with this feature.


 FeatureDescriptor.FeatureDescriptor

FeatureDescriptor.FeatureDescriptor

Syntax
public FeatureDescriptor()


 FeatureDescriptor.attributeNames

FeatureDescriptor.attributeNames

Syntax
public Enumeration attributeNames()
Returns
An enumeration of the locale-independent names of any attributes that have been registered with setValue.


 FeatureDescriptor.getDisplayName

FeatureDescriptor.getDisplayName

Syntax
public String getDisplayName()
Returns
The localized display name for the property/method/event. This defaults to the same as its programmatic name from getName.


 FeatureDescriptor.getName

FeatureDescriptor.getName

Syntax
public String getName()
Returns
The programmatic name of the property/method/event


 FeatureDescriptor.getShortDescription

FeatureDescriptor.getShortDescription

Syntax
public String getShortDescription()
Returns
A localized short description associated with this property/method/event. This defaults to be the display name.


 FeatureDescriptor.getValue

FeatureDescriptor.getValue

Syntax
public Object getValue( String attributeName )
Parameters
attributeName
The locale-independent name of the attribute
Returns
The value of the attribute. May be null if the attribute is unknown.
Description
Retrieve a named attribute with this feature.


 FeatureDescriptor.isExpert

FeatureDescriptor.isExpert

Syntax
public boolean isExpert()
Returns
True if this feature is intended for use by experts only.
Description
The "expert" flag is used to distinguish between those features that are intended for expert users from those that are intended for normal users.


 FeatureDescriptor.isHidden

FeatureDescriptor.isHidden

Syntax
public boolean isHidden()
Returns
True if this feature should be hidden from human users.
Description
The "hidden" flag is used to identify features that are intended only for tool use, and which should not be exposed to humans.


 FeatureDescriptor.setDisplayName

FeatureDescriptor.setDisplayName

Syntax
public void setDisplayName( String displayName )
Parameters
displayName
The localized display name for the property/method/event.


 FeatureDescriptor.setExpert

FeatureDescriptor.setExpert

Syntax
public void setExpert( boolean expert )
Parameters
expert
True if this feature is intended for use by experts only.
Description
The "expert" flag is used to distinguish between features that are intended for expert users from those that are intended for normal users.


 FeatureDescriptor.setHidden

FeatureDescriptor.setHidden

Syntax
public void setHidden( boolean hidden )
Parameters
hidden
True if this feature should be hidden from human users.
Description
The "hidden" flag is used to identify features that are intended only for tool use, and which should not be exposed to humans.


 FeatureDescriptor.setName

FeatureDescriptor.setName

Syntax
public void setName( String name )
Parameters
name
The programmatic name of the property/method/event


 FeatureDescriptor.setShortDescription

FeatureDescriptor.setShortDescription

Syntax
public void setShortDescription( String text )
Parameters
text
A (localized) short description to be associated with this property/method/event.
Description
You can associate a short descriptive string with a feature. Normally these descriptive strings should be less than about 40 characters.


 FeatureDescriptor.setValue

FeatureDescriptor.setValue

Syntax
public void setValue( String attributeName, Object value )
Parameters
attributeName
The locale-independent name of the attribute
value
The value.
Description
Associate a named attribute with this feature.


 Class IndexedPropertyDescriptor

Class java.beans.IndexedPropertyDescriptor

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.beans.FeatureDescriptor
           |
           +----java.beans.PropertyDescriptor
                   |
                   +----java.beans.IndexedPropertyDescriptor

public class IndexedPropertyDescriptor
extends PropertyDescriptor

An IndexedPropertyDescriptor describes a property that acts like an array and has an indexed read and/or indexed write method to access specific elements of the array.

An indexed property may also provide simple non-indexed read and write methods. If these are present, they read and write arrays of the type returned by the indexed read method.


 IndexedPropertyDescriptor Members

IndexedPropertyDescriptor Members

Class Overview | This Package | All Packages

Constructors
Name | Description
IndexedPropertyDescriptor(String, Class) | This constructor constructs an IndexedPropertyDescriptor for a property that follows the standard Java conventions by having getFoo and setFoo accessor methods, for both indexed access and array access.
IndexedPropertyDescriptor(String, Class, String, String, String, String) | This constructor takes the name of a simple property, and method names for reading and writing the property, both indexed and non-indexed.
IndexedPropertyDescriptor(String, Method, Method, Method, Method) | This constructor takes the name of a simple property, and Method objects for reading and writing the property.

Methods
Name | Description
getIndexedPropertyType() |
getIndexedReadMethod() |
getIndexedWriteMethod() |


 IndexedPropertyDescriptor.IndexedPropertyDescriptor

IndexedPropertyDescriptor.IndexedPropertyDescriptor

Syntax 1
public IndexedPropertyDescriptor( String propertyName, Class beanClass ) throws IntrospectionException
Parameters
propertyName
The programmatic name of the property.
beanClass
The Class object for the target bean.
Description
This constructor constructs an IndexedPropertyDescriptor for a property that follows the standard Java conventions by having getFoo and setFoo accessor methods, for both indexed access and array access.

Thus if the argument name is "fred", it will assume that there is an indexed reader method "getFred", a non-indexed (array) reader method also called "getFred", an indexed writer method "setFred", and finally a non-indexed writer method "setFred".

Exceptions
IntrospectionException if an exception occurs during introspection.

Syntax 2
public IndexedPropertyDescriptor( String propertyName, Class beanClass, String getterName, String setterName, String indexedGetterName, String indexedSetterName ) throws IntrospectionException
Parameters
propertyName
The programmatic name of the property.
beanClass
The Class object for the target bean.
getterName
The name of the method used for reading the property values as an array. May be null if the property is write-only or must be indexed.
setterName
The name of the method used for writing the property values as an array. May be null if the property is read-only or must be indexed.
indexedGetterName
The name of the method used for reading an indexed property value. May be null if the property is write-only.
indexedSetterName
The name of the method used for writing an indexed property value. May be null if the property is read-only.
Description
This constructor takes the name of a simple property, and method names for reading and writing the property, both indexed and non-indexed.

Exceptions
IntrospectionException if an exception occurs during introspection.

Syntax 3
public IndexedPropertyDescriptor( String propertyName, Method getter, Method setter, Method indexedGetter, Method indexedSetter ) throws IntrospectionException
Parameters
propertyName
The programmatic name of the property.
getter
The method used for reading the property values as an array. May be null if the property is write-only or must be indexed.
setter
The method used for writing the property values as an array. May be null if the property is read-only or must be indexed.
indexedGetter
The method used for reading an indexed property value. May be null if the property is write-only.
indexedSetter
The method used for writing an indexed property value. May be null if the property is read-only.
Description
This constructor takes the name of a simple property, and Method objects for reading and writing the property.

Exceptions
IntrospectionException if an exception occurs during introspection.


 IndexedPropertyDescriptor.getIndexedPropertyType

IndexedPropertyDescriptor.getIndexedPropertyType

Syntax
public Class getIndexedPropertyType()
Returns
The Java Class for the indexed properties type. Note that the Class may describe a primitive Java type such as "int".

This is the type that will be returned by the indexedReadMethod.


 IndexedPropertyDescriptor.getIndexedReadMethod

IndexedPropertyDescriptor.getIndexedReadMethod

Syntax
public Method getIndexedReadMethod()
Returns
The method that should be used to read an indexed property value. May return null if the property isn't indexed or is write-only.


 IndexedPropertyDescriptor.getIndexedWriteMethod

IndexedPropertyDescriptor.getIndexedWriteMethod

Syntax
public Method getIndexedWriteMethod()
Returns
The method that should be used to write an indexed property value. May return null if the property isn't indexed or is read-only.


 Class IntrospectionException

Class java.beans.IntrospectionException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.beans.IntrospectionException

public class IntrospectionException
extends Exception

Thrown when an exception happens during Introspection.

Typical causes include not being able to map a string class name to a Class object, not being able to resolve a string method name, or specifying a method name that has the wrong type signature for its intended use.


 IntrospectionException Members

IntrospectionException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
IntrospectionException(String) |


 IntrospectionException.IntrospectionException

IntrospectionException.IntrospectionException

Syntax
public IntrospectionException( String mess )
Parameters
mess
Descriptive message


 Class Introspector

Class java.beans.Introspector

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.beans.Introspector

public class Introspector
extends Object

The Introspector class provides a standard way for tools to learn about the properties, events, and methods supported by a target Java Bean.

For each of those three kinds of information, the Introspector will separately analyze the bean's class and superclasses looking for either explicit or implicit information and use that information to build a BeanInfo object that comprehensively describes the target bean.

For each class "Foo", explicit information may be available if there exists a corresponding "FooBeanInfo" class that provides a non-null value when queried for the information. We first look for the BeanInfo class by taking the full package-qualified name of the target bean class and appending "BeanInfo" to form a new class name. If this fails, then we take the final classname component of this name, and look for that class in each of the packages specified in the BeanInfo package search path.

Thus for a class such as "sun.xyz.OurButton" we would first look for a BeanInfo class called "sun.xyz.OurButtonBeanInfo" and if that failed we'd look in each package in the BeanInfo search path for an OurButtonBeanInfo class. With the default search path, this would mean looking for "sun.beans.infos.OurButtonBeanInfo".

If a class provides explicit BeanInfo about itself then we add that to the BeanInfo information we obtained from analyzing any derived classes, but we regard the explicit information as being definitive for the current class and its base classes, and do not proceed any further up the superclass chain.

If we don't find explicit BeanInfo on a class, we use low-level reflection to study the methods of the class and apply standard design patterns to identify property accessors, event sources, or public methods. We then proceed to analyze the class's superclass and add in the information from it (and possibly on up the superclass chain).


 Introspector Members

Introspector Members

Class Overview | This Package | All Packages

Methods
Name | Description
decapitalize(String) | Utility method to take a string and convert it to normal Java variable name capitalization.
getBeanInfo(Class) | Introspect on a Java bean and learn about all its properties, exposed methods, and events.
getBeanInfo(Class, Class) | Introspect on a Java bean and learn all about its properties, exposed methods, below a given "stop" point.
getBeanInfoSearchPath() |
setBeanInfoSearchPath(String[]) | Change the list of package names that will be used for finding BeanInfo classes.


 Introspector.decapitalize

Introspector.decapitalize

Syntax
public static String decapitalize( String name )
Parameters
name
The string to be decapitalized.
Returns
The decapitalized version of the string.
Description
Utility method to take a string and convert it to normal Java variable name capitalization. This normally means converting the first character from upper case to lower case, but in the (unusual) special case when there is more than one character and both the first and second characters are upper case, we leave it alone.

Thus "FooBah" becomes "fooBah" and "X" becomes "x", but "URL" stays as "URL".


 Introspector.getBeanInfo

Introspector.getBeanInfo

Syntax 1
public static BeanInfo getBeanInfo( Class beanClass ) throws IntrospectionException
Parameters
beanClass
The bean class to be analyzed.
Returns
A BeanInfo object describing the target bean.
Description
Introspect on a Java bean and learn about all its properties, exposed methods, and events.

Exceptions
IntrospectionException if an exception occurs during introspection.

Syntax 2
public static BeanInfo getBeanInfo( Class beanClass, Class stopClass ) throws IntrospectionException
Parameters
bean
The bean class to be analyzed.
stopClass
The baseclass at which to stop the analysis. Any methods/properties/events in the stopClass or in its baseclasses will be ignored in the analysis.
Description
Introspect on a Java bean and learn all about its properties, exposed methods, below a given "stop" point.

Exceptions
IntrospectionException if an exception occurs during introspection.


 Introspector.getBeanInfoSearchPath

Introspector.getBeanInfoSearchPath

Syntax
public static String[] getBeanInfoSearchPath()
Returns
The array of package names that will be searched in order to find BeanInfo classes.

This is initially set to {"sun.beans.infos"}.


 Introspector.setBeanInfoSearchPath

Introspector.setBeanInfoSearchPath

Syntax
public static void setBeanInfoSearchPath( String path[] )
Parameters
path
Array of package names.
Description
Change the list of package names that will be used for finding BeanInfo classes.


 Class MethodDescriptor

Class java.beans.MethodDescriptor

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.beans.FeatureDescriptor
           |
           +----java.beans.MethodDescriptor

public class MethodDescriptor
extends FeatureDescriptor

A MethodDescriptor describes a particular method that a Java Bean supports for external access from other components.


 MethodDescriptor Members

MethodDescriptor Members

Class Overview | This Package | All Packages

Constructors
Name | Description
MethodDescriptor(Method) |
MethodDescriptor(Method, ParameterDescriptor[]) |

Methods
Name | Description
getMethod() |
getParameterDescriptors() |


 MethodDescriptor.MethodDescriptor

MethodDescriptor.MethodDescriptor

Syntax 1
public MethodDescriptor( Method method )
Parameters
method
The low-level method information.

Syntax 2
public MethodDescriptor( Method method, ParameterDescriptor parameterDescriptors[] )
Parameters
method
The low-level method information.
parameterDescriptors
Descriptive information for each of the method's parameters.


 MethodDescriptor.getMethod

MethodDescriptor.getMethod

Syntax
public Method getMethod()
Returns
The low-level description of the method


 MethodDescriptor.getParameterDescriptors

MethodDescriptor.getParameterDescriptors

Syntax
public ParameterDescriptor[] getParameterDescriptors()
Returns
The locale-independent names of the parameters. May return a null array if the parameter names aren't known.


 Class ParameterDescriptor

Class java.beans.ParameterDescriptor

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.beans.FeatureDescriptor
           |
           +----java.beans.ParameterDescriptor

public class ParameterDescriptor
extends FeatureDescriptor

The ParameterDescriptor class allows bean implementors to provide additional information on each of their parameters, beyond the low level type information provided by the java.lang.reflect.Method class.

Currently all our state comes from the FeatureDescriptor base class.


 ParameterDescriptor Members

ParameterDescriptor Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ParameterDescriptor() |


 ParameterDescriptor.ParameterDescriptor

ParameterDescriptor.ParameterDescriptor

Syntax
public ParameterDescriptor()


 Class PropertyChangeEvent

Class java.beans.PropertyChangeEvent

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.EventObject
           |
           +----java.beans.PropertyChangeEvent

public class PropertyChangeEvent
extends EventObject

A "PropertyChange" event gets delivered whenever a bean changes a "bound" or "constrained" property. A PropertyChangeEvent object is sent as an argument to the PropertyChangeListener and VetoableChangeListener methods.

Normally PropertyChangeEvents are accompanied by the name and the old and new value of the changed property. If the new value is a builtin type (such as int or boolean) it must be wrapped as the corresponding java.lang.* Object type (such as Integer or Boolean).

Null values may be provided for the old and the new values if their true values are not known.

An event source may send a null object as the name to indicate that an arbitrary set of if its properties have changed. In this case the old and new values should also be null.


 PropertyChangeEvent Members

PropertyChangeEvent Members

Class Overview | This Package | All Packages

Constructors
Name | Description
PropertyChangeEvent(Object, String, Object, Object) |

Methods
Name | Description
getNewValue() |
getOldValue() |
getPropagationId() | The "propagationId" field is reserved for future use.
getPropertyName() |
setPropagationId(Object) |


 PropertyChangeEvent.PropertyChangeEvent

PropertyChangeEvent.PropertyChangeEvent

Syntax
public PropertyChangeEvent( Object source, String propertyName, Object oldValue, Object newValue )
Parameters
source
The bean that fired the event.
propertyName
The programmatic name of the property that was changed.
oldValue
The old value of the property.
newValue
The new value of the property.


 PropertyChangeEvent.getNewValue

PropertyChangeEvent.getNewValue

Syntax
public Object getNewValue()
Returns
The new value for the property, expressed as an Object. May be null if multiple properties have changed.


 PropertyChangeEvent.getOldValue

PropertyChangeEvent.getOldValue

Syntax
public Object getOldValue()
Returns
The old value for the property, expressed as an Object. May be null if multiple properties have changed.


 PropertyChangeEvent.getPropagationId

PropertyChangeEvent.getPropagationId

Syntax
public Object getPropagationId()
Returns
the propagationId object associated with a bound/constrained property update.
Description
The "propagationId" field is reserved for future use. In Beans 1.0 the sole requirement is that if a listener catches a PropertyChangeEvent and then fires a PropertyChangeEvent of its own, then it should make sure that it propagates the propagationId field from its incoming event to its outgoing event.


 PropertyChangeEvent.getPropertyName

PropertyChangeEvent.getPropertyName

Syntax
public String getPropertyName()
Returns
The programmatic name of the property that was changed. May be null if multiple properties have changed.


 PropertyChangeEvent.setPropagationId

PropertyChangeEvent.setPropagationId

Syntax
public void setPropagationId( Object propagationId )
Parameters
propagationId
The propagationId object for the event.


 Interface PropertyChangeListener

Interface java.beans.PropertyChangeListener

Interface Members | This Package | All Packages

public interface PropertyChangeListener
extends EventListener

A "PropertyChange" event gets fired whenever a bean changes a "bound" property. You can register a PropertyChangeListener with a source bean so as to be notified of any bound property updates.


 PropertyChangeListener Members

PropertyChangeListener Members

Interface Overview | This Package | All Packages

Methods
Name | Description
propertyChange(PropertyChangeEvent) | This method gets called when a bound property is changed.


 PropertyChangeListener.propertyChange

PropertyChangeListener.propertyChange

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void propertyChange( PropertyChangeEvent evt )
Parameters
evt
A PropertyChangeEvent object describing the event source and the property that has changed.
Description
This method gets called when a bound property is changed.


 Class PropertyChangeSupport

Class java.beans.PropertyChangeSupport

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.beans.PropertyChangeSupport

public class PropertyChangeSupport
extends Object
implements Serializable

This is a utility class that can be used by beans that support bound properties. You can use an instance of this class as a member field of your bean and delegate various work to it.


 PropertyChangeSupport Members

PropertyChangeSupport Members

Class Overview | This Package | All Packages

Constructors
Name | Description
PropertyChangeSupport(Object) |

Methods
Name | Description
addPropertyChangeListener(PropertyChangeListener) | Add a PropertyChangeListener to the listener list.
firePropertyChange(String, Object, Object) | Report a bound property update to any registered listeners.
removePropertyChangeListener(PropertyChangeListener) | Remove a PropertyChangeListener from the listener list.


 PropertyChangeSupport.PropertyChangeSupport

PropertyChangeSupport.PropertyChangeSupport

Syntax
public PropertyChangeSupport( Object sourceBean )


 PropertyChangeSupport.addPropertyChangeListener

PropertyChangeSupport.addPropertyChangeListener

Syntax
public synchronized void addPropertyChangeListener( PropertyChangeListener listener )
Parameters
listener
The PropertyChangeListener to be added
Description
Add a PropertyChangeListener to the listener list.


 PropertyChangeSupport.firePropertyChange

PropertyChangeSupport.firePropertyChange

Syntax
public void firePropertyChange( String propertyName, Object oldValue, Object newValue )
Parameters
propertyName
The programmatic name of the property that was changed.
oldValue
The old value of the property.
newValue
The new value of the property.
Description
Report a bound property update to any registered listeners. No event is fired if old and new are equal and non-null.


 PropertyChangeSupport.removePropertyChangeListener

PropertyChangeSupport.removePropertyChangeListener

Syntax
public synchronized void removePropertyChangeListener( PropertyChangeListener listener )
Parameters
listener
The PropertyChangeListener to be removed
Description
Remove a PropertyChangeListener from the listener list.


 Class PropertyDescriptor

Class java.beans.PropertyDescriptor

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.beans.FeatureDescriptor
           |
           +----java.beans.PropertyDescriptor

public class PropertyDescriptor
extends FeatureDescriptor

A PropertyDescriptor describes one property that a Java Bean exports via a pair of accessor methods.


 PropertyDescriptor Members

PropertyDescriptor Members

Class Overview | This Package | All Packages

Constructors
Name | Description
PropertyDescriptor(String, Class) | Constructs a PropertyDescriptor for a property that follows the standard Java convention by having getFoo and setFoo accessor methods.
PropertyDescriptor(String, Class, String, String) | This constructor takes the name of a simple property, and method names for reading and writing the property.
PropertyDescriptor(String, Method, Method) | This constructor takes the name of a simple property, and Method objects for reading and writing the property.

Methods
Name | Description
getPropertyEditorClass() |
getPropertyType() |
getReadMethod() |
getWriteMethod() |
isBound() | Updates to "bound" properties will cause a "PropertyChange" event to get fired when the property is changed.
isConstrained() | Attempted updates to "Constrained" properties will cause a "VetoableChange" event to get fired when the property is changed.
setBound(boolean) | Updates to "bound" properties will cause a "PropertyChange" event to get fired when the property is changed.
setConstrained(boolean) | Attempted updates to "Constrained" properties will cause a "VetoableChange" event to get fired when the property is changed.
setPropertyEditorClass(Class) | Normally PropertyEditors will be found using the PropertyEditorManager.


 PropertyDescriptor.PropertyDescriptor

PropertyDescriptor.PropertyDescriptor

Syntax 1
public PropertyDescriptor( String propertyName, Class beanClass ) throws IntrospectionException
Parameters
propertyName
The programmatic name of the property.
beanClass
The Class object for the target bean. For example sun.beans.OurButton.class.
Description
Constructs a PropertyDescriptor for a property that follows the standard Java convention by having getFoo and setFoo accessor methods. Thus if the argument name is "fred", it will assume that the reader method is "getFred" and the writer method is "setFred". Note that the property name should start with a lower case character, which will be capitalized in the method names.

Exceptions
IntrospectionException if an exception occurs during introspection.

Syntax 2
public PropertyDescriptor( String propertyName, Class beanClass, String getterName, String setterName ) throws IntrospectionException
Parameters
propertyName
The programmatic name of the property.
beanClass
The Class object for the target bean. For example sun.beans.OurButton.class.
getterName
The name of the method used for reading the property value. May be null if the property is write-only.
setterName
The name of the method used for writing the property value. May be null if the property is read-only.
Description
This constructor takes the name of a simple property, and method names for reading and writing the property.

Exceptions
IntrospectionException if an exception occurs during introspection.

Syntax 3
public PropertyDescriptor( String propertyName, Method getter, Method setter ) throws IntrospectionException
Parameters
propertyName
The programmatic name of the property.
getter
The method used for reading the property value. May be null if the property is write-only.
setter
The method used for writing the property value. May be null if the property is read-only.
Description
This constructor takes the name of a simple property, and Method objects for reading and writing the property.

Exceptions
IntrospectionException if an exception occurs during introspection.


 PropertyDescriptor.getPropertyEditorClass

PropertyDescriptor.getPropertyEditorClass

Syntax
public Class getPropertyEditorClass()
Returns
Any explicit PropertyEditor Class that has been registered for this property. Normally this will return "null", indicating that no special editor has been registered, so the PropertyEditorManager should be used to locate a suitable PropertyEditor.


 PropertyDescriptor.getPropertyType

PropertyDescriptor.getPropertyType

Syntax
public Class getPropertyType()
Returns
The Java type info for the property. Note that the "Class" object may describe a built-in Java type such as "int". The result may be "null" if this is an indexed property that does not support non-indexed access.

This is the type that will be returned by the ReadMethod.


 PropertyDescriptor.getReadMethod

PropertyDescriptor.getReadMethod

Syntax
public Method getReadMethod()
Returns
The method that should be used to read the property value. May return null if the property can't be read.


 PropertyDescriptor.getWriteMethod

PropertyDescriptor.getWriteMethod

Syntax
public Method getWriteMethod()
Returns
The method that should be used to write the property value. May return null if the property can't be written.


 PropertyDescriptor.isBound

PropertyDescriptor.isBound

Syntax
public boolean isBound()
Returns
True if this is a bound property.
Description
Updates to "bound" properties will cause a "PropertyChange" event to get fired when the property is changed.


 PropertyDescriptor.isConstrained

PropertyDescriptor.isConstrained

Syntax
public boolean isConstrained()
Returns
True if this is a constrained property.
Description
Attempted updates to "Constrained" properties will cause a "VetoableChange" event to get fired when the property is changed.


 PropertyDescriptor.setBound

PropertyDescriptor.setBound

Syntax
public void setBound( boolean bound )
Parameters
bound
True if this is a bound property.
Description
Updates to "bound" properties will cause a "PropertyChange" event to get fired when the property is changed.


 PropertyDescriptor.setConstrained

PropertyDescriptor.setConstrained

Syntax
public void setConstrained( boolean constrained )
Parameters
constrained
True if this is a constrained property.
Description
Attempted updates to "Constrained" properties will cause a "VetoableChange" event to get fired when the property is changed.


 PropertyDescriptor.setPropertyEditorClass

PropertyDescriptor.setPropertyEditorClass

Syntax
public void setPropertyEditorClass( Class propertyEditorClass )
Parameters
propertyEditorClass
The Class for the desired PropertyEditor.
Description
Normally PropertyEditors will be found using the PropertyEditorManager. However if for some reason you want to associate a particular PropertyEditor with a given property, then you can do it with this method.


 Interface PropertyEditor

Interface java.beans.PropertyEditor

Interface Members | This Package | All Packages

public interface PropertyEditor

A PropertyEditor class provides support for GUIs that want to allow users to edit a property value of a given type.

PropertyEditor supports a variety of different kinds of ways of displaying and updating property values. Most PropertyEditors will only need to support a subset of the different options available in this API.

Simple PropertyEditors may only support the getAsText and setAsText methods and need not support (say) paintValue or getCustomEditor. More complex types may be unable to support getAsText and setAsText but will instead support paintValue and getCustomEditor.

Every propertyEditor must support one or more of the three simple display styles. Thus it can either (1) support isPaintable or (2) both return a non-null String[] from getTags() and return a non-null value from getAsText or (3) simply return a non-null String from getAsText().

Every property editor must support a call on setValue when the argument object is of the type for which this is the corresponding propertyEditor. In addition, each property editor must either support a custom editor, or support setAsText.

Each PropertyEditor should have a null constructor.


 PropertyEditor Members

PropertyEditor Members

Interface Overview | This Package | All Packages

Methods
Name | Description
addPropertyChangeListener(PropertyChangeListener) | Register a listener for the PropertyChange event.
getAsText() |
getCustomEditor() | A PropertyEditor may choose to make available a full custom Component that edits its property value.
getJavaInitializationString() | This method is intended for use when generating Java code to set the value of the property.
getTags() | If the property value must be one of a set of known tagged values, then this method should return an array of the tags.
getValue() |
isPaintable() |
paintValue(Graphics, Rectangle) | Paint a representation of the value into a given area of screen real estate.
removePropertyChangeListener(PropertyChangeListener) | Remove a listener for the PropertyChange event.
setAsText(String) | Set the property value by parsing a given String.
setValue(Object) | Set (or change) the object that is to be edited.
supportsCustomEditor() |


 PropertyEditor.addPropertyChangeListener

PropertyEditor.addPropertyChangeListener

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void addPropertyChangeListener( PropertyChangeListener listener )
Parameters
listener
An object to be invoked when a PropertyChange event is fired.
Description
Register a listener for the PropertyChange event. When a PropertyEditor changes its value it should fire a PropertyChange event on all registered PropertyChangeListeners, specifying the null value for the property name and itself as the source.


 PropertyEditor.getAsText

PropertyEditor.getAsText

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getAsText()
Returns
The property value as a human editable string.

Returns null if the value can't be expressed as an editable string.

If a non-null value is returned, then the PropertyEditor should be prepared to parse that string back in setAsText().


 PropertyEditor.getCustomEditor

PropertyEditor.getCustomEditor

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Component getCustomEditor()
Returns
A java.awt.Component that will allow a human to directly edit the current property value. May be null if this is not supported.
Description
A PropertyEditor may choose to make available a full custom Component that edits its property value. It is the responsibility of the PropertyEditor to hook itself up to its editor Component itself and to report property value changes by firing a PropertyChange event.

The higher-level code that calls getCustomEditor may either embed the Component in some larger property sheet, or it may put it in its own individual dialog, or ...


 PropertyEditor.getJavaInitializationString

PropertyEditor.getJavaInitializationString

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getJavaInitializationString()
Returns
A fragment of Java code representing an initializer for the current value.
Description
This method is intended for use when generating Java code to set the value of the property. It should return a fragment of Java code that can be used to initialize a variable with the current property value.

Example results are "2", "new Color(127,127,34)", "Color.orange", etc.


 PropertyEditor.getTags

PropertyEditor.getTags

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String[] getTags()
Returns
The tag values for this property. May be null if this property cannot be represented as a tagged value.
Description
If the property value must be one of a set of known tagged values, then this method should return an array of the tags. This can be used to represent (for example) enum values. If a PropertyEditor supports tags, then it should support the use of setAsText with a tag value as a way of setting the value and the use of getAsText to identify the current value.


 PropertyEditor.getValue

PropertyEditor.getValue

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Object getValue()
Returns
The value of the property. Builtin types such as "int" will be wrapped as the corresponding object type such as "java.lang.Integer".


 PropertyEditor.isPaintable

PropertyEditor.isPaintable

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isPaintable()
Returns
True if the class will honor the paintValue method.


 PropertyEditor.paintValue

PropertyEditor.paintValue

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void paintValue( Graphics gfx, Rectangle box )
Parameters
gfx
Graphics object to paint into.
box
Rectangle within graphics object into which we should paint.
Description
Paint a representation of the value into a given area of screen real estate. Note that the propertyEditor is responsible for doing its own clipping so that it fits into the given rectangle.

If the PropertyEditor doesn't honor paint requests (see isPaintable) this method should be a silent noop.

The given Graphics object will have the default font, color, etc of the parent container. The PropertyEditor may change graphics attributes such as font and color and doesn't need to restore the old values.


 PropertyEditor.removePropertyChangeListener

PropertyEditor.removePropertyChangeListener

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void removePropertyChangeListener( PropertyChangeListener listener )
Parameters
listener
The PropertyChange listener to be removed.
Description
Remove a listener for the PropertyChange event.


 PropertyEditor.setAsText

PropertyEditor.setAsText

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setAsText( String text ) throws IllegalArgumentException
Parameters
text
The string to be parsed.
Description
Set the property value by parsing a given String. May raise java.lang.IllegalArgumentException if either the String is badly formatted or if this kind of property can't be expressed as text.


 PropertyEditor.setValue

PropertyEditor.setValue

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setValue( Object value )
Parameters
value
The new target object to be edited. Note that this object should not be modified by the PropertyEditor, rather the PropertyEditor should create a new object to hold any modified value.
Description
Set (or change) the object that is to be edited. Builtin types such as "int" must be wrapped as the corresponding object type such as "java.lang.Integer".


 PropertyEditor.supportsCustomEditor

PropertyEditor.supportsCustomEditor

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsCustomEditor()
Returns
True if the propertyEditor can provide a custom editor.


 Class PropertyEditorManager

Class java.beans.PropertyEditorManager

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.beans.PropertyEditorManager

public class PropertyEditorManager
extends Object

The PropertyEditorManager can be used to locate a property editor for any given type name. This property editor must support the java.beans.PropertyEditor interface for editing a given object.

The PropertyEditorManager uses three techniques for locating an editor for a given type. First, it provides a registerEditor method to allow an editor to be specifically registered for a given type. Second it tries to locate a suitable class by adding "Editor" to the full qualified classname of the given type (e.g. "foo.bah.FozEditor"). Finally it takes the simple classname (without the package name) adds "Editor" to it and looks in a search-path of packages for a matching class.

So for an input class foo.bah.Fred, the PropertyEditorManager would first look in its tables to see if an editor had been registered for foo.bah.Fred and if so use that. Then it will look for a foo.bah.FredEditor class. Then it will look for (say) standardEditorsPackage.FredEditor class.

Default PropertyEditors will be provided for the Java builtin types "boolean", "byte", "short", "int", "long", "float", and "double"; and for the classes java.lang.String. java.awt.Color, and java.awt.Font.


 PropertyEditorManager Members

PropertyEditorManager Members

Class Overview | This Package | All Packages

Constructors
Name | Description
PropertyEditorManager() |

Methods
Name | Description
findEditor(Class) | Locate a value editor for a given target type.
getEditorSearchPath() |
registerEditor(Class, Class) | Register an editor class to be used to editor values of a given target class.
setEditorSearchPath(String[]) | Change the list of package names that will be used for finding property editors.


 PropertyEditorManager.PropertyEditorManager

PropertyEditorManager.PropertyEditorManager

Syntax
public PropertyEditorManager()


 PropertyEditorManager.findEditor

PropertyEditorManager.findEditor

Syntax
public static PropertyEditor findEditor( Class targetType )
Parameters
targetType
The Class object for the type to be edited
Returns
An editor object for the given target class. The result is null if no suitable editor can be found.
Description
Locate a value editor for a given target type.


 PropertyEditorManager.getEditorSearchPath

PropertyEditorManager.getEditorSearchPath

Syntax
public static String[] getEditorSearchPath()
Returns
The array of package names that will be searched in order to find property editors.

This is initially set to {"sun.beans.editors"}.


 PropertyEditorManager.registerEditor

PropertyEditorManager.registerEditor

Syntax
public static void registerEditor( Class targetType, Class editorClass )
Parameters
targetType
the Class object of the type to be edited
editorClass
the Class object of the editor class. If this is null, then any existing definition will be removed.
Description
Register an editor class to be used to editor values of a given target class.


 PropertyEditorManager.setEditorSearchPath

PropertyEditorManager.setEditorSearchPath

Syntax
public static void setEditorSearchPath( String path[] )
Parameters
path
Array of package names.
Description
Change the list of package names that will be used for finding property editors.


 Class PropertyEditorSupport

Class java.beans.PropertyEditorSupport

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.beans.PropertyEditorSupport

public class PropertyEditorSupport
extends Object
implements PropertyEditor


 PropertyEditorSupport Members

PropertyEditorSupport Members

Class Overview | This Package | All Packages

Constructors
Name | Description
PropertyEditorSupport() | Constructor for use by derived PropertyEditor classes.
PropertyEditorSupport(Object) | Constructor for use when a PropertyEditor is delegating to us.

Methods
Name | Description
addPropertyChangeListener(PropertyChangeListener) | Register a listener for the PropertyChange event.
firePropertyChange() | Report that we have been modified to any interested listeners.
getAsText() |
getCustomEditor() | A PropertyEditor may chose to make available a full custom Component that edits its property value.
getJavaInitializationString() | This method is intended for use when generating Java code to set the value of the property.
getTags() | If the property value must be one of a set of known tagged values, then this method should return an array of the tag values.
getValue() |
isPaintable() |
paintValue(Graphics, Rectangle) | Paint a representation of the value into a given area of screen real estate.
removePropertyChangeListener(PropertyChangeListener) | Remove a listener for the PropertyChange event.
setAsText(String) | Set the property value by parsing a given String.
setValue(Object) | Set (or change) the object that is to be edited.
supportsCustomEditor() |


 PropertyEditorSupport.PropertyEditorSupport

PropertyEditorSupport.PropertyEditorSupport

Syntax 1
protected PropertyEditorSupport()
Description
Constructor for use by derived PropertyEditor classes.

Syntax 2
protected PropertyEditorSupport( Object source )
Parameters
source
The source to use for any events we fire.
Description
Constructor for use when a PropertyEditor is delegating to us.


 PropertyEditorSupport.addPropertyChangeListener

PropertyEditorSupport.addPropertyChangeListener

Syntax
public synchronized void addPropertyChangeListener( PropertyChangeListener listener )
Parameters
listener
An object to be invoked when a PropertyChange event is fired.
Description
Register a listener for the PropertyChange event. The class will fire a PropertyChange value whenever the value is updated.


 PropertyEditorSupport.firePropertyChange

PropertyEditorSupport.firePropertyChange

Syntax
public void firePropertyChange()
Parameters
source
The PropertyEditor that caused the event.
Description
Report that we have been modified to any interested listeners.


 PropertyEditorSupport.getAsText

PropertyEditorSupport.getAsText

Syntax
public String getAsText()
Returns
The property value as a string suitable for presentation to a human to edit.

Returns "null" is the value can't be expressed as a string.

If a non-null value is returned, then the PropertyEditor should be prepared to parse that string back in setAsText().


 PropertyEditorSupport.getCustomEditor

PropertyEditorSupport.getCustomEditor

Syntax
public Component getCustomEditor()
Returns
A java.awt.Component that will allow a human to directly edit the current property value. May be null if this is not supported.
Description
A PropertyEditor may chose to make available a full custom Component that edits its property value. It is the responsibility of the PropertyEditor to hook itself up to its editor Component itself and to report property value changes by firing a PropertyChange event.

The higher-level code that calls getCustomEditor may either embed the Component in some larger property sheet, or it may put it in its own individual dialog, or ...


 PropertyEditorSupport.getJavaInitializationString

PropertyEditorSupport.getJavaInitializationString

Syntax
public String getJavaInitializationString()
Returns
A fragment of Java code representing an initializer for the current value.
Description
This method is intended for use when generating Java code to set the value of the property. It should return a fragment of Java code that can be used to initialize a variable with the current property value.

Example results are "2", "new Color(127,127,34)", "Color.orange", etc.


 PropertyEditorSupport.getTags

PropertyEditorSupport.getTags

Syntax
public String[] getTags()
Returns
The tag values for this property. May be null if this property cannot be represented as a tagged value.
Description
If the property value must be one of a set of known tagged values, then this method should return an array of the tag values. This can be used to represent (for example) enum values. If a PropertyEditor supports tags, then it should support the use of setAsText with a tag value as a way of setting the value.


 PropertyEditorSupport.getValue

PropertyEditorSupport.getValue

Syntax
public Object getValue()
Returns
The value of the property.


 PropertyEditorSupport.isPaintable

PropertyEditorSupport.isPaintable

Syntax
public boolean isPaintable()
Returns
True if the class will honor the paintValue method.


 PropertyEditorSupport.paintValue

PropertyEditorSupport.paintValue

Syntax
public void paintValue( Graphics gfx, Rectangle box )
Parameters
gfx
Graphics object to paint into.
box
Rectangle within graphics object into which we should paint.
Description
Paint a representation of the value into a given area of screen real estate. Note that the propertyEditor is responsible for doing its own clipping so that it fits into the given rectangle.

If the PropertyEditor doesn't honor paint requests (see isPaintable) this method should be a silent noop.


 PropertyEditorSupport.removePropertyChangeListener

PropertyEditorSupport.removePropertyChangeListener

Syntax
public synchronized void removePropertyChangeListener( PropertyChangeListener listener )
Parameters
listener
The PropertyChange listener to be removed.
Description
Remove a listener for the PropertyChange event.


 PropertyEditorSupport.setAsText

PropertyEditorSupport.setAsText

Syntax
public void setAsText( String text ) throws IllegalArgumentException
Parameters
text
The string to be parsed.
Description
Set the property value by parsing a given String. May raise java.lang.IllegalArgumentException if either the String is badly formatted or if this kind of property can't be expressed as text.


 PropertyEditorSupport.setValue

PropertyEditorSupport.setValue

Syntax
public void setValue( Object value )
Parameters
value
The new target object to be edited. Note that this object should not be modified by the PropertyEditor, rather the PropertyEditor should create a new object to hold any modified value.
Description
Set (or change) the object that is to be edited.


 PropertyEditorSupport.supportsCustomEditor

PropertyEditorSupport.supportsCustomEditor

Syntax
public boolean supportsCustomEditor()
Returns
True if the propertyEditor can provide a custom editor.


 Class PropertyVetoException

Class java.beans.PropertyVetoException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.beans.PropertyVetoException

public class PropertyVetoException
extends Exception

A PropertyVetoException is thrown when a proposed change to a property represents an unacceptable value.


 PropertyVetoException Members

PropertyVetoException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
PropertyVetoException(String, PropertyChangeEvent) |

Methods
Name | Description
getPropertyChangeEvent() |


 PropertyVetoException.PropertyVetoException

PropertyVetoException.PropertyVetoException

Syntax
public PropertyVetoException( String mess, PropertyChangeEvent evt )
Parameters
mess
Descriptive message
evt
A PropertyChangeEvent describing the vetoed change.


 PropertyVetoException.getPropertyChangeEvent

PropertyVetoException.getPropertyChangeEvent

Syntax
public PropertyChangeEvent getPropertyChangeEvent()


 Class SimpleBeanInfo

Class java.beans.SimpleBeanInfo

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.beans.SimpleBeanInfo

public class SimpleBeanInfo
extends Object
implements BeanInfo

This is a support class to make it easier for people to provide BeanInfo classes.

It defaults to providing "noop" information, and can be selectively overriden to provide more explicit information on chosen topics. When the introspector sees the "noop" values, it will apply low level introspection and design patterns to automatically analyze the target bean.


 SimpleBeanInfo Members

SimpleBeanInfo Members

Class Overview | This Package | All Packages

Constructors
Name | Description
SimpleBeanInfo() |

Methods
Name | Description
getAdditionalBeanInfo() | Claim there are no other relevant BeanInfo objects.
getBeanDescriptor() | Deny knowledge about the class and customizer of the bean.
getDefaultEventIndex() | Deny knowledge of a default event.
getDefaultPropertyIndex() | Deny knowledge of a default property.
getEventSetDescriptors() | Deny knowledge of event sets.
getIcon(int) | Claim there are no icons available.
getMethodDescriptors() | Deny knowledge of methods.
getPropertyDescriptors() | Deny knowledge of properties.
loadImage(String) | This is a utility method to help in loading icon images.


 SimpleBeanInfo.SimpleBeanInfo

SimpleBeanInfo.SimpleBeanInfo

Syntax
public SimpleBeanInfo()


 SimpleBeanInfo.getAdditionalBeanInfo

SimpleBeanInfo.getAdditionalBeanInfo

Syntax
public BeanInfo[] getAdditionalBeanInfo()
Description
Claim there are no other relevant BeanInfo objects. You may override this if you want to (for example) return a BeanInfo for a base class.


 SimpleBeanInfo.getBeanDescriptor

SimpleBeanInfo.getBeanDescriptor

Syntax
public BeanDescriptor getBeanDescriptor()
Description
Deny knowledge about the class and customizer of the bean. You can override this if you wish to provide explicit info.


 SimpleBeanInfo.getDefaultEventIndex

SimpleBeanInfo.getDefaultEventIndex

Syntax
public int getDefaultEventIndex()
Description
Deny knowledge of a default event. You can override this if you wish to define a default event for the bean.


 SimpleBeanInfo.getDefaultPropertyIndex

SimpleBeanInfo.getDefaultPropertyIndex

Syntax
public int getDefaultPropertyIndex()
Description
Deny knowledge of a default property. You can override this if you wish to define a default property for the bean.


 SimpleBeanInfo.getEventSetDescriptors

SimpleBeanInfo.getEventSetDescriptors

Syntax
public EventSetDescriptor[] getEventSetDescriptors()
Description
Deny knowledge of event sets. You can override this if you wish to provide explicit event set info.


 SimpleBeanInfo.getIcon

SimpleBeanInfo.getIcon

Syntax
public Image getIcon( int iconKind )
Description
Claim there are no icons available. You can override this if you want to provide icons for your bean.


 SimpleBeanInfo.getMethodDescriptors

SimpleBeanInfo.getMethodDescriptors

Syntax
public MethodDescriptor[] getMethodDescriptors()
Description
Deny knowledge of methods. You can override this if you wish to provide explicit method info.


 SimpleBeanInfo.getPropertyDescriptors

SimpleBeanInfo.getPropertyDescriptors

Syntax
public PropertyDescriptor[] getPropertyDescriptors()
Description
Deny knowledge of properties. You can override this if you wish to provide explicit property info.


 SimpleBeanInfo.loadImage

SimpleBeanInfo.loadImage

Syntax
public Image loadImage( String resourceName )
Parameters
resourceName
A pathname relative to the directory holding the class file of the current class. For example, "wombat.gif".
Returns
an image object. May be null if the load failed.
Description
This is a utility method to help in loading icon images. It takes the name of a resource file associated with the current object's class file and loads an image object from that file. Typically images will be GIFs.


 Interface VetoableChangeListener

Interface java.beans.VetoableChangeListener

Interface Members | This Package | All Packages

public interface VetoableChangeListener
extends EventListener

A VetoableChange event gets fired whenever a bean changes a "constrained" property. You can register a VetoableChangeListener with a source bean so as to be notified of any constrained property updates.


 VetoableChangeListener Members

VetoableChangeListener Members

Interface Overview | This Package | All Packages

Methods
Name | Description
vetoableChange(PropertyChangeEvent) | This method gets called when a constrained property is changed.


 VetoableChangeListener.vetoableChange

VetoableChangeListener.vetoableChange

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void vetoableChange( PropertyChangeEvent evt ) throws PropertyVetoException
Parameters
evt
a PropertyChangeEvent object describing the event source and the property that has changed.
Description
This method gets called when a constrained property is changed.

Exceptions
PropertyVetoException if the recipient wishes the property change to be rolled back.


 Class VetoableChangeSupport

Class java.beans.VetoableChangeSupport

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.beans.VetoableChangeSupport

public class VetoableChangeSupport
extends Object
implements Serializable

This is a utility class that can be used by beans that support constrained properties. You can use an instance of this class as a member field of your bean and delegate various work to it.


 VetoableChangeSupport Members

VetoableChangeSupport Members

Class Overview | This Package | All Packages

Constructors
Name | Description
VetoableChangeSupport(Object) |

Methods
Name | Description
addVetoableChangeListener(VetoableChangeListener) | Add a VetoableListener to the listener list.
fireVetoableChange(String, Object, Object) | Report a vetoable property update to any registered listeners.
removeVetoableChangeListener(VetoableChangeListener) | Remove a VetoableChangeListener from the listener list.


 VetoableChangeSupport.VetoableChangeSupport

VetoableChangeSupport.VetoableChangeSupport

Syntax
public VetoableChangeSupport( Object sourceBean )


 VetoableChangeSupport.addVetoableChangeListener

VetoableChangeSupport.addVetoableChangeListener

Syntax
public synchronized void addVetoableChangeListener( VetoableChangeListener listener )
Parameters
listener
The VetoableChangeListener to be added
Description
Add a VetoableListener to the listener list.


 VetoableChangeSupport.fireVetoableChange

VetoableChangeSupport.fireVetoableChange

Syntax
public void fireVetoableChange( String propertyName, Object oldValue, Object newValue ) throws PropertyVetoException
Parameters
propertyName
The programmatic name of the property that was changed.
oldValue
The old value of the property.
newValue
The new value of the property.
Description
Report a vetoable property update to any registered listeners. If anyone vetos the change, then fire a new event reverting everyone to the old value and then rethrow the PropertyVetoException.

No event is fired if old and new are equal and non-null.

Exceptions
PropertyVetoException if the recipient wishes the property change to be rolled back.


 VetoableChangeSupport.removeVetoableChangeListener

VetoableChangeSupport.removeVetoableChangeListener

Syntax
public synchronized void removeVetoableChangeListener( VetoableChangeListener listener )
Parameters
listener
The VetoableChangeListener to be removed
Description
Remove a VetoableChangeListener from the listener list.


 Interface Visibility

Interface java.beans.Visibility

Interface Members | This Package | All Packages

public interface Visibility

Under some circumstances a bean may be run on servers where a GUI is not available. This interface can be used to query a bean to determine whether it absolutely needs a gui, and to advise the bean whether a GUI is available.

This interface is for expert developers, and is not needed for normal simple beans. To avoid confusing end-users we avoid using getXXX setXXX design patterns for these methods.


 Visibility Members

Visibility Members

Interface Overview | This Package | All Packages

Methods
Name | Description
avoidingGui() |
dontUseGui() | This method instructs the bean that it should not use the Gui.
needsGui() |
okToUseGui() | This method instructs the bean that it is OK to use the Gui.


 Visibility.avoidingGui

Visibility.avoidingGui

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean avoidingGui()
Returns
true if the bean is currently avoiding use of the Gui. e.g. due to a call on dontUseGui().


 Visibility.dontUseGui

Visibility.dontUseGui

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void dontUseGui()
Description
This method instructs the bean that it should not use the Gui.


 Visibility.needsGui

Visibility.needsGui

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean needsGui()
Returns
True if the bean absolutely needs a GUI available in order to get its work done.


 Visibility.okToUseGui

Visibility.okToUseGui

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void okToUseGui()
Description
This method instructs the bean that it is OK to use the Gui.


 Package java.io

Package java.io

All Packages

Interfaces

  • DataInput
  • DataOutput
  • Externalizable
  • FilenameFilter
  • ObjectInput
  • ObjectInputValidation
  • ObjectOutput
  • Serializable

    • Classes

  • BufferedInputStream
  • BufferedOutputStream
  • BufferedReader
  • BufferedWriter
  • ByteArrayInputStream
  • ByteArrayOutputStream
  • CharArrayReader
  • CharArrayWriter
  • DataInputStream
  • DataOutputStream
  • File
  • FileDescriptor
  • FileInputStream
  • FileOutputStream
  • FileReader
  • FileWriter
  • FilterInputStream
  • FilterOutputStream
  • FilterReader
  • FilterWriter
  • InputStream
  • InputStreamReader
  • LineNumberInputStream
  • LineNumberReader
  • ObjectInputStream
  • ObjectOutputStream
  • ObjectStreamClass
  • OutputStream
  • OutputStreamWriter
  • PipedInputStream
  • PipedOutputStream
  • PipedReader
  • PipedWriter
  • PrintStream
  • PrintWriter
  • PushbackInputStream
  • PushbackReader
  • RandomAccessFile
  • Reader
  • SequenceInputStream
  • StreamTokenizer
  • StringBufferInputStream
  • StringReader
  • StringWriter
  • Writer

    • Exceptions

  • CharConversionException
  • EOFException
  • FileNotFoundException
  • IOException
  • InterruptedIOException
  • InvalidClassException
  • InvalidObjectException
  • NotActiveException
  • NotSerializableException
  • ObjectStreamException
  • OptionalDataException
  • StreamCorruptedException
  • SyncFailedException
  • UTFDataFormatException
  • UnsupportedEncodingException
  • WriteAbortedException


 Class BufferedInputStream

Class java.io.BufferedInputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.FilterInputStream
                   |
                   +----java.io.BufferedInputStream

public class BufferedInputStream
extends FilterInputStream

The class implements a buffered input stream. By setting up such an input stream, an application can read bytes from a stream without necessarily causing a call to the underlying system for each byte read. The data is read by blocks into a buffer; subsequent reads can access the data directly from the buffer.


 BufferedInputStream Members

BufferedInputStream Members

Class Overview | This Package | All Packages

Fields
Name | Description
buf | The buffer where data is stored.
count | The index one greater than the index of the last valid byte in the buffer.
marklimit | The maximum read ahead allowed after a call to the mark method before subsequent calls to the reset method fail.
markpos | The value of the pos field at the time the last mark method was called.
pos | The current position in the buffer.

Constructors
Name | Description
BufferedInputStream(InputStream) | Creates a new buffered input stream to read data from the specified input stream with a default 512-byte buffer size.
BufferedInputStream(InputStream, int) | Creates a new buffered input stream to read data from the specified input stream with the specified buffer size.

Methods
Name | Description
available() | Returns the number of bytes that can be read from this input stream without blocking.
mark(int) | Marks the current position in this input stream.
markSupported() | Tests if this input stream supports the mark and reset methods.
read() | Reads the next byte of data from this buffered input stream.
read(byte[], int, int) | Reads bytes into a portion of an array.
reset() | Repositions this stream to the position at the time the mark method was last called on this input stream.
skip(long) | Skips over and discards n bytes of data from the input stream.


 BufferedInputStream.buf

BufferedInputStream.buf

Syntax
protected byte buf[]
Description
The buffer where data is stored.


 BufferedInputStream.count

BufferedInputStream.count

Syntax
protected int count
Description
The index one greater than the index of the last valid byte in the buffer.


 BufferedInputStream.marklimit

BufferedInputStream.marklimit

Syntax
protected int marklimit
Description
The maximum read ahead allowed after a call to the mark method before subsequent calls to the reset method fail.

See Also
mark, reset


 BufferedInputStream.markpos

BufferedInputStream.markpos

Syntax
protected int markpos
Description
The value of the pos field at the time the last mark method was called. The value of this field is -1 if there is no current mark.

See Also
mark, pos


 BufferedInputStream.pos

BufferedInputStream.pos

Syntax
protected int pos
Description
The current position in the buffer. This is the index of the next character to be read from the buf array.

See Also
buf


 BufferedInputStream.BufferedInputStream

BufferedInputStream.BufferedInputStream

Syntax 1
public BufferedInputStream( InputStream in )
Parameters
in
the underlying input stream.
Description
Creates a new buffered input stream to read data from the specified input stream with a default 512-byte buffer size.

Syntax 2
public BufferedInputStream( InputStream in, int size )
Parameters
in
the underlying input stream.
size
the buffer size.
Description
Creates a new buffered input stream to read data from the specified input stream with the specified buffer size.


 BufferedInputStream.available

BufferedInputStream.available

Syntax
public synchronized int available() throws IOException
Returns
the number of bytes that can be read from this input stream without blocking.
Description
Returns the number of bytes that can be read from this input stream without blocking.

The available method of BufferedInputStream returns the sum of the the number of bytes remaining to be read in the buffer (count - pos) and the result of calling the available method of the underlying input stream.

Exceptions
IOException if an I/O error occurs.
Overrides
available in class FilterInputStream
See Also
in


 BufferedInputStream.mark

BufferedInputStream.mark

Syntax
public synchronized void mark( int readlimit )
Parameters
readlimit
the maximum limit of bytes that can be read before the mark position becomes invalid.
Description
Marks the current position in this input stream. A subsequent call to the reset method repositions the stream at the last marked position so that subsequent reads re-read the same bytes.

The readlimit argument tells the input stream to allow that many bytes to be read before the mark position gets invalidated.

Overrides
mark in class FilterInputStream
See Also
reset


 BufferedInputStream.markSupported

BufferedInputStream.markSupported

Syntax
public boolean markSupported()
Returns
a boolean indicating if this stream type supports the mark and reset methods.
Description
Tests if this input stream supports the mark and reset methods. The markSupported method of BufferedInputStream returns true.

Overrides
markSupported in class FilterInputStream
See Also
mark, reset


 BufferedInputStream.read

BufferedInputStream.read

Syntax 1
public synchronized int read() throws IOException
Returns
the next byte of data, or -1 if the end of the stream is reached.
Description
Reads the next byte of data from this buffered input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

The read method of BufferedInputStream returns the next byte of data from its buffer if the buffer is not empty. Otherwise, it refills the buffer from the underlying input stream and returns the next character, if the underlying stream has not returned an end-of-stream indicator.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class FilterInputStream
See Also
in

Syntax 2
public synchronized int read( byte b[], int off, int len ) throws IOException
Parameters
b
destination buffer.
off
offset at which to start storing bytes.
len
maximum number of bytes to read.
Returns
the number of bytes read, or -1 if the end of the stream has been reached.
Description
Reads bytes into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

If this stream's buffer is not empty, bytes are copied from it into the array argument. Otherwise, the buffer is refilled from the underlying input stream and, unless the stream returns an end-of-stream indication, the array argument is filled with characters from the newly-filled buffer.

As an optimization, if the buffer is empty, the mark is not valid, and len is at least as large as the buffer, then this method will read directly from the underlying stream into the given array. Thus redundant BufferedInputStreams will not copy data unnecessarily.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class FilterInputStream


 BufferedInputStream.reset

BufferedInputStream.reset

Syntax
public synchronized void reset() throws IOException
Description
Repositions this stream to the position at the time the mark method was last called on this input stream.

If the stream has not been marked, or if the mark has been invalidated, an IOException is thrown. Stream marks are intended to be used in situations where you need to read ahead a little to see what's in the stream. Often this is most easily done by invoking some general parser. If the stream is of the type handled by the parser, it just chugs along happily. If the stream is not of that type, the parser should toss an exception when it fails. If an exception gets tossed within readlimit bytes, the parser will allow the outer code to reset the stream and to try another parser.

Exceptions
IOException if this stream has not been marked or if the mark has been invalidated.
Overrides
reset in class FilterInputStream
See Also
mark


 BufferedInputStream.skip

BufferedInputStream.skip

Syntax
public synchronized long skip( long n ) throws IOException
Parameters
n
the number of bytes to be skipped.
Returns
the actual number of bytes skipped.
Description
Skips over and discards n bytes of data from the input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly zero. The actual number of bytes skipped is returned.

The skip method of BufferedInputStream compares the number of bytes it has available in its buffer, k, where k = count - pos, with n. If n ≤ k, then the pos field is incremented by n. Otherwise, the pos field is incremented to have the value count, and the remaining bytes are skipped by calling the skip method on the underlying input stream, supplying the argument n - k.

Exceptions
IOException if an I/O error occurs.
Overrides
skip in class FilterInputStream


 Class BufferedOutputStream

Class java.io.BufferedOutputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----java.io.FilterOutputStream
                   |
                   +----java.io.BufferedOutputStream

public class BufferedOutputStream
extends FilterOutputStream

The class implements a buffered output stream. By setting up such an output stream, an application can write bytes to the underlying output stream without necessarily causing a call to the underlying system for each byte written. The data is written into a buffer, and then written to the underlying stream if the buffer reaches its capacity, the buffer output stream is closed, or the buffer output stream is explicity flushed.


 BufferedOutputStream Members

BufferedOutputStream Members

Class Overview | This Package | All Packages

Fields
Name | Description
buf | The buffer where data is stored.
count | The number of valid bytes in the buffer.

Constructors
Name | Description
BufferedOutputStream(OutputStream) | Creates a new buffered output stream to write data to the specified underlying output stream with a default 512-byte buffer size.
BufferedOutputStream(OutputStream, int) | Creates a new buffered output stream to write data to the specified underlying output stream with the specified buffer size.

Methods
Name | Description
flush() | Flushes this buffered output stream.
write(byte[], int, int) | Writes len bytes from the specified byte array starting at offset off to this buffered output stream.
write(int) | Writes the specified byte to this buffered output stream.


 BufferedOutputStream.buf

BufferedOutputStream.buf

Syntax
protected byte buf[]
Description
The buffer where data is stored.


 BufferedOutputStream.count

BufferedOutputStream.count

Syntax
protected int count
Description
The number of valid bytes in the buffer.


 BufferedOutputStream.BufferedOutputStream

BufferedOutputStream.BufferedOutputStream

Syntax 1
public BufferedOutputStream( OutputStream out )
Parameters
out
the underlying output stream.
Description
Creates a new buffered output stream to write data to the specified underlying output stream with a default 512-byte buffer size.

Syntax 2
public BufferedOutputStream( OutputStream out, int size )
Parameters
out
the underlying output stream.
size
the buffer size.
Description
Creates a new buffered output stream to write data to the specified underlying output stream with the specified buffer size.


 BufferedOutputStream.flush

BufferedOutputStream.flush

Syntax
public synchronized void flush() throws IOException
Description
Flushes this buffered output stream. This forces any buffered output bytes to be written out to the underlying output stream.

Exceptions
IOException if an I/O error occurs.
Overrides
flush in class FilterOutputStream
See Also
out


 BufferedOutputStream.write

BufferedOutputStream.write

Syntax 1
public synchronized void write( int b ) throws IOException
Parameters
b
the byte to be written.
Description
Writes the specified byte to this buffered output stream.

Exceptions
IOException if an I/O error occurs.
Overrides
write in class FilterOutputStream

Syntax 2
public synchronized void write( byte b[], int off, int len ) throws IOException
Parameters
b
the data.
off
the start offset in the data.
len
the number of bytes to write.
Description
Writes len bytes from the specified byte array starting at offset off to this buffered output stream.

Ordinarily this method stores bytes from the given array into this stream's buffer, flushing the buffer to the underlying output stream as needed. If the requested length is at least as large as this stream's buffer, however, then this method will flush the buffer and write the bytes directly to the underlying output stream. Thus redundant BufferedOutputStreams will not copy data unnecessarily.

Exceptions
IOException if an I/O error occurs.
Overrides
write in class FilterOutputStream


 Class BufferedReader

Class java.io.BufferedReader

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Reader
           |
           +----java.io.BufferedReader

public class BufferedReader
extends Reader

Read text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines.

The buffer size may be specified, or the default size may be used. The default is large enough for most purposes.

In general, each read request made of a Reader causes a corresponding read request to be made of the underlying character or byte stream. It is therefore advisable to wrap a BufferedReader around any Reader whose read() operations may be costly, such as FileReaders and InputStreamReaders. For example,

 BufferedReader in
   = new BufferedReader(new FileReader("foo.in"));
will buffer the input from the specified file. Without buffering, each invocation of read() or readLine() could cause bytes to be read from the file, converted into characters, and then returned, which can be very inefficient.

Programs that use DataInputStreams for textual input can be localized by replacing each DataInputStream with an appropriate BufferedReader.

See Also:
FileReader, InputStreamReader


 BufferedReader Members

BufferedReader Members

Class Overview | This Package | All Packages

Constructors
Name | Description
BufferedReader(Reader) | Create a buffering character-input stream that uses a default-sized input buffer.
BufferedReader(Reader, int) | Create a buffering character-input stream that uses an input buffer of the specified size.

Methods
Name | Description
close() | Close the stream.
mark(int) | Mark the present position in the stream.
markSupported() | Tell whether this stream supports the mark() operation, which it does.
read() | Read a single character.
read(char[], int, int) | Read characters into a portion of an array.
readLine() | Read a line of text.
ready() | Tell whether this stream is ready to be read.
reset() | Reset the stream to the most recent mark.
skip(long) | Skip characters.


 BufferedReader.BufferedReader

BufferedReader.BufferedReader

Syntax 1
public BufferedReader( Reader in, int sz )
Parameters
in
A Reader
sz
Input-buffer size
Description
Create a buffering character-input stream that uses an input buffer of the specified size.

Exceptions
IllegalArgumentException If sz is <= 0

Syntax 2
public BufferedReader( Reader in )
Parameters
in
A Reader
Description
Create a buffering character-input stream that uses a default-sized input buffer.


 BufferedReader.close

BufferedReader.close

Syntax
public void close() throws IOException
Description
Close the stream.

Exceptions
IOException If an I/O error occurs
Overrides
close in class Reader


 BufferedReader.mark

BufferedReader.mark

Syntax
public void mark( int readAheadLimit ) throws IOException
Parameters
readAheadLimit
Limit on the number of characters that may be read while still preserving the mark. After reading this many characters, attempting to reset the stream may fail. A limit value larger than the size of the input buffer will cause a new buffer to be allocated whose size is no smaller than limit. Therefore large values should be used with care.
Description
Mark the present position in the stream. Subsequent calls to reset() will attempt to reposition the stream to this point.

Exceptions
IllegalArgumentException If readAheadLimit is < 0
Exceptions
IOException If an I/O error occurs
Overrides
mark in class Reader


 BufferedReader.markSupported

BufferedReader.markSupported

Syntax
public boolean markSupported()
Description
Tell whether this stream supports the mark() operation, which it does.

Overrides
markSupported in class Reader


 BufferedReader.read

BufferedReader.read

Syntax 1
public int read() throws IOException
Description
Read a single character.

Exceptions
IOException If an I/O error occurs
Overrides
read in class Reader

Syntax 2
public int read( char cbuf[], int off, int len ) throws IOException
Parameters
cbuf
Destination buffer
off
Offset at which to start storing characters
len
Maximum number of characters to read
Returns
The number of bytes read, or -1 if the end of the stream has been reached
Description
Read characters into a portion of an array.

Ordinarily this method takes characters from this stream's character buffer, filling it from the underlying stream as necessary. If, however, the buffer is empty, the mark is not valid, and the requested length is at least as large as the buffer, then this method will read characters directly from the underlying stream into the given array. Thus redundant BufferedReaders will not copy data unnecessarily.

Exceptions
IOException If an I/O error occurs
Overrides
read in class Reader


 BufferedReader.readLine

BufferedReader.readLine

Syntax
public String readLine() throws IOException
Returns
A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached
Description
Read a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.

Exceptions
IOException If an I/O error occurs


 BufferedReader.ready

BufferedReader.ready

Syntax
public boolean ready() throws IOException
Description
Tell whether this stream is ready to be read. A buffered character stream is ready if the buffer is not empty, or if the underlying character stream is ready.

Exceptions
IOException If an I/O error occurs
Overrides
ready in class Reader


 BufferedReader.reset

BufferedReader.reset

Syntax
public void reset() throws IOException
Description
Reset the stream to the most recent mark.

Exceptions
IOException If the stream has never been marked, or if the mark has been invalidated
Overrides
reset in class Reader


 BufferedReader.skip

BufferedReader.skip

Syntax
public long skip( long n ) throws IOException
Parameters
n
The number of characters to skip
Returns
The number of characters actually skipped
Description
Skip characters.

Exceptions
IOException If an I/O error occurs
Overrides
skip in class Reader


 Class BufferedWriter

Class java.io.BufferedWriter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Writer
           |
           +----java.io.BufferedWriter

public class BufferedWriter
extends Writer

Write text to a character-output stream, buffering characters so as to provide for the efficient writing of single characters, arrays, and strings.

The buffer size may be specified, or the default size may be accepted. The default is large enough for most purposes.

A newLine() method is provided, which uses the platform's own notion of line separator as defined by the system property line.separator. Not all platforms use the newline character ('\n') to terminate lines. Calling this method to terminate each output line is therefore preferred to writing a newline character directly.

In general, a Writer sends its output immediately to the underlying character or byte stream. Unless prompt output is required, it is advisable to wrap a BufferedWriter around any Writer whose write() operations may be costly, such as FileWriters and OutputStreamWriters. For example,

 PrintWriter out
   = new PrintWriter(new BufferedWriter(new FileWriter("foo.out")));
will buffer the PrintWriter's output to the file. Without buffering, each invocation of a print() method would cause characters to be converted into bytes that would then be written immediately to the file, which can be very inefficient.

See Also:
PrintWriter, FileWriter, OutputStreamWriter


 BufferedWriter Members

BufferedWriter Members

Class Overview | This Package | All Packages

Constructors
Name | Description
BufferedWriter(Writer) | Create a buffered character-output stream that uses a default-sized output buffer.
BufferedWriter(Writer, int) | Create a new buffered character-output stream that uses an output buffer of the given size.

Methods
Name | Description
close() | Close the stream.
flush() | Flush the stream.
newLine() | Write a line separator.
write(char[], int, int) | Write a portion of an array of characters.
write(int) | Write a single character.
write(String, int, int) | Write a portion of a String.


 BufferedWriter.BufferedWriter

BufferedWriter.BufferedWriter

Syntax 1
public BufferedWriter( Writer out )
Parameters
out
A Writer
Description
Create a buffered character-output stream that uses a default-sized output buffer.

Syntax 2
public BufferedWriter( Writer out, int sz )
Parameters
out
A Writer
sz
Output-buffer size, a positive integer
Description
Create a new buffered character-output stream that uses an output buffer of the given size.

Exceptions
IllegalArgumentException If sz is <= 0


 BufferedWriter.close

BufferedWriter.close

Syntax
public void close() throws IOException
Description
Close the stream.

Exceptions
IOException If an I/O error occurs
Overrides
close in class Writer


 BufferedWriter.flush

BufferedWriter.flush

Syntax
public void flush() throws IOException
Description
Flush the stream.

Exceptions
IOException If an I/O error occurs
Overrides
flush in class Writer


 BufferedWriter.newLine

BufferedWriter.newLine

Syntax
public void newLine() throws IOException
Description
Write a line separator. The line separator string is defined by the system property line.separator, and is not necessarily a single newline ('\n') character.

Exceptions
IOException If an I/O error occurs


 BufferedWriter.write

BufferedWriter.write

Syntax 1
public void write( int c ) throws IOException
Description
Write a single character.

Exceptions
IOException If an I/O error occurs
Overrides
write in class Writer

Syntax 2
public void write( char cbuf[], int off, int len ) throws IOException
Parameters
cbuf
A character array
off
Offset from which to start reading characters
len
Number of characters to write
Description
Write a portion of an array of characters.

Ordinarily this method stores characters from the given array into this stream's buffer, flushing the buffer to the underlying stream as needed. If the requested length is at least as large as the buffer, however, then this method will flush the buffer and write the characters directly to the underlying stream. Thus redundant BufferedWriters will not copy data unnecessarily.

Exceptions
IOException If an I/O error occurs
Overrides
write in class Writer

Syntax 3
public void write( String s, int off, int len ) throws IOException
Parameters
s
String to be written
off
Offset from which to start reading characters
len
Number of characters to be written
Description
Write a portion of a String.

Exceptions
IOException If an I/O error occurs
Overrides
write in class Writer


 Class ByteArrayInputStream

Class java.io.ByteArrayInputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.ByteArrayInputStream

public class ByteArrayInputStream
extends InputStream

This class allows an application to create an input stream in which the bytes read are supplied by the contents of a byte array. Applications can also read bytes from a string by using a StringBufferInputStream.

See Also:
StringBufferInputStream


 ByteArrayInputStream Members

ByteArrayInputStream Members

Class Overview | This Package | All Packages

Fields
Name | Description
buf | The byte array containing the data.
count | The index one greater than the last valid character in the input stream buffer.
mark | The currently marked position in the stream.
pos | The index of the next character to read from the input stream buffer.

Constructors
Name | Description
ByteArrayInputStream(byte[]) | Creates a new byte array input stream that reads data from the specified byte array.
ByteArrayInputStream(byte[], int, int) | Creates a new byte array input stream that reads data from the specified byte array.

Methods
Name | Description
available() | Returns the number of bytes that can be read from this input stream without blocking.
mark(int) | Set the current marked position in the stream.
markSupported() | Tests if ByteArrayInputStream supports mark/reset.
read() | Reads the next byte of data from this input stream.
read(byte[], int, int) | Reads up to len bytes of data into an array of bytes from this input stream.
reset() | Resets the buffer to the marked position.
skip(long) | Skips n bytes of input from this input stream.


 ByteArrayInputStream.buf

ByteArrayInputStream.buf

Syntax
protected byte buf[]
Description
The byte array containing the data.


 ByteArrayInputStream.count

ByteArrayInputStream.count

Syntax
protected int count
Description
The index one greater than the last valid character in the input stream buffer.


 ByteArrayInputStream.mark

ByteArrayInputStream.mark

Syntax
protected int mark
Description
The currently marked position in the stream. ByteArrayInputStreams are marked at position zero by default when constructed. They may be marked at another position within the buffer by the mark() method. The current buffer position is set to this point by the reset() method.


 ByteArrayInputStream.pos

ByteArrayInputStream.pos

Syntax
protected int pos
Description
The index of the next character to read from the input stream buffer.


 ByteArrayInputStream.ByteArrayInputStream

ByteArrayInputStream.ByteArrayInputStream

Syntax 1
public ByteArrayInputStream( byte buf[] )
Parameters
buf
the input buffer.
Description
Creates a new byte array input stream that reads data from the specified byte array. The byte array is not copied.

Syntax 2
public ByteArrayInputStream( byte buf[], int offset, int length )
Parameters
buf
the input buffer.
offset
the offset in the buffer of the first byte to read.
length
the maximum number of bytes to read from the buffer.
Description
Creates a new byte array input stream that reads data from the specified byte array. Up to length characters are to be read from the byte array, starting at the indicated offset.

The byte array is not copied.


 ByteArrayInputStream.available

ByteArrayInputStream.available

Syntax
public synchronized int available()
Returns
the number of bytes that can be read from the input stream without blocking.
Description
Returns the number of bytes that can be read from this input stream without blocking.

The available method of ByteArrayInputStream returns the value of count - pos, which is the number of bytes remaining to be read from the input buffer.

Overrides
available in class InputStream


 ByteArrayInputStream.mark

ByteArrayInputStream.mark

Syntax
public void mark( int markpos )
Description
Set the current marked position in the stream. ByteArrayInputStreams are marked at position zero by default when constructed. They may be marked at another position within the buffer by this method.

Overrides
mark in class InputStream


 ByteArrayInputStream.markSupported

ByteArrayInputStream.markSupported

Syntax
public boolean markSupported()
Description
Tests if ByteArrayInputStream supports mark/reset.

Overrides
markSupported in class InputStream


 ByteArrayInputStream.read

ByteArrayInputStream.read

Syntax 1
public synchronized int read()
Returns
the next byte of data, or -1 if the end of the stream has been reached.
Description
Reads the next byte of data from this input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned.

The read method of ByteArrayInputStream cannot block.

Overrides
read in class InputStream

Syntax 2
public synchronized int read( byte b[], int off, int len )
Parameters
b
the buffer into which the data is read.
off
the start offset of the data.
len
the maximum number of bytes read.
Returns
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Description
Reads up to len bytes of data into an array of bytes from this input stream. This read method cannot block.

Overrides
read in class InputStream


 ByteArrayInputStream.reset

ByteArrayInputStream.reset

Syntax
public synchronized void reset()
Description
Resets the buffer to the marked position. The marked position is the beginning unless another position was marked.

Overrides
reset in class InputStream


 ByteArrayInputStream.skip

ByteArrayInputStream.skip

Syntax
public synchronized long skip( long n )
Parameters
n
the number of bytes to be skipped.
Returns
the actual number of bytes skipped.
Description
Skips n bytes of input from this input stream. Fewer bytes might be skipped if the end of the input stream is reached.

Overrides
skip in class InputStream


 Class ByteArrayOutputStream

Class java.io.ByteArrayOutputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----java.io.ByteArrayOutputStream

public class ByteArrayOutputStream
extends OutputStream

This class implements an output stream in which the data is written into a byte array. The buffer automatically grows as data is written to it. The data can be retrieved using toByteArray() and toString().


 ByteArrayOutputStream Members

ByteArrayOutputStream Members

Class Overview | This Package | All Packages

Fields
Name | Description
buf | The buffer where data is stored.
count | The number of valid bytes in the buffer.

Constructors
Name | Description
ByteArrayOutputStream() | Creates a new byte array output stream.
ByteArrayOutputStream(int) | Creates a new byte array output stream, with a buffer capacity of the specified size, in bytes.

Methods
Name | Description
reset() | Resets the count field of this byte array output stream to zero, so that all currently accumulated output in the ouput stream is discarded.
size() | Returns the current size of the buffer.
toByteArray() | Creates a newly allocated byte array.
toString() | Converts the buffer's contents into a string, translating bytes into characters according to the platform's default character encoding.
toString(int) | Creates a newly allocated string. Deprecated.
toString(String) | Converts the buffer's contents into a string, translating bytes into characters according to the specified character encoding.
write(byte[], int, int) | Writes len bytes from the specified byte array starting at offset off to this byte array output stream.
write(int) | Writes the specified byte to this byte array output stream.
writeTo(OutputStream) | Writes the complete contents of this byte array output stream to the specified output stream argument, as if by calling the output stream's write method using out.write(buf, 0, count).


 ByteArrayOutputStream.buf

ByteArrayOutputStream.buf

Syntax
protected byte buf[]
Description
The buffer where data is stored.


 ByteArrayOutputStream.count

ByteArrayOutputStream.count

Syntax
protected int count
Description
The number of valid bytes in the buffer.


 ByteArrayOutputStream.ByteArrayOutputStream

ByteArrayOutputStream.ByteArrayOutputStream

Syntax 1
public ByteArrayOutputStream()
Description
Creates a new byte array output stream. The buffer capacity is initially 32 bytes, though its size increases if necessary.

Syntax 2
public ByteArrayOutputStream( int size )
Parameters
size
the initial size.
Description
Creates a new byte array output stream, with a buffer capacity of the specified size, in bytes.


 ByteArrayOutputStream.reset

ByteArrayOutputStream.reset

Syntax
public synchronized void reset()
Description
Resets the count field of this byte array output stream to zero, so that all currently accumulated output in the ouput stream is discarded. The output stream can be used again, reusing the already allocated buffer space.

See Also
count


 ByteArrayOutputStream.size

ByteArrayOutputStream.size

Syntax
public int size()
Returns
the value of the count field, which is the number of valid bytes in this output stream.
Description
Returns the current size of the buffer.

See Also
count


 ByteArrayOutputStream.toByteArray

ByteArrayOutputStream.toByteArray

Syntax
public synchronized byte[] toByteArray()
Returns
the current contents of this output stream, as a byte array.
Description
Creates a newly allocated byte array. Its size is the current size of this output stream and the valid contents of the buffer have been copied into it.

See Also
size


 ByteArrayOutputStream.toString

ByteArrayOutputStream.toString

Syntax 1
public String toString()
Description
Converts the buffer's contents into a string, translating bytes into characters according to the platform's default character encoding.

Overrides
toString in class Object

Syntax 2
public String toString( String enc ) throws UnsupportedEncodingException
Parameters
enc
a character-encoding name.
Description
Converts the buffer's contents into a string, translating bytes into characters according to the specified character encoding.

Syntax 3
public String toString( int hibyte )
Parameters
hibyte
the high byte of each resulting Unicode character.
Returns
the current contents of the output stream, as a string.
Description
Note: toString() is deprecated. This method does not properly convert bytes into characters. As of JDK 1.1, the preferred way to do this is via the toString(String enc) method, which takes an encoding-name argument, or the toString() method, which uses the platform's default character encoding.

Creates a newly allocated string. Its size is the current size of the output stream and the valid contents of the buffer have been copied into it. Each character c in the resulting string is constructed from the corresponding element b in the byte array such that:

    c == (char)(((hibyte & 0xff) << 8) | (b & 0xff))

See Also
size, toString, toString


 ByteArrayOutputStream.write

ByteArrayOutputStream.write

Syntax 1
public synchronized void write( int b )
Parameters
b
the byte to be written.
Description
Writes the specified byte to this byte array output stream.

Overrides
write in class OutputStream

Syntax 2
public synchronized void write( byte b[], int off, int len )
Parameters
b
the data.
off
the start offset in the data.
len
the number of bytes to write.
Description
Writes len bytes from the specified byte array starting at offset off to this byte array output stream.

Overrides
write in class OutputStream


 ByteArrayOutputStream.writeTo

ByteArrayOutputStream.writeTo

Syntax
public synchronized void writeTo( OutputStream out ) throws IOException
Parameters
out
the output stream to which to write the data.
Description
Writes the complete contents of this byte array output stream to the specified output stream argument, as if by calling the output stream's write method using out.write(buf, 0, count).

Exceptions
IOException if an I/O error occurs.


 Class CharArrayReader

Class java.io.CharArrayReader

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Reader
           |
           +----java.io.CharArrayReader

public class CharArrayReader
extends Reader

This class implements a character buffer that can be used as a character-input stream.


 CharArrayReader Members

CharArrayReader Members

Class Overview | This Package | All Packages

Fields
Name | Description
buf | Character buffer
count | Number of valid characters in buffer
markedPos | Position of mark in buffer
pos | Current buffer position

Constructors
Name | Description
CharArrayReader(char[]) | Create an CharArrayReader from the specified array of chars.
CharArrayReader(char[], int, int) | Create an CharArrayReader from the specified array of chars.

Methods
Name | Description
close() | Close the stream.
mark(int) | Mark the present position in the stream.
markSupported() | Tell whether this stream supports the mark() operation, which it does.
read() | Read a single character.
read(char[], int, int) | Read characters into a portion of an array.
ready() | Tell whether this stream is ready to be read.
reset() | Reset the stream to the most recent mark, or to the beginning if it has never been marked.
skip(long) | Skip characters.


 CharArrayReader.buf

CharArrayReader.buf

Syntax
protected char buf[]
Description
Character buffer


 CharArrayReader.count

CharArrayReader.count

Syntax
protected int count
Description
Number of valid characters in buffer


 CharArrayReader.markedPos

CharArrayReader.markedPos

Syntax
protected int markedPos
Description
Position of mark in buffer


 CharArrayReader.pos

CharArrayReader.pos

Syntax
protected int pos
Description
Current buffer position


 CharArrayReader.CharArrayReader

CharArrayReader.CharArrayReader

Syntax 1
public CharArrayReader( char buf[] )
Parameters
buf
Input buffer (not copied)
Description
Create an CharArrayReader from the specified array of chars.

Syntax 2
public CharArrayReader( char buf[], int offset, int length )
Parameters
buf
Input buffer (not copied)
offset
Offset of the first char to read
length
Number of chars to read
Description
Create an CharArrayReader from the specified array of chars.


 CharArrayReader.close

CharArrayReader.close

Syntax
public void close()
Description
Close the stream.

Overrides
close in class Reader


 CharArrayReader.mark

CharArrayReader.mark

Syntax
public void mark( int readAheadLimit ) throws IOException
Parameters
readAheadLimit
Limit on the number of characters that may be read while still preserving the mark. Because the stream's input comes from a character array, there is no actual limit; hence this argument is ignored.
Description
Mark the present position in the stream. Subsequent calls to reset() will reposition the stream to this point.

Exceptions
IOException If an I/O error occurs
Overrides
mark in class Reader


 CharArrayReader.markSupported

CharArrayReader.markSupported

Syntax
public boolean markSupported()
Description
Tell whether this stream supports the mark() operation, which it does.

Overrides
markSupported in class Reader


 CharArrayReader.read

CharArrayReader.read

Syntax 1
public int read() throws IOException
Description
Read a single character.

Exceptions
IOException If an I/O error occurs
Overrides
read in class Reader

Syntax 2
public int read( char b[], int off, int len ) throws IOException
Parameters
b
Destination buffer
off
Offset at which to start storing characters
len
Maximum number of characters to read
Returns
The actual number of characters read, or -1 if the end of the stream has been reached
Description
Read characters into a portion of an array.

Exceptions
IOException If an I/O error occurs
Overrides
read in class Reader


 CharArrayReader.ready

CharArrayReader.ready

Syntax
public boolean ready() throws IOException
Description
Tell whether this stream is ready to be read. Character-array readers are always ready to be read.

Exceptions
IOException If an I/O error occurs
Overrides
ready in class Reader


 CharArrayReader.reset

CharArrayReader.reset

Syntax
public void reset() throws IOException
Description
Reset the stream to the most recent mark, or to the beginning if it has never been marked.

Exceptions
IOException If an I/O error occurs
Overrides
reset in class Reader


 CharArrayReader.skip

CharArrayReader.skip

Syntax
public long skip( long n ) throws IOException
Parameters
n
The number of characters to skip
Returns
The number of characters actually skipped
Description
Skip characters.

Exceptions
IOException If an I/O error occurs
Overrides
skip in class Reader


 Class CharArrayWriter

Class java.io.CharArrayWriter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Writer
           |
           +----java.io.CharArrayWriter

public class CharArrayWriter
extends Writer

This class implements a character buffer that can be used as an Writer. The buffer automatically grows when data is written to the stream. The data can be retrieved using toCharArray() and toString().


 CharArrayWriter Members

CharArrayWriter Members

Class Overview | This Package | All Packages

Fields
Name | Description
buf | The buffer where data is stored.
count | The number of chars in the buffer.

Constructors
Name | Description
CharArrayWriter() | Creates a new CharArrayWriter.
CharArrayWriter(int) | Creates a new CharArrayWriter with the specified initial size.

Methods
Name | Description
close() | Close the stream.
flush() | Flush the stream.
reset() | Resets the buffer so that you can use it again without throwing away the already allocated buffer.
size() | Returns the current size of the buffer.
toCharArray() | Returns a copy of the input data.
toString() | Converts input data to a string.
write(char[], int, int) | Writes characters to the buffer.
write(int) | Writes a character to the buffer.
write(String, int, int) | Write a portion of a string to the buffer.
writeTo(Writer) | Writes the contents of the buffer to another character stream.


 CharArrayWriter.buf

CharArrayWriter.buf

Syntax
protected char buf[]
Description
The buffer where data is stored.


 CharArrayWriter.count

CharArrayWriter.count

Syntax
protected int count
Description
The number of chars in the buffer.


 CharArrayWriter.CharArrayWriter

CharArrayWriter.CharArrayWriter

Syntax 1
public CharArrayWriter()
Description
Creates a new CharArrayWriter.

Syntax 2
public CharArrayWriter( int initialSize )
Description
Creates a new CharArrayWriter with the specified initial size.


 CharArrayWriter.close

CharArrayWriter.close

Syntax
public void close()
Description
Close the stream. This method does not release the buffer, since its contents might still be required.

Overrides
close in class Writer


 CharArrayWriter.flush

CharArrayWriter.flush

Syntax
public void flush()
Description
Flush the stream.

Overrides
flush in class Writer


 CharArrayWriter.reset

CharArrayWriter.reset

Syntax
public void reset()
Description
Resets the buffer so that you can use it again without throwing away the already allocated buffer.


 CharArrayWriter.size

CharArrayWriter.size

Syntax
public int size()
Description
Returns the current size of the buffer.


 CharArrayWriter.toCharArray

CharArrayWriter.toCharArray

Syntax
public char[] toCharArray()
Description
Returns a copy of the input data.


 CharArrayWriter.toString

CharArrayWriter.toString

Syntax
public String toString()
Returns
the string.
Description
Converts input data to a string.

Overrides
toString in class Object


 CharArrayWriter.write

CharArrayWriter.write

Syntax 1
public void write( int c )
Description
Writes a character to the buffer.

Overrides
write in class Writer

Syntax 2
public void write( char c[], int off, int len )
Parameters
c
the data to be written
off
the start offset in the data
len
the number of chars that are written
Description
Writes characters to the buffer.

Overrides
write in class Writer

Syntax 3
public void write( String str, int off, int len )
Parameters
str
String to be written from
off
Offset from which to start reading characters
len
Number of characters to be written
Description
Write a portion of a string to the buffer.

Overrides
write in class Writer


 CharArrayWriter.writeTo

CharArrayWriter.writeTo

Syntax
public void writeTo( Writer out ) throws IOException
Parameters
out
the output stream to write to
Description
Writes the contents of the buffer to another character stream.


 Class CharConversionException

Class java.io.CharConversionException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.io.CharConversionException

public class CharConversionException
extends IOException

base class for character conversion exceptions


 CharConversionException Members

CharConversionException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
CharConversionException() | provides no detailed message
CharConversionException(String) | provides a detailed message


 CharConversionException.CharConversionException

CharConversionException.CharConversionException

Syntax 1
public CharConversionException()
Description
provides no detailed message

Syntax 2
public CharConversionException( String s )
Parameters
s
detailed message
Description
provides a detailed message


 Interface DataInput

Interface java.io.DataInput

Interface Members | This Package | All Packages

public interface DataInput

The data input interface is implemented by streams that can read primitive Java data types from a stream in a machine-independent manner.

See Also:
DataInputStream, DataOutput


 DataInput Members

DataInput Members

Interface Overview | This Package | All Packages

Methods
Name | Description
readBoolean() | Reads a boolean value from the input stream.
readByte() | Reads a signed 8-bit value from the input stream.
readChar() | Reads a Unicode char value from the input stream.
readDouble() | Reads a double value from the input stream.
readFloat() | Reads a float value from the input stream.
readFully(byte[]) | Reads b.length bytes into the byte array.
readFully(byte[], int, int) | Reads b.length bytes into the byte array.
readInt() | Reads an int value from the input stream.
readLine() | Reads the next line of text from the input stream.
readLong() | Reads a long value from the input stream.
readShort() | Reads a 16-bit value from the input stream.
readUnsignedByte() | Reads an unsigned 8-bit value from the input stream.
readUnsignedShort() | Reads an unsigned 16-bit value from the input stream.
readUTF() | Reads in a string that has been encoded using a modified UTF-8 format.
skipBytes(int) | Skips exactly n bytes of input.


 DataInput.readBoolean

DataInput.readBoolean

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean readBoolean() throws IOException
Returns
the boolean value read.
Description
Reads a boolean value from the input stream.

Exceptions
EOFException if this stream reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.


 DataInput.readByte

DataInput.readByte

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract byte readByte() throws IOException
Returns
the 8-bit value read.
Description
Reads a signed 8-bit value from the input stream.

Exceptions
EOFException if this stream reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.


 DataInput.readChar

DataInput.readChar

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract char readChar() throws IOException
Returns
the Unicode char read.
Description
Reads a Unicode char value from the input stream.

Exceptions
EOFException if this stream reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.


 DataInput.readDouble

DataInput.readDouble

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract double readDouble() throws IOException
Returns
the double value read.
Description
Reads a double value from the input stream.

Exceptions
EOFException if this stream reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.


 DataInput.readFloat

DataInput.readFloat

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract float readFloat() throws IOException
Returns
the float value read.
Description
Reads a float value from the input stream.

Exceptions
EOFException if this stream reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.


 DataInput.readFully

DataInput.readFully

Interface Overview | Interface Members | This Package | All Packages

Syntax 1
public abstract void readFully( byte b[] ) throws IOException
Parameters
b
the buffer into which the data is read.
Description
Reads b.length bytes into the byte array. This method blocks until all the bytes are read.

Exceptions
EOFException if this stream reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.

Syntax 2
public abstract void readFully( byte b[], int off, int len ) throws IOException
Parameters
b
the buffer into which the data is read.
Description
Reads b.length bytes into the byte array. This method blocks until all the bytes are read.

Exceptions
EOFException if this stream reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.


 DataInput.readInt

DataInput.readInt

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int readInt() throws IOException
Returns
the int value read.
Description
Reads an int value from the input stream.

Exceptions
EOFException if this stream reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.


 DataInput.readLine

DataInput.readLine

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String readLine() throws IOException
Returns
if this stream reaches the end before reading all the bytes.
Description
Reads the next line of text from the input stream.

Exceptions
IOException if an I/O error occurs.


 DataInput.readLong

DataInput.readLong

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract long readLong() throws IOException
Returns
the long value read.
Description
Reads a long value from the input stream.

Exceptions
EOFException if this stream reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.


 DataInput.readShort

DataInput.readShort

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract short readShort() throws IOException
Returns
the 16-bit value read.
Description
Reads a 16-bit value from the input stream.

Exceptions
EOFException if this stream reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.


 DataInput.readUnsignedByte

DataInput.readUnsignedByte

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int readUnsignedByte() throws IOException
Returns
the unsigned 8-bit value read.
Description
Reads an unsigned 8-bit value from the input stream.

Exceptions
EOFException if this stream reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.


 DataInput.readUnsignedShort

DataInput.readUnsignedShort

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int readUnsignedShort() throws IOException
Returns
the unsigned 16-bit value read.
Description
Reads an unsigned 16-bit value from the input stream.

Exceptions
EOFException if this stream reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.


 DataInput.readUTF

DataInput.readUTF

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String readUTF() throws IOException
Returns
a Unicode string.
Description
Reads in a string that has been encoded using a modified UTF-8 format.

For an exact description of this method, see the discussion in Gosling, Joy, and Steele, The Java Language Specification.

Exceptions
EOFException if this stream reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.
Exceptions
UTFDataFormatException if the bytes do not represent a valid UTF-8 encoding of a string.


 DataInput.skipBytes

DataInput.skipBytes

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int skipBytes( int n ) throws IOException
Parameters
n
the number of bytes to be skipped.
Returns
the number of bytes skipped, which is always n.
Description
Skips exactly n bytes of input.

Exceptions
EOFException if this stream reaches the end before skipping all the bytes.
Exceptions
IOException if an I/O error occurs.


 Class DataInputStream

Class java.io.DataInputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.FilterInputStream
                   |
                   +----java.io.DataInputStream

public class DataInputStream
extends FilterInputStream
implements DataInput

A data input stream lets an application read primitive Java data types from an underlying input stream in a machine-independent way. An application uses a data output stream to write data that can later be read by a data input stream.

Data input streams and data output streams represent Unicode strings in a format that is a slight modification of UTF-8. (For more information, see X/Open Company Ltd., "File System Safe UCS Transformation Format (FSS_UTF)", X/Open Preliminary Specification, Document Number: P316. This information also appears in ISO/IEC 10646, Annex P.)

All characters in the range '\u0001' to '\u007F' are represented by a single byte:

0 bits 0-7

The null character '\u0000' and characters in the range '\u0080' to '\u07FF' are represented by a pair of bytes:

1 | 1 | 0 | bits 6-10
1 | 0 | bits 0-5

Characters in the range '\u0800' to '\uFFFF' are represented by three bytes:

1 | 1 | 1 | 0 | bits 12-15
1 | 0 | bits 6-11
1 | 0 | bits 0-5

The two differences between this format and the "standard" UTF-8 format are the following:

  • The null byte '\u0000' is encoded in 2-byte format rather than 1-byte, so that the encoded strings never have embedded nulls.
  • Only the 1-byte, 2-byte, and 3-byte formats are used.

See Also:
DataOutputStream


 DataInputStream Members

DataInputStream Members

Class Overview | This Package | All Packages

Constructors
Name | Description
DataInputStream(InputStream) | Creates a new data input stream to read data from the specified input stream.

Methods
Name | Description
read(byte[]) | Reads up to byte.length bytes of data from this data input stream into an array of bytes.
read(byte[], int, int) | Reads up to len bytes of data from this data input stream into an array of bytes.
readBoolean() | Reads a boolean from this data input stream.
readByte() | Reads a signed 8-bit value from this data input stream.
readChar() | Reads a Unicode character from this data input stream.
readDouble() | Reads a double from this data input stream.
readFloat() | Reads a float from this data input stream.
readFully(byte[]) | Reads b.length bytes from this data input stream into the byte array.
readFully(byte[], int, int) | Reads exactly len bytes from this data input stream into the byte array.
readInt() | Reads a signed 32-bit integer from this data input stream.
readLine() | Reads the next line of text from this data input stream. Deprecated.
readLong() | Reads a signed 64-bit integer from this data input stream.
readShort() | Reads a signed 16-bit number from this data input stream.
readUnsignedByte() | Reads an unsigned 8-bit number from this data input stream.
readUnsignedShort() | Reads an unsigned 16-bit number from this data input stream.
readUTF() | Reads in a string that has been encoded using a modified UTF-8 format from this data input stream.
readUTF(DataInput) | Reads in a string from the specified data input stream.
skipBytes(int) | Skips exactly n bytes of input in the underlying input stream.


 DataInputStream.DataInputStream

DataInputStream.DataInputStream

Syntax
public DataInputStream( InputStream in )
Parameters
in
the input stream.
Description
Creates a new data input stream to read data from the specified input stream.


 DataInputStream.read

DataInputStream.read

Syntax 1
public final int read( byte b[] ) throws IOException
Parameters
b
the buffer into which the data is read.
Returns
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Description
Reads up to byte.length bytes of data from this data input stream into an array of bytes. This method blocks until some input is available.

The read method of DataInputStream calls the read method of its underlying input stream with the three arguments b, 0, and b.length and returns whatever value that method returns.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class FilterInputStream
See Also
in, read

Syntax 2
public final int read( byte b[], int off, int len ) throws IOException
Parameters
b
the buffer into which the data is read.
off
the start offset of the data.
len
the maximum number of bytes read.
Returns
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Description
Reads up to len bytes of data from this data input stream into an array of bytes. This method blocks until some input is available.

The read method of DataInputStream calls the read method of its underlying input stream with the same arguments and returns whatever value that method returns.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class FilterInputStream
See Also
in, read


 DataInputStream.readBoolean

DataInputStream.readBoolean

Syntax
public final boolean readBoolean() throws IOException
Returns
the boolean value read.
Description
Reads a boolean from this data input stream. This method reads a single byte from the underlying input stream. A value of 0 represents false. Any other value represents true. This method blocks until either the byte is read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this input stream has reached the end.
Exceptions
IOException if an I/O error occurs.
See Also
in


 DataInputStream.readByte

DataInputStream.readByte

Syntax
public final byte readByte() throws IOException
Returns
the next byte of this input stream as a signed 8-bit byte.
Description
Reads a signed 8-bit value from this data input stream. This method reads a byte from the underlying input stream. If the byte read is b, where 0 <= b <= 255, then the result is:
    (byte)(b)

This method blocks until either the byte is read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this input stream has reached the end.
Exceptions
IOException if an I/O error occurs.
See Also
in


 DataInputStream.readChar

DataInputStream.readChar

Syntax
public final char readChar() throws IOException
Returns
the next two bytes of this input stream as a Unicode character.
Description
Reads a Unicode character from this data input stream. This method reads two bytes from the underlying input stream. If the bytes read, in order, are b1 and b2, where 0 <= b1, b1 <= 255, then the result is equal to:
    (char)((b1 << 8) | b2)

This method blocks until either the two bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this input stream reaches the end before reading two bytes.
Exceptions
IOException if an I/O error occurs.
See Also
in


 DataInputStream.readDouble

DataInputStream.readDouble

Syntax
public final double readDouble() throws IOException
Returns
the next eight bytes of this input stream, interpreted as a double.
Description
Reads a double from this data input stream. This method reads a long value as if by the readLong method and then converts that long to a double using the longBitsToDouble method in class Double.

This method blocks until the eight bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this input stream reaches the end before reading eight bytes.
Exceptions
IOException if an I/O error occurs.
See Also
readLong, longBitsToDouble


 DataInputStream.readFloat

DataInputStream.readFloat

Syntax
public final float readFloat() throws IOException
Returns
the next four bytes of this input stream, interpreted as a float.
Description
Reads a float from this data input stream. This method reads an int value as if by the readInt method and then converts that int to a float using the intBitsToFloat method in class Float. This method blocks until the four bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this input stream reaches the end before reading four bytes.
Exceptions
IOException if an I/O error occurs.
See Also
readInt, intBitsToFloat


 DataInputStream.readFully

DataInputStream.readFully

Syntax 1
public final void readFully( byte b[] ) throws IOException
Parameters
b
the buffer into which the data is read.
Description
Reads b.length bytes from this data input stream into the byte array. This method reads repeatedly from the underlying stream until all the bytes are read. This method blocks until all the bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this input stream reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.
See Also
in

Syntax 2
public final void readFully( byte b[], int off, int len ) throws IOException
Parameters
b
the buffer into which the data is read.
off
the start offset of the data.
len
the number of bytes to read.
Description
Reads exactly len bytes from this data input stream into the byte array. This method reads repeatedly from the underlying stream until all the bytes are read. This method blocks until all the bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this input stream reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.
See Also
in


 DataInputStream.readInt

DataInputStream.readInt

Syntax
public final int readInt() throws IOException
Returns
the next four bytes of this input stream, interpreted as an int.
Description
Reads a signed 32-bit integer from this data input stream. This method reads four bytes from the underlying input stream. If the bytes read, in order, are b1, b2, b3, and b4, where 0 <= b1, b2, b3, b4 <= 255, then the result is equal to:
    (b1 << 24) | (b2 << 16) + (b3 << 8) +b4

This method blocks until the four bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this input stream reaches the end before reading four bytes.
Exceptions
IOException if an I/O error occurs.
See Also
in


 DataInputStream.readLine

DataInputStream.readLine

Syntax
public final String readLine() throws IOException
Returns
the next line of text from this input stream.
Description
Note: readLine() is deprecated. This method does not properly convert bytes to characters. As of JDK 1.1, the preferred way to read lines of text is via the BufferedReader.readLine() method. Programs that use the DataInputStream class to read lines can be converted to use the BufferedReader class by replacing code of the form
    DataInputStream d = new DataInputStream(in);
with
    BufferedReader d = new BufferedReader(new InputStreamReader(in));

Reads the next line of text from this data input stream. This method successively reads bytes from the underlying input stream until it reaches the end of a line of text.

A line of text is terminated by a carriage return character ('\r'), a newline character ('\n'), a carriage return character immediately followed by a newline character, or the end of the input stream. The line-terminating character(s), if any, are not returned as part of the string that is returned.

This method blocks until a newline character is read, a carriage return and the byte following it are read (to see if it is a newline), the end of the stream is detected, or an exception is thrown.

Exceptions
IOException if an I/O error occurs.
See Also
readLine, in


 DataInputStream.readLong

DataInputStream.readLong

Syntax
public final long readLong() throws IOException
Returns
the next eight bytes of this input stream, interpreted as a long.
Description
Reads a signed 64-bit integer from this data input stream. This method reads eight bytes from the underlying input stream. If the bytes read, in order, are b1, b2, b3, b4, b5, b6, b7, and b8, where
    0 <= b1, b2, b3, b4, b5, b6, b7, b8 <= 255,

then the result is equal to:

     ((long)b1 << 56) + ((long)b2 << 48) +
        ((long)b3 << 40) + ((long)b4 << 32) +
        ((long)b5 << 24) + (b6 << 16) +
        (b7 << 8) + b8

This method blocks until the eight bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this input stream reaches the end before reading eight bytes.
Exceptions
IOException if an I/O error occurs.
See Also
in


 DataInputStream.readShort

DataInputStream.readShort

Syntax
public final short readShort() throws IOException
Returns
the next two bytes of this input stream, interpreted as a signed 16-bit number.
Description
Reads a signed 16-bit number from this data input stream. The method reads two bytes from the underlying input stream. If the two bytes read, in order, are b1 and b2, where each of the two values is between 0 and 255, inclusive, then the result is equal to:
    (short)((b1 << 8) | b2)

This method blocks until the two bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this input stream reaches the end before reading two bytes.
Exceptions
IOException if an I/O error occurs.
See Also
in


 DataInputStream.readUnsignedByte

DataInputStream.readUnsignedByte

Syntax
public final int readUnsignedByte() throws IOException
Returns
the next byte of this input stream, interpreted as an unsigned 8-bit number.
Description
Reads an unsigned 8-bit number from this data input stream. This method reads a byte from this data input stream's underlying input stream and returns that byte. This method blocks until the byte is read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this input stream has reached the end.
Exceptions
IOException if an I/O error occurs.
See Also
in


 DataInputStream.readUnsignedShort

DataInputStream.readUnsignedShort

Syntax
public final int readUnsignedShort() throws IOException
Returns
the next two bytes of this input stream, interpreted as an unsigned 16-bit integer.
Description
Reads an unsigned 16-bit number from this data input stream. This method reads two bytes from the underlying input stream. If the bytes read, in order, are b1 and b2, where 0 <= b1, b2 <= 255, then the result is equal to:
    (b1 << 8) | b2

This method blocks until the two bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this input stream reaches the end before reading two bytes.
Exceptions
IOException if an I/O error occurs.
See Also
in


 DataInputStream.readUTF

DataInputStream.readUTF

Syntax 1
public final String readUTF() throws IOException
Returns
a Unicode string.
Description
Reads in a string that has been encoded using a modified UTF-8 format from this data input stream. This method calls readUTF(this). See readUTF(java.io.DataInput) for a more complete description of the format.

This method blocks until all the bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this input stream reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.
See Also
readUTF

Syntax 2
public static final String readUTF( DataInput in ) throws IOException
Parameters
in
a data input stream.
Returns
a Unicode string.
Description
Reads in a string from the specified data input stream. The string has been encoded using a modified UTF-8 format.

The first two bytes are read as if by readUnsignedShort. This value gives the number of following bytes that are in the encoded string, not the length of the resulting string. The following bytes are then interpreted as bytes encoding characters in the UTF-8 format and are converted into characters.

This method blocks until all the bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if the input stream reaches the end before all the bytes.
Exceptions
IOException if an I/O error occurs.
Exceptions
UTFDataFormatException if the bytes do not represent a valid UTF-8 encoding of a Unicode string.
See Also
readUnsignedShort


 DataInputStream.skipBytes

DataInputStream.skipBytes

Syntax
public final int skipBytes( int n ) throws IOException
Parameters
n
the number of bytes to be skipped.
Returns
the number of bytes skipped, which is always n.
Description
Skips exactly n bytes of input in the underlying input stream. This method blocks until all the bytes are skipped, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this input stream reaches the end before skipping all the bytes.
Exceptions
IOException if an I/O error occurs.


 Interface DataOutput

Interface java.io.DataOutput

Interface Members | This Package | All Packages

public interface DataOutput

The data output interface is implemented by streams that can write primitive Java data types to an output stream in a machine-independent manner.

See Also:
DataInput, DataOutputStream


 DataOutput Members

DataOutput Members

Interface Overview | This Package | All Packages

Methods
Name | Description
write(byte[]) | Writes b.length bytes from the specified byte array to this output stream.
write(byte[], int, int) | Writes len bytes from the specified byte array starting at offset off to this output stream.
write(int) | Writes the specified byte to this data output stream.
writeBoolean(boolean) | Writes a boolean value to this output stream.
writeByte(int) | Writes an 8-bit value to this output stream.
writeBytes(String) | Writes a string to this output stream.
writeChar(int) | Writes a char value to this output stream.
writeChars(String) | Writes a string to this output stream.
writeDouble(double) | Writes a double value to this output stream.
writeFloat(float) | Writes a float value to this output stream.
writeInt(int) | Writes an int value to this output stream.
writeLong(long) | Writes a long value to this output stream.
writeShort(int) | Writes a 16-bit value to this output stream.
writeUTF(String) | Writes a Unicode string by encoding it using modified UTF-8 format.


 DataOutput.write

DataOutput.write

Interface Overview | Interface Members | This Package | All Packages

Syntax 1
public abstract void write( int b ) throws IOException
Parameters
b
the byte to be written.
Description
Writes the specified byte to this data output stream.

Exceptions
IOException if an I/O error occurs.

Syntax 2
public abstract void write( byte b[] ) throws IOException
Parameters
b
the data.
Description
Writes b.length bytes from the specified byte array to this output stream.

Exceptions
IOException if an I/O error occurs.

Syntax 3
public abstract void write( byte b[], int off, int len ) throws IOException
Parameters
b
the data.
off
the start offset in the data.
len
the number of bytes to write.
Description
Writes len bytes from the specified byte array starting at offset off to this output stream.

Exceptions
IOException if an I/O error occurs.


 DataOutput.writeBoolean

DataOutput.writeBoolean

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void writeBoolean( boolean v ) throws IOException
Parameters
v
the boolean to be written.
Description
Writes a boolean value to this output stream.

Exceptions
IOException if an I/O error occurs.


 DataOutput.writeByte

DataOutput.writeByte

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void writeByte( int v ) throws IOException
Parameters
v
the byte value to be written.
Description
Writes an 8-bit value to this output stream.

Exceptions
IOException if an I/O error occurs.


 DataOutput.writeBytes

DataOutput.writeBytes

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void writeBytes( String s ) throws IOException
Parameters
s
the string of bytes to be written.
Description
Writes a string to this output stream.

Exceptions
IOException if an I/O error occurs.


 DataOutput.writeChar

DataOutput.writeChar

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void writeChar( int v ) throws IOException
Parameters
v
the char value to be written.
Description
Writes a char value to this output stream.

Exceptions
IOException if an I/O error occurs.


 DataOutput.writeChars

DataOutput.writeChars

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void writeChars( String s ) throws IOException
Parameters
s
the string value to be written.
Description
Writes a string to this output stream.

Exceptions
IOException if an I/O error occurs.


 DataOutput.writeDouble

DataOutput.writeDouble

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void writeDouble( double v ) throws IOException
Parameters
v
the double value to be written.
Description
Writes a double value to this output stream.

Exceptions
IOException if an I/O error occurs.


 DataOutput.writeFloat

DataOutput.writeFloat

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void writeFloat( float v ) throws IOException
Parameters
v
the float value to be written.
Description
Writes a float value to this output stream.

Exceptions
IOException if an I/O error occurs.


 DataOutput.writeInt

DataOutput.writeInt

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void writeInt( int v ) throws IOException
Parameters
v
the int value to be written.
Description
Writes an int value to this output stream.

Exceptions
IOException if an I/O error occurs.


 DataOutput.writeLong

DataOutput.writeLong

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void writeLong( long v ) throws IOException
Parameters
v
the long value to be written.
Description
Writes a long value to this output stream.

Exceptions
IOException if an I/O error occurs.


 DataOutput.writeShort

DataOutput.writeShort

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void writeShort( int v ) throws IOException
Parameters
v
the short value to be written.
Description
Writes a 16-bit value to this output stream.

Exceptions
IOException if an I/O error occurs.


 DataOutput.writeUTF

DataOutput.writeUTF

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void writeUTF( String str ) throws IOException
Parameters
str
the string value to be written.
Description
Writes a Unicode string by encoding it using modified UTF-8 format.

Exceptions
IOException if an I/O error occurs.


 Class DataOutputStream

Class java.io.DataOutputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----java.io.FilterOutputStream
                   |
                   +----java.io.DataOutputStream

public class DataOutputStream
extends FilterOutputStream
implements DataOutput

A data input stream lets an application write primitive Java data types to an output stream in a portable way. An application can then use a data input stream to read the data back in.

See Also:
DataInputStream


 DataOutputStream Members

DataOutputStream Members

Class Overview | This Package | All Packages

Fields
Name | Description
written | The number of bytes written to the data output stream.

Constructors
Name | Description
DataOutputStream(OutputStream) | Creates a new data output stream to write data to the specified underlying output stream.

Methods
Name | Description
flush() | Flushes this data output stream.
size() | Returns the number of bytes written to this data output stream.
write(byte[], int, int) | Writes len bytes from the specified byte array starting at offset off to the underlying output stream.
write(int) | Writes the specified byte to the underlying output stream.
writeBoolean(boolean) | Writes a boolean to the underlying output stream as a 1-byte value.
writeByte(int) | Writes out a byte to the underlying output stream as a 1-byte value.
writeBytes(String) | Writes out the string to the underlying output stream as a sequence of bytes.
writeChar(int) | Writes a char to the underlying output stream as a 2-byte value, high byte first.
writeChars(String) | Writes a string to the underlying output stream as a sequence of characters.
writeDouble(double) | Converts the double argument to a long using the doubleToLongBits method in class Double, and then writes that long value to the underlying output stream as an 8-byte quantity, high byte first.
writeFloat(float) | Converts the float argument to an int using the floatToIntBits method in class Float, and then writes that int value to the underlying output stream as a 4-byte quantity, high byte first.
writeInt(int) | Writes an int to the underlying output stream as four bytes, high byte first.
writeLong(long) | Writes a long to the underlying output stream as eight bytes, high byte first.
writeShort(int) | Writes a short to the underlying output stream as two bytes, high byte first.
writeUTF(String) | Writes a string to the underlying output stream using UTF-8 encoding in a machine-independent manner.


 DataOutputStream.written

DataOutputStream.written

Syntax
protected int written
Description
The number of bytes written to the data output stream.


 DataOutputStream.DataOutputStream

DataOutputStream.DataOutputStream

Syntax
public DataOutputStream( OutputStream out )
Parameters
out
the underlying output stream.
Description
Creates a new data output stream to write data to the specified underlying output stream.

See Also
out


 DataOutputStream.flush

DataOutputStream.flush

Syntax
public void flush() throws IOException
Description
Flushes this data output stream. This forces any buffered output bytes to be written out to the stream.

The flush method of DataOuputStream calls the flush method of its underlying output stream.

Exceptions
IOException if an I/O error occurs.
Overrides
flush in class FilterOutputStream
See Also
out, flush


 DataOutputStream.size

DataOutputStream.size

Syntax
public final int size()
Returns
the value of the written field.
Description
Returns the number of bytes written to this data output stream.

See Also
written


 DataOutputStream.write

DataOutputStream.write

Syntax 1
public synchronized void write( int b ) throws IOException
Parameters
b
the byte to be written.
Description
Writes the specified byte to the underlying output stream.

Exceptions
IOException if an I/O error occurs.
Overrides
write in class FilterOutputStream
See Also
out

Syntax 2
public synchronized void write( byte b[], int off, int len ) throws IOException
Parameters
b
the data.
off
the start offset in the data.
len
the number of bytes to write.
Description
Writes len bytes from the specified byte array starting at offset off to the underlying output stream.

Exceptions
IOException if an I/O error occurs.
Overrides
write in class FilterOutputStream
See Also
out


 DataOutputStream.writeBoolean

DataOutputStream.writeBoolean

Syntax
public final void writeBoolean( boolean v ) throws IOException
Parameters
v
a boolean value to be written.
Description
Writes a boolean to the underlying output stream as a 1-byte value. The value true is written out as the value (byte)1; the value false is written out as the value (byte)0.

Exceptions
IOException if an I/O error occurs.
See Also
out


 DataOutputStream.writeByte

DataOutputStream.writeByte

Syntax
public final void writeByte( int v ) throws IOException
Parameters
v
a byte value to be written.
Description
Writes out a byte to the underlying output stream as a 1-byte value.

Exceptions
IOException if an I/O error occurs.
See Also
out


 DataOutputStream.writeBytes

DataOutputStream.writeBytes

Syntax
public final void writeBytes( String s ) throws IOException
Parameters
s
a string of bytes to be written.
Description
Writes out the string to the underlying output stream as a sequence of bytes. Each character in the string is written out, in sequence, by discarding its high eight bits.

Exceptions
IOException if an I/O error occurs.
See Also
out


 DataOutputStream.writeChar

DataOutputStream.writeChar

Syntax
public final void writeChar( int v ) throws IOException
Parameters
v
a char value to be written.
Description
Writes a char to the underlying output stream as a 2-byte value, high byte first.

Exceptions
IOException if an I/O error occurs.
See Also
out


 DataOutputStream.writeChars

DataOutputStream.writeChars

Syntax
public final void writeChars( String s ) throws IOException
Parameters
s
a String value to be written.
Description
Writes a string to the underlying output stream as a sequence of characters. Each character is written to the data output stream as if by the writeChar method.

Exceptions
IOException if an I/O error occurs.
See Also
writeChar, out


 DataOutputStream.writeDouble

DataOutputStream.writeDouble

Syntax
public final void writeDouble( double v ) throws IOException
Parameters
v
a double value to be written.
Description
Converts the double argument to a long using the doubleToLongBits method in class Double, and then writes that long value to the underlying output stream as an 8-byte quantity, high byte first.

Exceptions
IOException if an I/O error occurs.
See Also
out, doubleToLongBits


 DataOutputStream.writeFloat

DataOutputStream.writeFloat

Syntax
public final void writeFloat( float v ) throws IOException
Parameters
v
a float value to be written.
Description
Converts the float argument to an int using the floatToIntBits method in class Float, and then writes that int value to the underlying output stream as a 4-byte quantity, high byte first.

Exceptions
IOException if an I/O error occurs.
See Also
out, floatToIntBits


 DataOutputStream.writeInt

DataOutputStream.writeInt

Syntax
public final void writeInt( int v ) throws IOException
Parameters
v
an int to be written.
Description
Writes an int to the underlying output stream as four bytes, high byte first.

Exceptions
IOException if an I/O error occurs.
See Also
out


 DataOutputStream.writeLong

DataOutputStream.writeLong

Syntax
public final void writeLong( long v ) throws IOException
Parameters
v
a long to be written.
Description
Writes a long to the underlying output stream as eight bytes, high byte first.

Exceptions
IOException if an I/O error occurs.
See Also
out


 DataOutputStream.writeShort

DataOutputStream.writeShort

Syntax
public final void writeShort( int v ) throws IOException
Parameters
v
a short to be written.
Description
Writes a short to the underlying output stream as two bytes, high byte first.

Exceptions
IOException if an I/O error occurs.
See Also
out


 DataOutputStream.writeUTF

DataOutputStream.writeUTF

Syntax
public final void writeUTF( String str ) throws IOException
Parameters
str
a string to be written.
Description
Writes a string to the underlying output stream using UTF-8 encoding in a machine-independent manner.

First, two bytes are written to the output stream as if by the writeShort method giving the number of bytes to follow. This value is the number of bytes actually written out, not the length of the string. Following the length, each character of the string is output, in sequence, using the UTF-8 encoding for the character.

Exceptions
IOException if an I/O error occurs.


 Class EOFException

Class java.io.EOFException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.io.EOFException

public class EOFException
extends IOException

Signals that an end of file or end of stream has been reached unexpectedly during input.

This exception is mainly used by data input streams, which generally expect a binary file in a specific format, and for which an end of stream is an unusual condition. Most other input streams return a special value on end of stream.

See Also:
DataInputStream, IOException


 EOFException Members

EOFException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
EOFException() | Constructs an EOFException with no detail message.
EOFException(String) | Constructs an EOFException with the specified detail message.


 EOFException.EOFException

EOFException.EOFException

Syntax 1
public EOFException()
Description
Constructs an EOFException with no detail message.

Syntax 2
public EOFException( String s )
Parameters
s
the detail message.
Description
Constructs an EOFException with the specified detail message.


 Interface Externalizable

Interface java.io.Externalizable

Interface Members | This Package | All Packages

public interface Externalizable
extends Serializable

Externalization allows a class to specify the methods to be used to write the object's contents to a stream and to read them back. The Externalizable interface's writeExternal and readExternal methods are implemented by a class to give the class complete control over the format and contents of the stream for an object and its supertypes. These methods must explicitly coordinate with the supertype to save its state.
Object Serialization uses the Serializable and Externalizable interfaces. Object persistence mechanisms may use them also. Each object to be stored is tested for the Externalizable interface. If the object supports it, the writeExternal method is called. If the object does not support Externalizable and does implement Serializable the object should be saved using ObjectOutputStream.
When an Externalizable object is to be reconstructed, an instance is created using the public no-arg constructor and the readExternal method called. Serializable objects are restored by reading them from an ObjectInputStream.

See Also:
ObjectOutputStream, ObjectInputStream, ObjectOutput, ObjectInput, Serializable


 Externalizable Members

Externalizable Members

Interface Overview | This Package | All Packages

Methods
Name | Description
readExternal(ObjectInput) | The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.
writeExternal(ObjectOutput) | The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings and arrays.


 Externalizable.readExternal

Externalizable.readExternal

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
Description
The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.

Exceptions
ClassNotFoundException If the class for an object being restored cannot be found.


 Externalizable.writeExternal

Externalizable.writeExternal

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void writeExternal( ObjectOutput out ) throws IOException
Description
The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings and arrays.

Exceptions
IOException Includes any I/O exceptions that may occur


 Class File

Class java.io.File

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.File

public class File
extends Object
implements Serializable

Instances of this class represent the name of a file or directory on the host file system. A file is specified by a pathname, which can either be an absolute pathname or a pathname relative to the current working directory. The pathname must follow the naming conventions of the host platform.

The File class is intended to provide an abstraction that deals with most of the machine dependent complexities of files and pathnames in a machine-independent fashion.

Note that whenever a filename or path is used it is assumed that the host's file naming conventions are used.


 File Members

File Members

Class Overview | This Package | All Packages

Fields
Name | Description
pathSeparator | The system-dependent path separator string.
pathSeparatorChar | The system-dependent path separator character.
separator | The system-dependent path separator character.
separatorChar | The system-dependent path separator string.

Constructors
Name | Description
File(File, String) | Creates a File instance that represents the file with the specified name in the specified directory.
File(String) | Creates a File instance that represents the file whose pathname is the given path argument.
File(String, String) | Creates a File instance whose pathname is the pathname of the specified directory, followed by the separator character, followed by the name argument.

Methods
Name | Description
canRead() | Tests if the application can read from the specified file.
canWrite() | Tests if the application can write to this file.
delete() | Deletes the file specified by this object.
equals(Object) | Compares this object against the specified object.
exists() | Tests if this File exists.
getAbsolutePath() | Returns the absolute pathname of the file represented by this object.
getCanonicalPath() | Returns the canonical form of this File object's pathname.
getName() | Returns the name of the file represented by this object.
getParent() | Returns the parent part of the pathname of this File object, or null if the name has no parent part.
getPath() | Returns the pathname of the file represented by this object.
hashCode() | Computes a hashcode for the file.
isAbsolute() | Tests if the file represented by this File object is an absolute pathname.
isDirectory() | Tests if the file represented by this File object is a directory.
isFile() | Tests if the file represented by this File object is a "normal" file.
lastModified() | Returns the time that the file represented by this File object was last modified.
length() | Returns the length of the file represented by this File object.
list() | Returns a list of the files in the directory specified by this File object.
list(FilenameFilter) | Returns a list of the files in the directory specified by this File that satisfy the specified filter.
mkdir() | Creates a directory whose pathname is specified by this File object.
mkdirs() | Creates a directory whose pathname is specified by this File object, including any necessary parent directories.
renameTo(File) | Renames the file specified by this File object to have the pathname given by the File argument.
toString() | Returns a string representation of this object.


 File.pathSeparator

File.pathSeparator

Syntax
public static final String pathSeparator
Description
The system-dependent path separator string. This field is initialized to contain the value of the system property path.separator.

See Also
getProperty


 File.pathSeparatorChar

File.pathSeparatorChar

Syntax
public static final char pathSeparatorChar
Description
The system-dependent path separator character. This field is initialized to contain the first character of the value of the system property path.separator. This character is often used to separate filenames in a sequence of files given as a "path list".

See Also
getProperty


 File.separator

File.separator

Syntax
public static final String separator
Description
The system-dependent path separator character. This field is initialized to contain the value of the system property file.separator.

See Also
getProperty


 File.separatorChar

File.separatorChar

Syntax
public static final char separatorChar
Description
The system-dependent path separator string. This field is initialized to contain the first character of the value of the system property file.separator. This character separates the directory and file components in a filename.

See Also
getProperty


 File.File

File.File

Syntax 1
public File( String path )
Parameters
path
the file pathname.
Description
Creates a File instance that represents the file whose pathname is the given path argument.

Exceptions
NullPointerException if the file path is equal to null.
See Also
getPath

Syntax 2
public File( String path, String name )
Parameters
path
the directory pathname.
name
the file pathname.
Description
Creates a File instance whose pathname is the pathname of the specified directory, followed by the separator character, followed by the name argument.

See Also
getPath, separator

Syntax 3
public File( File dir, String name )
Parameters
dir
the directory.
name
the file pathname.
Description
Creates a File instance that represents the file with the specified name in the specified directory.

If the directory argument is null, the resulting File instance represents a file in the (system-dependent) current directory whose pathname is the name argument. Otherwise, the File instance represents a file whose pathname is the pathname of the directory, followed by the separator character, followed by the name argument.

See Also
getPath, separator


 File.canRead

File.canRead

Syntax
public boolean canRead()
Returns
true if the file specified by this object exists and the application can read the file; false otherwise.
Description
Tests if the application can read from the specified file.

Exceptions
SecurityException if a security manager exists, its checkRead method is called with the pathname of this File to see if the application is allowed read access to the file.
See Also
getPath, checkRead


 File.canWrite

File.canWrite

Syntax
public boolean canWrite()
Returns
true if the application is allowed to write to a file whose name is specified by this object; false otherwise.
Description
Tests if the application can write to this file.

Exceptions
SecurityException if a security manager exists, its checkWrite method is called with the pathname of this File to see if the application is allowed write access to the file.
See Also
getPath, checkWrite


 File.delete

File.delete

Syntax
public boolean delete()
Returns
true if the file is successfully deleted; false otherwise.
Description
Deletes the file specified by this object. If the target file to be deleted is a directory, it must be empty for deletion to succeed.

Exceptions
SecurityException if a security manager exists, its checkDelete method is called with the pathname of this File to see if the application is allowed to delete the file.
See Also
getPath, checkDelete


 File.equals

File.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the object to compare with.
Returns
true if the objects are the same; false otherwise.
Description
Compares this object against the specified object. Returns true if and only if the argument is not null and is a File object whose pathname is equal to the pathname of this object.

Overrides
equals in class Object


 File.exists

File.exists

Syntax
public boolean exists()
Returns
true if the file specified by this object exists; false otherwise.
Description
Tests if this File exists.

Exceptions
SecurityException if a security manager exists, its checkRead method is called with the pathname of this File to see if the application is allowed read access to the file.
See Also
getPath, checkRead


 File.getAbsolutePath

File.getAbsolutePath

Syntax
public String getAbsolutePath()
Returns
a system-dependent absolute pathname for this File.
Description
Returns the absolute pathname of the file represented by this object. If this object represents an absolute pathname, then return the pathname. Otherwise, return a pathname that is a concatenation of the current user directory, the separator character, and the pathname of this file object.

The system property user.dir contains the current user directory.

See Also
getPath, isAbsolute, getProperty


 File.getCanonicalPath

File.getCanonicalPath

Syntax
public String getCanonicalPath() throws IOException
Description
Returns the canonical form of this File object's pathname. The precise definition of canonical form is system-dependent, but it usually specifies an absolute pathname in which all relative references and references to the current user directory have been completely resolved. The canonical form of a pathname of a nonexistent file may not be defined.

Exceptions
IOException If an I/O error occurs, which is possible because the construction of the canonical path may require filesystem queries.


 File.getName

File.getName

Syntax
public String getName()
Returns
the name of the file (without any directory components) represented by this File object.
Description
Returns the name of the file represented by this object. The name is everything in the pathame after the last occurrence of the separator character.

See Also
getPath, separator


 File.getParent

File.getParent

Syntax
public String getParent()
Description
Returns the parent part of the pathname of this File object, or null if the name has no parent part. The parent part is generally everything leading up to the last occurrence of the separator character, although the precise definition is system dependent. On UNIX, for example, the parent part of "/usr/lib" is "/usr", whose parent part is "/", which in turn has no parent. On Windows platforms, the parent part of "c:\java" is "c:\", which in turn has no parent.

See Also
getPath, getCanonicalPath, separator


 File.getPath

File.getPath

Syntax
public String getPath()
Returns
the pathname represented by this File object.
Description
Returns the pathname of the file represented by this object.


 File.hashCode

File.hashCode

Syntax
public int hashCode()
Returns
a hash code value for this File object.
Description
Computes a hashcode for the file.

Overrides
hashCode in class Object


 File.isAbsolute

File.isAbsolute

Syntax
public native boolean isAbsolute()
Returns
true if the pathname indicated by the File object is an absolute pathname; false otherwise.
Description
Tests if the file represented by this File object is an absolute pathname. The definition of an absolute pathname is system dependent. For example, on UNIX, a pathname is absolute if its first character is the separator character. On Windows platforms, a pathname is absolute if its first character is an ASCII '\' or '/', or if it begins with a letter followed by a colon.

See Also
getPath, separator


 File.isDirectory

File.isDirectory

Syntax
public boolean isDirectory()
Returns
true if this File exists and is a directory; false otherwise.
Description
Tests if the file represented by this File object is a directory.

Exceptions
SecurityException if a security manager exists, its checkRead method is called with the pathname of this File to see if the application is allowed read access to the file.
See Also
getPath, checkRead


 File.isFile

File.isFile

Syntax
public boolean isFile()
Returns
true if the file specified by this object exists and is a "normal" file; false otherwise.
Description
Tests if the file represented by this File object is a "normal" file.

A file is "normal" if it is not a directory and, in addition, satisfies other system-dependent criteria. Any non-directory file created by a Java application is guaranteed to be a normal file.

Exceptions
SecurityException If a security manager exists, its checkRead method is called with the pathname of this File to see if the application is allowed read access to the file.
See Also
getPath, checkRead


 File.lastModified

File.lastModified

Syntax
public long lastModified()
Returns
the time the file specified by this object was last modified, or 0L if the specified file does not exist.
Description
Returns the time that the file represented by this File object was last modified.

The return value is system dependent and should only be used to compare with other values returned by last modified. It should not be interpreted as an absolute time.

Exceptions
SecurityException if a security manager exists, its checkRead method is called with the pathname of this File to see if the application is allowed read access to the file.
See Also
getPath, checkRead


 File.length

File.length

Syntax
public long length()
Returns
the length, in bytes, of the file specified by this object, or 0L if the specified file does not exist.
Description
Returns the length of the file represented by this File object.

Exceptions
SecurityException if a security manager exists, its checkRead method is called with the pathname of this File to see if the application is allowed read access to the file.
See Also
getPath, checkRead


 File.list

File.list

Syntax 1
public String[] list()
Returns
an array of file names in the specified directory. This list does not include the current directory or the parent directory ("." and ".." on Unix systems).
Description
Returns a list of the files in the directory specified by this File object.

Exceptions
SecurityException If a security manager exists, its checkRead method is called with the pathname of this File to see if the application is allowed read access to the file.
See Also
getPath, checkRead

Syntax 2
public String[] list( FilenameFilter filter )
Parameters
filter
a filename filter.
Returns
an array of file names in the specified directory. This list does not include the current directory or the parent directory ("." and ".." on Unix systems).
Description
Returns a list of the files in the directory specified by this File that satisfy the specified filter.

Exceptions
SecurityException If a security manager exists, its checkRead method is called with the pathname of this File to see if the application is allowed read access to the file.
See Also
getPath, FilenameFilter, checkRead


 File.mkdir

File.mkdir

Syntax
public boolean mkdir()
Returns
true if the directory could be created; false otherwise.
Description
Creates a directory whose pathname is specified by this File object.

Exceptions
SecurityException if a security manager exists, its checkWrite method is called with the pathname of this File to see if the application is allowed write access to the file.
See Also
getPath, checkWrite


 File.mkdirs

File.mkdirs

Syntax
public boolean mkdirs()
Returns
true if the directory (or directories) could be created; false otherwise.
Description
Creates a directory whose pathname is specified by this File object, including any necessary parent directories.

Exceptions
SecurityException if a security manager exists, its checkWrite method is called with the pathname of each of the directories that is to be created, before any of the directories are created.
See Also
getPath, checkWrite


 File.renameTo

File.renameTo

Syntax
public boolean renameTo( File dest )
Parameters
dest
the new filename.
Returns
true if the renaming succeeds; false otherwise.
Description
Renames the file specified by this File object to have the pathname given by the File argument.

Exceptions
SecurityException if a security manager exists, its checkWrite method is called both with the pathname of this file object and with the pathname of the destination target object to see if the application is allowed to write to both files.
See Also
getPath, checkWrite


 File.toString

File.toString

Syntax
public String toString()
Returns
a string giving the pathname of this object.
Description
Returns a string representation of this object.

Overrides
toString in class Object
See Also
getPath


 Class FileDescriptor

Class java.io.FileDescriptor

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.FileDescriptor

public final class FileDescriptor
extends Object

Instances of the file descriptor class serve as an opaque handle to the underlying machine-specific structure representing an open file or an open socket.

Applications should not create their own file descriptors.

See Also:
FileInputStream, FileOutputStream, SocketInputStream, SocketOutputStream


 FileDescriptor Members

FileDescriptor Members

Class Overview | This Package | All Packages

Fields
Name | Description
err | A handle to the standard error stream.
in | A handle to the standard input stream.
out | A handle to the standard output stream.

Constructors
Name | Description
FileDescriptor() |

Methods
Name | Description
sync() | Force all system buffers to synchronize with the underlying device.
valid() | Tests if this file descriptor object is valid.


 FileDescriptor.err

FileDescriptor.err

Syntax
public static final FileDescriptor err
Description
A handle to the standard error stream.


 FileDescriptor.in

FileDescriptor.in

Syntax
public static final FileDescriptor in
Description
A handle to the standard input stream.


 FileDescriptor.out

FileDescriptor.out

Syntax
public static final FileDescriptor out
Description
A handle to the standard output stream.


 FileDescriptor.FileDescriptor

FileDescriptor.FileDescriptor

Syntax
public FileDescriptor()


 FileDescriptor.sync

FileDescriptor.sync

Syntax
public native void sync() throws SyncFailedException
Description
Force all system buffers to synchronize with the underlying device. This method returns after all modified data and attributes of this FileDescriptor have been written to the relevant device(s). In particular, if this FileDescriptor refers to a physical storage medium, such as a file in a file system, sync will not return until all in-memory modified copies of buffers associated with this FileDesecriptor have been written to the physical medium. sync is meant to be used by code that requires physical storage (such as a file) to be in a known state For example, a class that provided a simple transaction facility might use sync to ensure that all changes to a file caused by a given transaction were recorded on a storage medium. sync only affects buffers downstream of this FileDescriptor. If any in-memory buffering is being done by the application (for example, by a BufferedOutputStream object), those buffers must be flushed into the FileDescriptor (for example, by invoking OutputStream.flush) before that data will be affected by sync.

Exceptions
SyncFailedException Thrown when the buffers cannot be flushed, or because the system cannot guarantee that all the buffers have been synchronized with physical media.


 FileDescriptor.valid

FileDescriptor.valid

Syntax
public native boolean valid()
Returns
true if the file descriptor object represents a valid, open file or socket; false otherwise.
Description
Tests if this file descriptor object is valid.


 Class FileInputStream

Class java.io.FileInputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.FileInputStream

public class FileInputStream
extends InputStream

A file input stream is an input stream for reading data from a File or from a FileDescriptor.

See Also:
File, FileDescriptor, FileOutputStream


 FileInputStream Members

FileInputStream Members

Class Overview | This Package | All Packages

Constructors
Name | Description
FileInputStream(File) | Creates an input file stream to read from the specified File object.
FileInputStream(FileDescriptor) | Creates an input file stream to read from the specified file descriptor.
FileInputStream(String) | Creates an input file stream to read from a file with the specified name.

Methods
Name | Description
available() | Returns the number of bytes that can be read from this file input stream without blocking.
close() | Closes this file input stream and releases any system resources associated with the stream.
finalize() | Ensures that the close method of this file input stream is called when there are no more references to it.
getFD() | Returns the opaque file descriptor object associated with this stream.
read() | Reads a byte of data from this input stream.
read(byte[]) | Reads up to b.length bytes of data from this input stream into an array of bytes.
read(byte[], int, int) | Reads up to len bytes of data from this input stream into an array of bytes.
skip(long) | Skips over and discards n bytes of data from the input stream.


 FileInputStream.FileInputStream

FileInputStream.FileInputStream

Syntax 1
public FileInputStream( String name ) throws FileNotFoundException
Parameters
name
the system-dependent file name.
Description
Creates an input file stream to read from a file with the specified name.

Exceptions
FileNotFoundException if the file is not found.
Exceptions
SecurityException if a security manager exists, its checkRead method is called with the name argument to see if the application is allowed read access to the file.
See Also
checkRead

Syntax 2
public FileInputStream( File file ) throws FileNotFoundException
Parameters
file
the file to be opened for reading.
Description
Creates an input file stream to read from the specified File object.

Exceptions
FileNotFoundException if the file is not found.
Exceptions
SecurityException if a security manager exists, its checkRead method is called with the pathname of this File argument to see if the application is allowed read access to the file.
See Also
getPath, checkRead

Syntax 3
public FileInputStream( FileDescriptor fdObj )
Parameters
fdObj
the file descriptor to be opened for reading.
Description
Creates an input file stream to read from the specified file descriptor.

Exceptions
SecurityException if a security manager exists, its checkRead method is called with the file descriptor to see if the application is allowed to read from the specified file descriptor.
See Also
checkRead


 FileInputStream.available

FileInputStream.available

Syntax
public native int available() throws IOException
Returns
the number of bytes that can be read from this file input stream without blocking.
Description
Returns the number of bytes that can be read from this file input stream without blocking.

Exceptions
IOException if an I/O error occurs.
Overrides
available in class InputStream


 FileInputStream.close

FileInputStream.close

Syntax
public native void close() throws IOException
Description
Closes this file input stream and releases any system resources associated with the stream.

Exceptions
IOException if an I/O error occurs.
Overrides
close in class InputStream


 FileInputStream.finalize

FileInputStream.finalize

Syntax
protected void finalize() throws IOException
Description
Ensures that the close method of this file input stream is called when there are no more references to it.

Exceptions
IOException if an I/O error occurs.
Overrides
finalize in class Object
See Also
close


 FileInputStream.getFD

FileInputStream.getFD

Syntax
public final FileDescriptor getFD() throws IOException
Returns
the file descriptor object associated with this stream.
Description
Returns the opaque file descriptor object associated with this stream.

Exceptions
IOException if an I/O error occurs.
See Also
FileDescriptor


 FileInputStream.read

FileInputStream.read

Syntax 1
public native int read() throws IOException
Returns
the next byte of data, or -1 if the end of the file is reached.
Description
Reads a byte of data from this input stream. This method blocks if no input is yet available.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class InputStream

Syntax 2
public int read( byte b[] ) throws IOException
Parameters
b
the buffer into which the data is read.
Returns
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached.
Description
Reads up to b.length bytes of data from this input stream into an array of bytes. This method blocks until some input is available.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class InputStream

Syntax 3
public int read( byte b[], int off, int len ) throws IOException
Parameters
b
the buffer into which the data is read.
off
the start offset of the data.
len
the maximum number of bytes read.
Returns
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached.
Description
Reads up to len bytes of data from this input stream into an array of bytes. This method blocks until some input is available.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class InputStream


 FileInputStream.skip

FileInputStream.skip

Syntax
public native long skip( long n ) throws IOException
Parameters
n
the number of bytes to be skipped.
Returns
the actual number of bytes skipped.
Description
Skips over and discards n bytes of data from the input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. The actual number of bytes skipped is returned.

Exceptions
IOException if an I/O error occurs.
Overrides
skip in class InputStream


 Class FileNotFoundException

Class java.io.FileNotFoundException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.io.FileNotFoundException

public class FileNotFoundException
extends IOException

Signals that a file could not be found.


 FileNotFoundException Members

FileNotFoundException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
FileNotFoundException() | Constructs a FileNotFoundException with no detail message.
FileNotFoundException(String) | Constructs a FileNotFoundException with the specified detail message.


 FileNotFoundException.FileNotFoundException

FileNotFoundException.FileNotFoundException

Syntax 1
public FileNotFoundException()
Description
Constructs a FileNotFoundException with no detail message.

Syntax 2
public FileNotFoundException( String s )
Parameters
s
the detail message.
Description
Constructs a FileNotFoundException with the specified detail message.


 Class FileOutputStream

Class java.io.FileOutputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----java.io.FileOutputStream

public class FileOutputStream
extends OutputStream

A file output stream is an output stream for writing data to a File or to a FileDescriptor.

See Also:
File, FileDescriptor, FileInputStream


 FileOutputStream Members

FileOutputStream Members

Class Overview | This Package | All Packages

Constructors
Name | Description
FileOutputStream(File) | Creates a file output stream to write to the specified File object.
FileOutputStream(FileDescriptor) | Creates an output file stream to write to the specified file descriptor.
FileOutputStream(String) | Creates an output file stream to write to the file with the specified name.
FileOutputStream(String, boolean) | Creates an output file with the specified system dependent file name.

Methods
Name | Description
close() | Closes this file output stream and releases any system resources associated with this stream.
finalize() | Ensures that the close method of this file output stream is called when there are no more references to this stream.
getFD() | Returns the file descriptor associated with this stream.
write(byte[]) | Writes b.length bytes from the specified byte array to this file output stream.
write(byte[], int, int) | Writes len bytes from the specified byte array starting at offset off to this file output stream.
write(int) | Writes the specified byte to this file output stream.


 FileOutputStream.FileOutputStream

FileOutputStream.FileOutputStream

Syntax 1
public FileOutputStream( String name ) throws IOException
Parameters
name
the system-dependent filename.
Description
Creates an output file stream to write to the file with the specified name.

Exceptions
IOException if the file could not be opened for writing.
Exceptions
SecurityException if a security manager exists, its checkWrite method is called with the name argument to see if the application is allowed write access to the file.
See Also
checkWrite

Syntax 2
public FileOutputStream( String name, boolean append ) throws IOException
Parameters
name
the system dependent file name
Description
Creates an output file with the specified system dependent file name.

Exceptions
IOException If the file is not found.

Syntax 3
public FileOutputStream( File file ) throws IOException
Parameters
file
the file to be opened for writing.
Description
Creates a file output stream to write to the specified File object.

Exceptions
IOException if the file could not be opened for writing.
Exceptions
SecurityException if a security manager exists, its checkWrite method is called with the pathname of the File argument to see if the application is allowed write access to the file. This may result in a security exception.
See Also
getPath, SecurityException, checkWrite

Syntax 4
public FileOutputStream( FileDescriptor fdObj )
Parameters
fdObj
the file descriptor to be opened for writing.
Description
Creates an output file stream to write to the specified file descriptor.

Exceptions
SecurityException if a security manager exists, its checkWrite method is called with the file descriptor to see if the application is allowed to write to the specified file descriptor.
See Also
checkWrite


 FileOutputStream.close

FileOutputStream.close

Syntax
public native void close() throws IOException
Description
Closes this file output stream and releases any system resources associated with this stream.

Exceptions
IOException if an I/O error occurs.
Overrides
close in class OutputStream


 FileOutputStream.finalize

FileOutputStream.finalize

Syntax
protected void finalize() throws IOException
Description
Ensures that the close method of this file output stream is called when there are no more references to this stream.

Exceptions
IOException if an I/O error occurs.
Overrides
finalize in class Object
See Also
close


 FileOutputStream.getFD

FileOutputStream.getFD

Syntax
public final FileDescriptor getFD() throws IOException
Returns
the file descriptor object associated with this stream.
Description
Returns the file descriptor associated with this stream.

Exceptions
IOException if an I/O error occurs.
See Also
FileDescriptor


 FileOutputStream.write

FileOutputStream.write

Syntax 1
public native void write( int b ) throws IOException
Parameters
b
the byte to be written.
Description
Writes the specified byte to this file output stream.

Exceptions
IOException if an I/O error occurs.
Overrides
write in class OutputStream

Syntax 2
public void write( byte b[] ) throws IOException
Parameters
b
the data.
Description
Writes b.length bytes from the specified byte array to this file output stream.

Exceptions
IOException if an I/O error occurs.
Overrides
write in class OutputStream

Syntax 3
public void write( byte b[], int off, int len ) throws IOException
Parameters
b
the data.
off
the start offset in the data.
len
the number of bytes to write.
Description
Writes len bytes from the specified byte array starting at offset off to this file output stream.

Exceptions
IOException if an I/O error occurs.
Overrides
write in class OutputStream


 Class FileReader

Class java.io.FileReader

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Reader
           |
           +----java.io.InputStreamReader
                   |
                   +----java.io.FileReader

public class FileReader
extends InputStreamReader

Convenience class for reading character files. The constructors of this class assume that the default character encoding and the default byte-buffer size are appropriate. To specify these values yourself, construct an InputStreamReader on a FileInputStream.

See Also:
InputStreamReader, FileInputStream


 FileReader Members

FileReader Members

Class Overview | This Package | All Packages

Constructors
Name | Description
FileReader(File) |
FileReader(FileDescriptor) |
FileReader(String) |


 FileReader.FileReader

FileReader.FileReader

Syntax 1
public FileReader( String fileName ) throws FileNotFoundException

Syntax 2
public FileReader( File file ) throws FileNotFoundException

Syntax 3
public FileReader( FileDescriptor fd )


 Class FileWriter

Class java.io.FileWriter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Writer
           |
           +----java.io.OutputStreamWriter
                   |
                   +----java.io.FileWriter

public class FileWriter
extends OutputStreamWriter

Convenience class for writing character files. The constructors of this class assume that the default character encoding and the default byte-buffer size are acceptable. To specify these values yourself, construct an OutputStreamWriter on a FileOutputStream.

See Also:
OutputStreamWriter, FileOutputStream


 FileWriter Members

FileWriter Members

Class Overview | This Package | All Packages

Constructors
Name | Description
FileWriter(File) |
FileWriter(FileDescriptor) |
FileWriter(String) |
FileWriter(String, boolean) |


 FileWriter.FileWriter

FileWriter.FileWriter

Syntax 1
public FileWriter( String fileName ) throws IOException

Syntax 2
public FileWriter( String fileName, boolean append ) throws IOException

Syntax 3
public FileWriter( File file ) throws IOException

Syntax 4
public FileWriter( FileDescriptor fd )


 Interface FilenameFilter

Interface java.io.FilenameFilter

Interface Members | This Package | All Packages

public interface FilenameFilter

Instances of classes that implement this interface are used to filter filenames. These instances are used to filter directory listings in the list method of class File, and by the Abstract Window Toolkit's file dialog component.

See Also:
setFilenameFilter, File, list


 FilenameFilter Members

FilenameFilter Members

Interface Overview | This Package | All Packages

Methods
Name | Description
accept(File, String) | Tests if a specified file should be included in a file list.


 FilenameFilter.accept

FilenameFilter.accept

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean accept( File dir, String name )
Parameters
dir
the directory in which the file was found.
name
the name of the file.
Returns
true if the name should be included in the file list; false otherwise.
Description
Tests if a specified file should be included in a file list.


 Class FilterInputStream

Class java.io.FilterInputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.FilterInputStream

public class FilterInputStream
extends InputStream

This class is the superclass of all classes that filter input streams. These streams sit on top of an already existing input stream (the underlying input stream), but provide additional functionality.

The class FilterInputStream itself simply overrides all methods of InputStream with versions that pass all requests to the underlying input stream. Subclasses of FilterInputStream may further override some of these methods as well as provide additional methods and fields.


 FilterInputStream Members

FilterInputStream Members

Class Overview | This Package | All Packages

Fields
Name | Description
in | The underlying input stream.

Constructors
Name | Description
FilterInputStream(InputStream) | Creates an input stream filter built on top of the specified input stream.

Methods
Name | Description
available() | Returns the number of bytes that can be read from this input stream without blocking.
close() | Closes this input stream and releases any system resources associated with the stream.
mark(int) | Marks the current position in this input stream.
markSupported() | Tests if this input stream supports the mark and reset methods.
read() | Reads the next byte of data from this input stream.
read(byte[]) | Reads up to byte.length bytes of data from this input stream into an array of bytes.
read(byte[], int, int) | Reads up to len bytes of data from this input stream into an array of bytes.
reset() | Repositions this stream to the position at the time the mark method was last called on this input stream.
skip(long) | Skips over and discards n bytes of data from the input stream.


 FilterInputStream.in

FilterInputStream.in

Syntax
protected InputStream in
Description
The underlying input stream.


 FilterInputStream.FilterInputStream

FilterInputStream.FilterInputStream

Syntax
protected FilterInputStream( InputStream in )
Parameters
in
the underlying input stream.
Description
Creates an input stream filter built on top of the specified input stream.


 FilterInputStream.available

FilterInputStream.available

Syntax
public int available() throws IOException
Returns
the number of bytes that can be read from the input stream without blocking.
Description
Returns the number of bytes that can be read from this input stream without blocking.

The available method of FilterInputStream calls the available method of its underlying input stream and returns whatever value that method returns.

Exceptions
IOException if an I/O error occurs.
Overrides
available in class InputStream
See Also
in


 FilterInputStream.close

FilterInputStream.close

Syntax
public void close() throws IOException
Description
Closes this input stream and releases any system resources associated with the stream. The close method of FilterInputStream calls the close method of its underlying input stream.

Exceptions
IOException if an I/O error occurs.
Overrides
close in class InputStream
See Also
in


 FilterInputStream.mark

FilterInputStream.mark

Syntax
public synchronized void mark( int readlimit )
Parameters
readlimit
the maximum limit of bytes that can be read before the mark position becomes invalid.
Description
Marks the current position in this input stream. A subsequent call to the reset method repositions this stream at the last marked position so that subsequent reads re-read the same bytes.

The readlimit argument tells this input stream to allow that many bytes to be read before the mark position gets invalidated.

The mark method of FilterInputStream calls the mark method of its underlying input stream with the readlimit argument.

Overrides
mark in class InputStream
See Also
in, reset


 FilterInputStream.markSupported

FilterInputStream.markSupported

Syntax
public boolean markSupported()
Returns
true if this stream type supports the mark and reset method; false otherwise.
Description
Tests if this input stream supports the mark and reset methods. The markSupported method of FilterInputStream calls the markSupported method of its underlying input stream and returns whatever value that method returns.

Overrides
markSupported in class InputStream
See Also
in, mark, reset


 FilterInputStream.read

FilterInputStream.read

Syntax 1
public int read() throws IOException
Returns
the next byte of data, or -1 if the end of the stream is reached.
Description
Reads the next byte of data from this input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

The read method of FilterInputStream calls the read method of its underlying input stream and returns whatever value that method returns.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class InputStream
See Also
in

Syntax 2
public int read( byte b[] ) throws IOException
Parameters
b
the buffer into which the data is read.
Returns
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Description
Reads up to byte.length bytes of data from this input stream into an array of bytes. This method blocks until some input is available.

The read method of FilterInputStream calls the read method of three arguments with the arguments b, 0, and b.length, and returns whatever value that method returns.

Note that this method does not call the one-argument read method of its underlying stream with the single argument b. Subclasses of FilterInputStream do not need to override this method if they have overridden the three-argument read method.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class InputStream
See Also
read

Syntax 3
public int read( byte b[], int off, int len ) throws IOException
Parameters
b
the buffer into which the data is read.
off
the start offset of the data.
len
the maximum number of bytes read.
Returns
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Description
Reads up to len bytes of data from this input stream into an array of bytes. This method blocks until some input is available.

The read method of FilterInputStream calls the read method of its underlying input stream with the same arguments and returns whatever value that method returns.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class InputStream
See Also
in


 FilterInputStream.reset

FilterInputStream.reset

Syntax
public synchronized void reset() throws IOException
Description
Repositions this stream to the position at the time the mark method was last called on this input stream.

The reset method of FilterInputStream calls the reset method of its underlying input stream.

Stream marks are intended to be used in situations where you need to read ahead a little to see what's in the stream. Often this is most easily done by invoking some general parser. If the stream is of the type handled by the parse, it just chugs along happily. If the stream is not of that type, the parser should toss an exception when it fails. If this happens within readlimit bytes, it allows the outer code to reset the stream and try another parser.

Exceptions
IOException if the stream has not been marked or if the mark has been invalidated.
Overrides
reset in class InputStream
See Also
in, mark


 FilterInputStream.skip

FilterInputStream.skip

Syntax
public long skip( long n ) throws IOException
Parameters
n
the number of bytes to be skipped.
Returns
the actual number of bytes skipped.
Description
Skips over and discards n bytes of data from the input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. The actual number of bytes skipped is returned.

The skip method of FilterInputStream calls the skip method of its underlying input stream with the same argument, and returns whatever value that method does.

Exceptions
IOException if an I/O error occurs.
Overrides
skip in class InputStream


 Class FilterOutputStream

Class java.io.FilterOutputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----java.io.FilterOutputStream

public class FilterOutputStream
extends OutputStream

This class is the superclass of all classes that filter output streams. These streams sit on top of an already existing output stream (the underlying output stream), but provide additional functionality.

The class FilterOutputStream itself simply overrides all methods of OutputStream with versions that pass all requests to the underlying output stream. Subclasses of FilterOutputStream may further override some of these methods as well as provide additional methods and fields.


 FilterOutputStream Members

FilterOutputStream Members

Class Overview | This Package | All Packages

Fields
Name | Description
out | The underlying output stream.

Constructors
Name | Description
FilterOutputStream(OutputStream) | Creates an output stream filter built on top of the specified underlying output stream.

Methods
Name | Description
close() | Closes this output stream and releases any system resources associated with the stream.
flush() | Flushes this output stream and forces any buffered output bytes to be written out to the stream.
write(byte[]) | Writes b.length bytes to this output stream.
write(byte[], int, int) | Writes len bytes from the specified byte array starting at offset off to this output stream.
write(int) | Writes the specified byte to this output stream.


 FilterOutputStream.out

FilterOutputStream.out

Syntax
protected OutputStream out
Description
The underlying output stream.


 FilterOutputStream.FilterOutputStream

FilterOutputStream.FilterOutputStream

Syntax
public FilterOutputStream( OutputStream out )
Parameters
out
the underlying output stream.
Description
Creates an output stream filter built on top of the specified underlying output stream.


 FilterOutputStream.close

FilterOutputStream.close

Syntax
public void close() throws IOException
Description
Closes this output stream and releases any system resources associated with the stream.

The close method of FilterOutputStream calls its flush method, and then calls the close method of its underlying output stream.

Exceptions
IOException if an I/O error occurs.
Overrides
close in class OutputStream
See Also
flush, out


 FilterOutputStream.flush

FilterOutputStream.flush

Syntax
public void flush() throws IOException
Description
Flushes this output stream and forces any buffered output bytes to be written out to the stream.

The flush method of FilterOutputStream calls the flush method of its underlying output stream.

Exceptions
IOException if an I/O error occurs.
Overrides
flush in class OutputStream
See Also
out


 FilterOutputStream.write

FilterOutputStream.write

Syntax 1
public void write( int b ) throws IOException
Parameters
b
the byte.
Description
Writes the specified byte to this output stream.

The write method of FilterOutputStream calls the write method of its underlying output stream.

Exceptions
IOException if an I/O error occurs.
Overrides
write in class OutputStream

Syntax 2
public void write( byte b[] ) throws IOException
Parameters
b
the data to be written.
Description
Writes b.length bytes to this output stream.

The write method of FilterOutputStream calls its write method of three arguments with the arguments b, 0, and b.length.

Note that this method does not call the one-argument write method of its underlying stream with the single argument b.

Exceptions
IOException if an I/O error occurs.
Overrides
write in class OutputStream
See Also
write

Syntax 3
public void write( byte b[], int off, int len ) throws IOException
Parameters
b
the data.
off
the start offset in the data.
len
the number of bytes to write.
Description
Writes len bytes from the specified byte array starting at offset off to this output stream.

The write method of FilterOutputStream calls the write method of one argument on each byte to output.

Note that this method does not call the write method of its underlying input stream with the same arguments. Subclasses of FilterOutputStream should provide a more efficient implementation of this method.

Exceptions
IOException if an I/O error occurs.
Overrides
write in class OutputStream
See Also
write


 Class FilterReader

Class java.io.FilterReader

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Reader
           |
           +----java.io.FilterReader

public abstract class FilterReader
extends Reader

Abstract class for reading filtered character streams.


 FilterReader Members

FilterReader Members

Class Overview | This Package | All Packages

Fields
Name | Description
in | The underlying character-input stream, or null if the stream has been closed

Constructors
Name | Description
FilterReader(Reader) | Create a new filtered reader.

Methods
Name | Description
close() | Close the stream.
mark(int) | Mark the present position in the stream.
markSupported() | Tell whether this stream supports the mark() operation.
read() | Read a single character.
read(char[], int, int) | Read characters into a portion of an array.
ready() | Tell whether this stream is ready to be read.
reset() | Reset the stream.
skip(long) | Skip characters.


 FilterReader.in

FilterReader.in

Syntax
protected Reader in
Description
The underlying character-input stream, or null if the stream has been closed


 FilterReader.FilterReader

FilterReader.FilterReader

Syntax
protected FilterReader( Reader in )
Description
Create a new filtered reader.


 FilterReader.close

FilterReader.close

Syntax
public void close() throws IOException
Description
Close the stream.

Exceptions
IOException If an I/O error occurs
Overrides
close in class Reader


 FilterReader.mark

FilterReader.mark

Syntax
public void mark( int readAheadLimit ) throws IOException
Description
Mark the present position in the stream.

Exceptions
IOException If an I/O error occurs
Overrides
mark in class Reader


 FilterReader.markSupported

FilterReader.markSupported

Syntax
public boolean markSupported()
Description
Tell whether this stream supports the mark() operation.

Overrides
markSupported in class Reader


 FilterReader.read

FilterReader.read

Syntax 1
public int read() throws IOException
Description
Read a single character.

Exceptions
IOException If an I/O error occurs
Overrides
read in class Reader

Syntax 2
public int read( char cbuf[], int off, int len ) throws IOException
Description
Read characters into a portion of an array.

Exceptions
IOException If an I/O error occurs
Overrides
read in class Reader


 FilterReader.ready

FilterReader.ready

Syntax
public boolean ready() throws IOException
Description
Tell whether this stream is ready to be read.

Exceptions
IOException If an I/O error occurs
Overrides
ready in class Reader


 FilterReader.reset

FilterReader.reset

Syntax
public void reset() throws IOException
Description
Reset the stream.

Exceptions
IOException If an I/O error occurs
Overrides
reset in class Reader


 FilterReader.skip

FilterReader.skip

Syntax
public long skip( long n ) throws IOException
Description
Skip characters.

Exceptions
IOException If an I/O error occurs
Overrides
skip in class Reader


 Class FilterWriter

Class java.io.FilterWriter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Writer
           |
           +----java.io.FilterWriter

public abstract class FilterWriter
extends Writer

Abstract class for writing filtered character streams.


 FilterWriter Members

FilterWriter Members

Class Overview | This Package | All Packages

Fields
Name | Description
out | The underlying character-output stream.

Constructors
Name | Description
FilterWriter(Writer) | Create a new filtered writer.

Methods
Name | Description
close() | Close the stream.
flush() | Flush the stream.
write(char[], int, int) | Write a portion of an array of characters.
write(int) | Write a single character.
write(String, int, int) | Write a portion of a string.


 FilterWriter.out

FilterWriter.out

Syntax
protected Writer out
Description
The underlying character-output stream.


 FilterWriter.FilterWriter

FilterWriter.FilterWriter

Syntax
protected FilterWriter( Writer out )
Description
Create a new filtered writer.


 FilterWriter.close

FilterWriter.close

Syntax
public void close() throws IOException
Description
Close the stream.

Exceptions
IOException If an I/O error occurs
Overrides
close in class Writer


 FilterWriter.flush

FilterWriter.flush

Syntax
public void flush() throws IOException
Description
Flush the stream.

Exceptions
IOException If an I/O error occurs
Overrides
flush in class Writer


 FilterWriter.write

FilterWriter.write

Syntax 1
public void write( int c ) throws IOException
Description
Write a single character.

Exceptions
IOException If an I/O error occurs
Overrides
write in class Writer

Syntax 2
public void write( char cbuf[], int off, int len ) throws IOException
Parameters
cbuf
Buffer of characters to be written
off
Offset from which to start reading characters
len
Number of characters to be written
Description
Write a portion of an array of characters.

Exceptions
IOException If an I/O error occurs
Overrides
write in class Writer

Syntax 3
public void write( String str, int off, int len ) throws IOException
Parameters
str
String to be written
off
Offset from which to start reading characters
len
Number of characters to be written
Description
Write a portion of a string.

Exceptions
IOException If an I/O error occurs
Overrides
write in class Writer


 Class IOException

Class java.io.IOException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException

public class IOException
extends Exception

Signals that an I/O exception of some sort has occurred.

See Also:
InputStream, OutputStream


 IOException Members

IOException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
IOException() | Constructs an IOException with no detail message.
IOException(String) | Constructs an IOException with the specified detail message.


 IOException.IOException

IOException.IOException

Syntax 1
public IOException()
Description
Constructs an IOException with no detail message.

Syntax 2
public IOException( String s )
Parameters
s
the detail message.
Description
Constructs an IOException with the specified detail message.


 Class InputStream

Class java.io.InputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.InputStream

public abstract class InputStream
extends Object

This abstract class is the superclass of all classes representing an input stream of bytes.

Applications that need to define a subclass of InputStream must always provide a method that returns the next byte of input.

See Also:
BufferedInputStream, ByteArrayInputStream, DataInputStream, FilterInputStream, read, OutputStream, PushbackInputStream


 InputStream Members

InputStream Members

Class Overview | This Package | All Packages

Constructors
Name | Description
InputStream() |

Methods
Name | Description
available() | Returns the number of bytes that can be read from this input stream without blocking.
close() | Closes this input stream and releases any system resources associated with the stream.
mark(int) | Marks the current position in this input stream.
markSupported() | Tests if this input stream supports the mark and reset methods.
read() | Reads the next byte of data from this input stream.
read(byte[]) | Reads up to b.length bytes of data from this input stream into an array of bytes.
read(byte[], int, int) | Reads up to len bytes of data from this input stream into an array of bytes.
reset() | Repositions this stream to the position at the time the mark method was last called on this input stream.
skip(long) | Skips over and discards n bytes of data from this input stream.


 InputStream.InputStream

InputStream.InputStream

Syntax
public InputStream()


 InputStream.available

InputStream.available

Syntax
public int available() throws IOException
Returns
the number of bytes that can be read from this input stream without blocking.
Description
Returns the number of bytes that can be read from this input stream without blocking. The available method of InputStream returns 0. This method should be overridden by subclasses.

Exceptions
IOException if an I/O error occurs.


 InputStream.close

InputStream.close

Syntax
public void close() throws IOException
Description
Closes this input stream and releases any system resources associated with the stream.

The close method of InputStream does nothing.

Exceptions
IOException if an I/O error occurs.


 InputStream.mark

InputStream.mark

Syntax
public synchronized void mark( int readlimit )
Parameters
readlimit
the maximum limit of bytes that can be read before the mark position becomes invalid.
Description
Marks the current position in this input stream. A subsequent call to the reset method repositions this stream at the last marked position so that subsequent reads re-read the same bytes.

The readlimit arguments tells this input stream to allow that many bytes to be read before the mark position gets invalidated.

The mark method of InputStream does nothing.

See Also
reset


 InputStream.markSupported

InputStream.markSupported

Syntax
public boolean markSupported()
Returns
true if this true type supports the mark and reset method; false otherwise.
Description
Tests if this input stream supports the mark and reset methods. The markSupported method of InputStream returns false.

See Also
mark, reset


 InputStream.read

InputStream.read

Syntax 1
public abstract int read() throws IOException
Returns
the next byte of data, or -1 if the end of the stream is reached.
Description
Reads the next byte of data from this input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

A subclass must provide an implementation of this method.

Exceptions
IOException if an I/O error occurs.

Syntax 2
public int read( byte b[] ) throws IOException
Parameters
b
the buffer into which the data is read.
Returns
the total number of bytes read into the buffer, or -1 is there is no more data because the end of the stream has been reached.
Description
Reads up to b.length bytes of data from this input stream into an array of bytes.

The read method of InputStream calls the read method of three arguments with the arguments b, 0, and b.length.

Exceptions
IOException if an I/O error occurs.
See Also
read

Syntax 3
public int read( byte b[], int off, int len ) throws IOException
Parameters
b
the buffer into which the data is read.
off
the start offset of the data.
len
the maximum number of bytes read.
Returns
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Description
Reads up to len bytes of data from this input stream into an array of bytes. This method blocks until some input is available. If the first argument is null, up to len bytes are read and discarded.

The read method of InputStream reads a single byte at a time using the read method of zero arguments to fill in the array. Subclasses are encouraged to provide a more efficient implementation of this method.

Exceptions
IOException if an I/O error occurs.
See Also
read


 InputStream.reset

InputStream.reset

Syntax
public synchronized void reset() throws IOException
Description
Repositions this stream to the position at the time the mark method was last called on this input stream.

The reset method of InputStream throws an IOException, because input streams, by default, do not support mark and reset.

Stream marks are intended to be used in situations where you need to read ahead a little to see what's in the stream. Often this is most easily done by invoking some general parser. If the stream is of the type handled by the parser, it just chugs along happily. If the stream is not of that type, the parser should toss an exception when it fails, which, if it happens within readlimit bytes, allows the outer code to reset the stream and try another parser.

Exceptions
IOException if this stream has not been marked or if the mark has been invalidated.
See Also
mark, IOException


 InputStream.skip

InputStream.skip

Syntax
public long skip( long n ) throws IOException
Parameters
n
the number of bytes to be skipped.
Returns
the actual number of bytes skipped.
Description
Skips over and discards n bytes of data from this input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. The actual number of bytes skipped is returned.

The skip method of InputStream creates a byte array of length n and then reads into it until n bytes have been read or the end of the stream has been reached. Subclasses are encouraged to provide a more efficient implementation of this method.

Exceptions
IOException if an I/O error occurs.


 Class InputStreamReader

Class java.io.InputStreamReader

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Reader
           |
           +----java.io.InputStreamReader

public class InputStreamReader
extends Reader

An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and translates them into characters according to a specified character encoding. The encoding that it uses may be specified by name, or the platform's default encoding may be accepted.

Each invocation of one of an InputStreamReader's read() methods may cause one or more bytes to be read from the underlying byte-input stream. For top efficiency, consider wrapping an InputStreamReader within a BufferedReader; for example,

 BufferedReader in
   = new BufferedReader(new InputStreamReader(System.in));

See Also:
BufferedReader, InputStream


 InputStreamReader Members

InputStreamReader Members

Class Overview | This Package | All Packages

Constructors
Name | Description
InputStreamReader(InputStream) | Create an InputStreamReader that uses the default character encoding.
InputStreamReader(InputStream, String) | Create an InputStreamReader that uses the named character encoding.

Methods
Name | Description
close() | Close the stream.
getEncoding() | Return the name of the encoding being used by this stream.
read() | Read a single character.
read(char[], int, int) | Read characters into a portion of an array.
ready() | Tell whether this stream is ready to be read.


 InputStreamReader.InputStreamReader

InputStreamReader.InputStreamReader

Syntax 1
public InputStreamReader( InputStream in )
Parameters
in
An InputStream
Description
Create an InputStreamReader that uses the default character encoding.

Syntax 2
public InputStreamReader( InputStream in, String enc ) throws UnsupportedEncodingException
Parameters
in
An InputStream
enc
Name of encoding to be used
Description
Create an InputStreamReader that uses the named character encoding.

Exceptions
UnsupportedEncodingException If the named encoding is not supported


 InputStreamReader.close

InputStreamReader.close

Syntax
public void close() throws IOException
Description
Close the stream.

Exceptions
IOException If an I/O error occurs
Overrides
close in class Reader


 InputStreamReader.getEncoding

InputStreamReader.getEncoding

Syntax
public String getEncoding()
Description
Return the name of the encoding being used by this stream. May return null if the stream has been closed.


 InputStreamReader.read

InputStreamReader.read

Syntax 1
public int read() throws IOException
Returns
The character read, or -1 if the end of the stream has been reached
Description
Read a single character.

Exceptions
IOException If an I/O error occurs
Overrides
read in class Reader

Syntax 2
public int read( char cbuf[], int off, int len ) throws IOException
Parameters
cbuf
Destination buffer
off
Offset at which to start storing characters
len
Maximum number of characters to read
Returns
The number of characters read, or -1 if the end of the stream has been reached
Description
Read characters into a portion of an array.

Exceptions
IOException If an I/O error occurs
Overrides
read in class Reader


 InputStreamReader.ready

InputStreamReader.ready

Syntax
public boolean ready() throws IOException
Description
Tell whether this stream is ready to be read. An InputStreamReader is ready if its input buffer is not empty, or if bytes are available to be read from the underlying byte stream.

Exceptions
IOException If an I/O error occurs
Overrides
ready in class Reader


 Class InterruptedIOException

Class java.io.InterruptedIOException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.io.InterruptedIOException

public class InterruptedIOException
extends IOException

Signals that an I/O operation has been interrupted.

See Also:
InputStream, OutputStream, interrupt


 InterruptedIOException Members

InterruptedIOException Members

Class Overview | This Package | All Packages

Fields
Name | Description
bytesTransferred | Reports how many bytes had been transferred as part of the I/O operation before it was interrupted.

Constructors
Name | Description
InterruptedIOException() | Constructs an InterruptedIOException with no detail message.
InterruptedIOException(String) | Constructs an InterruptedIOException with the specified detail message.


 InterruptedIOException.bytesTransferred

InterruptedIOException.bytesTransferred

Syntax
public int bytesTransferred
Description
Reports how many bytes had been transferred as part of the I/O operation before it was interrupted.


 InterruptedIOException.InterruptedIOException

InterruptedIOException.InterruptedIOException

Syntax 1
public InterruptedIOException()
Description
Constructs an InterruptedIOException with no detail message.

Syntax 2
public InterruptedIOException( String s )
Parameters
s
the detail message.
Description
Constructs an InterruptedIOException with the specified detail message.


 Class InvalidClassException

Class java.io.InvalidClassException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.io.ObjectStreamException
                                   |
                                   +----java.io.InvalidClassException

public class InvalidClassException
extends ObjectStreamException

Raised when the Serialization runtime detects a problem with a Class. The class may:

  • not match the serial version of the class in the stream
  • the class contains unknown datatypes
  • the class implements only one of writeObject or readObject methods
  • the class is not public
  • the class does not have an accessible no-arg constructor


 InvalidClassException Members

InvalidClassException Members

Class Overview | This Package | All Packages

Fields
Name | Description
classname |

Constructors
Name | Description
InvalidClassException(String) | Report a InvalidClassException for the specified reason.
InvalidClassException(String, String) |

Methods
Name | Description
getMessage() | Produce the message, include the classname if present.


 InvalidClassException.classname

InvalidClassException.classname

Syntax
public String classname


 InvalidClassException.InvalidClassException

InvalidClassException.InvalidClassException

Syntax 1
public InvalidClassException( String reason )
Description
Report a InvalidClassException for the specified reason.

Syntax 2
public InvalidClassException( String cname, String reason )


 InvalidClassException.getMessage

InvalidClassException.getMessage

Syntax
public String getMessage()
Description
Produce the message, include the classname if present.

Overrides
getMessage in class Throwable


 Class InvalidObjectException

Class java.io.InvalidObjectException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.io.ObjectStreamException
                                   |
                                   +----java.io.InvalidObjectException

public class InvalidObjectException
extends ObjectStreamException

Indicates that one or more deserialized objects failed validation tests. The argument should be the reason for the failure.

See Also:
ObjectInputValidation


 InvalidObjectException Members

InvalidObjectException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
InvalidObjectException(String) | Constructs an InvalidObjectException with a detail message.


 InvalidObjectException.InvalidObjectException

InvalidObjectException.InvalidObjectException

Syntax
public InvalidObjectException( String reason )
Description
Constructs an InvalidObjectException with a detail message. The argument should be the reason why the validation of the object failed.

See Also
ObjectInputValidation


 Class LineNumberInputStream

Class java.io.LineNumberInputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.FilterInputStream
                   |
                   +----java.io.LineNumberInputStream

public class LineNumberInputStream
extends FilterInputStream

Note: LineNumberInputStream is deprecated. This class incorrectly assumes that bytes adequately represent characters. As of JDK 1.1, the preferred way to operate on character streams is via the new character-stream classes, which include a class for counting line numbers.

This class is an input stream filter that provides the added functionality of keeping track of the current line number.

A line is a sequence of bytes ending with a carriage return character ('\r'), a newline character ('\n'), or a carriage return character followed immediately by a linefeed character. In all three cases, the line terminating character(s) are returned as a single newline character.

The line number begins at 0, and is incremented by 1 when a read returns a newline character.

See Also:
LineNumberReader


 LineNumberInputStream Members

LineNumberInputStream Members

Class Overview | This Package | All Packages

Constructors
Name | Description
LineNumberInputStream(InputStream) | Constructs a newline number input stream that reads its input from the specified input stream.

Methods
Name | Description
available() | Returns the number of bytes that can be read from this input stream without blocking.
getLineNumber() | Returns the current line number.
mark(int) | Marks the current position in this input stream.
read() | Reads the next byte of data from this input stream.
read(byte[], int, int) | Reads up to len bytes of data from this input stream into an array of bytes.
reset() | Repositions this stream to the position at the time the mark method was last called on this input stream.
setLineNumber(int) | Sets the line number to the specified argument.
skip(long) | Skips over and discards n bytes of data from the input stream.


 LineNumberInputStream.LineNumberInputStream

LineNumberInputStream.LineNumberInputStream

Syntax
public LineNumberInputStream( InputStream in )
Parameters
in
the underlying input stream.
Description
Constructs a newline number input stream that reads its input from the specified input stream.


 LineNumberInputStream.available

LineNumberInputStream.available

Syntax
public int available() throws IOException
Returns
the number of bytes that can be read from this input stream without blocking.
Description
Returns the number of bytes that can be read from this input stream without blocking.

Note that if the underlying input stream is able to supply k input characters without blocking, the LineNumberInputStream can guarantee only to provide k/2 characters without blocking, because the k characters from the underlyhing input stream might consist of k/2 pairs of '\r' and '\n', which are converted to just k/2 '\n' characters.

Exceptions
IOException if an I/O error occurs.
Overrides
available in class FilterInputStream
See Also
in


 LineNumberInputStream.getLineNumber

LineNumberInputStream.getLineNumber

Syntax
public int getLineNumber()
Returns
the current line number.
Description
Returns the current line number.


 LineNumberInputStream.mark

LineNumberInputStream.mark

Syntax
public void mark( int readlimit )
Parameters
readlimit
the maximum limit of bytes that can be read before the mark position becomes invalid.
Description
Marks the current position in this input stream. A subsequent call to the reset method repositions this stream at the last marked position so that subsequent reads re-read the same bytes.

The mark method of LineNumberInputStream remembers the current line number in a private variable, and then calls the mark method of the underlying input stream.

Overrides
mark in class FilterInputStream
See Also
in, reset


 LineNumberInputStream.read

LineNumberInputStream.read

Syntax 1
public int read() throws IOException
Returns
the next byte of data, or -1 if the end of this stream is reached.
Description
Reads the next byte of data from this input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

The read method of LineNumberInputStream calls the read method of the underlying input stream. It checks for carriage returns and newline characters in the input, and modifies the current line number as appropriate. A carriage-return character or a carriage return followed by a newline character are both converted into a single newline character.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class FilterInputStream
See Also
in, getLineNumber

Syntax 2
public int read( byte b[], int off, int len ) throws IOException
Parameters
b
the buffer into which the data is read.
off
the start offset of the data.
len
the maximum number of bytes read.
Returns
the total number of bytes read into the buffer, or -1 if there is no more data because the end of this stream has been reached.
Description
Reads up to len bytes of data from this input stream into an array of bytes. This method blocks until some input is available.

The read method of LineNumberInputStream repeatedly calls the read method of zero arguments to fill in the byte array.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class FilterInputStream
See Also
read


 LineNumberInputStream.reset

LineNumberInputStream.reset

Syntax
public void reset() throws IOException
Description
Repositions this stream to the position at the time the mark method was last called on this input stream.

The reset method of LineNumberInputStream resets the line number to be the line number at the time the mark method was called, and then calls the reset method of the underlying input stream.

Stream marks are intended to be used in situations where you need to read ahead a little to see what's in the stream. Often this is most easily done by invoking some general parser. If the stream is of the type handled by the parser, it just chugs along happily. If the stream is not of that type, the parser should toss an exception when it fails, which, if it happens within readlimit bytes, allows the outer code to reset the stream and try another parser.

Exceptions
IOException if an I/O error occurs.
Overrides
reset in class FilterInputStream
See Also
in, mark


 LineNumberInputStream.setLineNumber

LineNumberInputStream.setLineNumber

Syntax
public void setLineNumber( int lineNumber )
Parameters
lineNumber
the new line number.
Description
Sets the line number to the specified argument.


 LineNumberInputStream.skip

LineNumberInputStream.skip

Syntax
public long skip( long n ) throws IOException
Parameters
n
the number of bytes to be skipped.
Returns
the actual number of bytes skipped.
Description
Skips over and discards n bytes of data from the input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. The actual number of bytes skipped is returned.

The skip method of LineNumberInputStream creates a byte array of length n and then reads into it until n bytes have been read or the end of the stream has been reached.

Exceptions
IOException if an I/O error occurs.
Overrides
skip in class FilterInputStream


 Class LineNumberReader

Class java.io.LineNumberReader

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Reader
           |
           +----java.io.BufferedReader
                   |
                   +----java.io.LineNumberReader

public class LineNumberReader
extends BufferedReader

A buffered character-input stream that keeps track of line numbers. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.


 LineNumberReader Members

LineNumberReader Members

Class Overview | This Package | All Packages

Constructors
Name | Description
LineNumberReader(Reader) | Create a new line-numbering reader, using the default input-buffer size.
LineNumberReader(Reader, int) | Create a new line-numbering reader, reading characters into a buffer of the given size.

Methods
Name | Description
getLineNumber() | Get the current line number.
mark(int) | Mark the present position in the stream.
read() | Read a single character.
read(char[], int, int) | Read characters into a portion of an array.
readLine() | Read a line of text.
reset() | Reset the stream to the most recent mark.
setLineNumber(int) | Set the current line number.
skip(long) | Skip characters.


 LineNumberReader.LineNumberReader

LineNumberReader.LineNumberReader

Syntax 1
public LineNumberReader( Reader in )
Description
Create a new line-numbering reader, using the default input-buffer size.

Syntax 2
public LineNumberReader( Reader in, int sz )
Description
Create a new line-numbering reader, reading characters into a buffer of the given size.


 LineNumberReader.getLineNumber

LineNumberReader.getLineNumber

Syntax
public int getLineNumber()
Description
Get the current line number.


 LineNumberReader.mark

LineNumberReader.mark

Syntax
public void mark( int readAheadLimit ) throws IOException
Parameters
readAheadLimit
Limit on the number of characters that may be read while still preserving the mark. After reading this many characters, attempting to reset the stream may fail.
Description
Mark the present position in the stream. Subsequent calls to reset() will attempt to reposition the stream to this point, and will also reset the line number appropriately.

Exceptions
IOException If an I/O error occurs
Overrides
mark in class BufferedReader


 LineNumberReader.read

LineNumberReader.read

Syntax 1
public int read() throws IOException
Returns
The character read, or -1 if the end of the stream has been reached
Description
Read a single character. Line terminators are compressed into single newline ('\n') characters.

Exceptions
IOException If an I/O error occurs
Overrides
read in class BufferedReader

Syntax 2
public int read( char cbuf[], int off, int len ) throws IOException
Parameters
cbuf
Destination buffer
off
Offset at which to start storing characters
len
Maximum number of characters to read
Returns
The number of bytes read, or -1 if the end of the stream has already been reached
Description
Read characters into a portion of an array.

Exceptions
IOException If an I/O error occurs
Overrides
read in class BufferedReader


 LineNumberReader.readLine

LineNumberReader.readLine

Syntax
public String readLine() throws IOException
Returns
A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached
Description
Read a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.

Exceptions
IOException If an I/O error occurs
Overrides
readLine in class BufferedReader


 LineNumberReader.reset

LineNumberReader.reset

Syntax
public void reset() throws IOException
Description
Reset the stream to the most recent mark.

Exceptions
IOException If the stream has not been marked, or if the mark has been invalidated
Overrides
reset in class BufferedReader


 LineNumberReader.setLineNumber

LineNumberReader.setLineNumber

Syntax
public void setLineNumber( int lineNumber )
Description
Set the current line number.


 LineNumberReader.skip

LineNumberReader.skip

Syntax
public long skip( long n ) throws IOException
Parameters
n
The number of characters to skip
Returns
The number of characters actually skipped
Description
Skip characters.

Exceptions
IOException If an I/O error occurs
Overrides
skip in class BufferedReader


 Class NotActiveException

Class java.io.NotActiveException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.io.ObjectStreamException
                                   |
                                   +----java.io.NotActiveException

public class NotActiveException
extends ObjectStreamException

The NotActiveException is thrown when serialization or deserialization is not active.


 NotActiveException Members

NotActiveException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
NotActiveException() | Constructor to create a new NotActiveException with no reason.
NotActiveException(String) | Constructor to create a new NotActiveException with the reason given.


 NotActiveException.NotActiveException

NotActiveException.NotActiveException

Syntax 1
public NotActiveException( String reason )
Description
Constructor to create a new NotActiveException with the reason given.

Syntax 2
public NotActiveException()
Description
Constructor to create a new NotActiveException with no reason.


 Class NotSerializableException

Class java.io.NotSerializableException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.io.ObjectStreamException
                                   |
                                   +----java.io.NotSerializableException

public class NotSerializableException
extends ObjectStreamException

Raised by a class or the serialization runtime when a class may not be serialized. The argument should be the name of the class.


 NotSerializableException Members

NotSerializableException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
NotSerializableException() |
NotSerializableException(String) |


 NotSerializableException.NotSerializableException

NotSerializableException.NotSerializableException

Syntax 1
public NotSerializableException( String classname )

Syntax 2
public NotSerializableException()


 Interface ObjectInput

Interface java.io.ObjectInput

Interface Members | This Package | All Packages

public interface ObjectInput
extends DataInput

ObjectInput extends the DataInput interface to include the writing of objects. DataInput includes methods for the input of primitive types, ObjectInput extends that interface to include objects, arrays, and Strings.

See Also:
InputStream, ObjectOutputStream, ObjectInputStream


 ObjectInput Members

ObjectInput Members

Interface Overview | This Package | All Packages

Methods
Name | Description
available() | Returns the number of bytes that can be read without blocking.
close() | Closes the input stream.
read() | Reads a byte of data.
read(byte[]) | Reads into an array of bytes.
read(byte[], int, int) | Reads into an array of bytes.
readObject() | Read and return an object.
skip(long) | Skips n bytes of input.


 ObjectInput.available

ObjectInput.available

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int available() throws IOException
Returns
the number of available bytes.
Description
Returns the number of bytes that can be read without blocking.


 ObjectInput.close

ObjectInput.close

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void close() throws IOException
Description
Closes the input stream. Must be called to release any resources associated with the stream.

Exceptions
IOException If an I/O error has occurred.


 ObjectInput.read

ObjectInput.read

Interface Overview | Interface Members | This Package | All Packages

Syntax 1
public abstract int read() throws IOException
Returns
the byte read, or -1 if the end of the stream is reached.
Description
Reads a byte of data. This method will block if no input is available.

Exceptions
IOException If an I/O error has occurred.

Syntax 2
public abstract int read( byte b[] ) throws IOException
Parameters
b
the buffer into which the data is read
Returns
the actual number of bytes read, -1 is returned when the end of the stream is reached.
Description
Reads into an array of bytes. This method will block until some input is available.

Exceptions
IOException If an I/O error has occurred.

Syntax 3
public abstract int read( byte b[], int off, int len ) throws IOException
Parameters
b
the buffer into which the data is read
off
the start offset of the data
len
the maximum number of bytes read
Returns
the actual number of bytes read, -1 is returned when the end of the stream is reached.
Description
Reads into an array of bytes. This method will block until some input is available.

Exceptions
IOException If an I/O error has occurred.


 ObjectInput.readObject

ObjectInput.readObject

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Object readObject() throws ClassNotFoundException, IOException
Description
Read and return an object. The class that implements this interface defines where the object is "read" from.

Exceptions
ClassNotFoundException If the class of a serialized object cannot be found.
Exceptions
IOException If any of the usual Input/Output related exceptions occur.


 ObjectInput.skip

ObjectInput.skip

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract long skip( long n ) throws IOException
Parameters
n
the number of bytes to be skipped
Returns
the actual number of bytes skipped.
Description
Skips n bytes of input.

Exceptions
IOException If an I/O error has occurred.


 Class ObjectInputStream

Class java.io.ObjectInputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.ObjectInputStream

public class ObjectInputStream
extends InputStream
implements ObjectInput, ObjectStreamConstants

An ObjectInputStream deserializes primitive data and objects previously written using an ObjectOutputStream. ObjectOutputStream and ObjectInputStream can provide an application with persistent storage for graphs of objects when used with a FileOutputStream and FileInputStream respectively. ObjectInputStream is used to recover those objects previously serialized. Other uses include passing objects between hosts using a socket stream or for marshaling and unmarshaling arguments and parameters in a remote communication system.

ObjectInputStream ensures that the types of all objects in the graph created from the stream match the classes present in the Java Virtual Machine. Classes are loaded as required using the standard mechanisms.

Only objects that support the java.io.Serializable or java.io.Externalizable interface can be read from streams. The method readObject is used to read an object from the stream. Java's safe casting should be used to get the desired type. In Java, strings and arrays are objects and are treated as objects during serialization. When read they need to be cast to the expected type.

Primitive data types can be read from the stream using the appropriate method on DataInput.

The default deserialization mechanism for objects restores the contents of each field to the value and type it had when it was written. Fields declared as transient or static are ignored by the deserialization process. References to other objects cause those objects to be read from the stream as necessary. Graphs of objects are restored correctly using a reference sharing mechanism. New objects are always allocated when deserializing, which prevents existing objects from being overwritten.

Reading an object is analogous to running the constructors of a new object. Memory is allocated for the object and initialized to zero (NULL). No-arg constructors are invoked for the non-serializable classes and then the fields of the serializable classes are restored from the stream starting with the serializable class closest to java.lang.object and finishing with the object's most specifiec class.

For example to read from a stream as written by the example in ObjectOutputStream:

    FileInputStream istream = new FileInputStream("t.tmp");
    ObjectInputStream p = new ObjectInputStream(istream);
    int i = p.readInt();
    String today = (String)p.readObject();
    Date date = (Date)p.readObject();
    istream.close();
Classes control how they are serialized by implementing either the java.io.Serializable or java.io.Externalizable interfaces.

Implementing the Serializable interface allows object serialization to save and restore the entire state of the object and it allows classes to evolve between the time the stream is written and the time it is read. It automatically traverses references between objects, saving and restoring entire graphs. Serializable classes that require special handling during the serialization and deserialization process should implement both of these methods:

 private void writeObject(java.io.ObjectOutputStream stream)
     throws IOException;
 private void readObject(java.io.ObjectInputStream stream)
     throws IOException, ClassNotFoundException;

The readObject method is responsible for reading and restoring the state of the object for its particular class using data written to the stream by the corresponding writeObject method. The method does not need to concern itself with the state belonging to its superclasses or subclasses. State is restored by reading data from the ObjectInputStream for the individual fields and making assignments to the appropriate fields of the object. Reading primitive data types is supported by DataInput.

Serialization does not read or assign values to the fields of any object that does not implement the java.io.Serializable interface. Subclasses of Objects that are not serializable can be serializable. In this case the non-serializable class must have a no-arg constructor to allow its fields to be initialized. In this case it is the responsibility of the subclass to save and restore the state of the non-serializable class. It is frequently the case that the fields of that class are accessible (public, package, or protected) or that there are get and set methods that can be used to restore the state.

Any exception that occurs while deserializing an object will be caught by the ObjectInputStream and abort the reading process.

Implementing the Externalizable interface allows the object to assume complete control over the contents and format of the object's serialized form. The methods of the Externalizable interface, writeExternal and readExternal, are called to save and restore the objects state. When implemented by a class they can write and read their own state using all of the methods of ObjectOutput and ObjectInput. It is the responsibility of the objects to handle any versioning that occurs.

See Also:
DataInput, ObjectOutputStream, Serializable


 ObjectInputStream Members

ObjectInputStream Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ObjectInputStream(InputStream) | Create an ObjectInputStream that reads from the specified InputStream.

Methods
Name | Description
available() | Returns the number of bytes that can be read without blocking.
close() | Closes the input stream.
defaultReadObject() | Read the non-static and non-transient fields of the current class from this stream.
enableResolveObject(boolean) | Enable the stream to allow objects read from the stream to be replaced.
read() | Reads a byte of data.
read(byte[], int, int) | Reads into an array of bytes.
readBoolean() | Reads in a boolean.
readByte() | Reads an 8 bit byte.
readChar() | Reads a 16 bit char.
readDouble() | Reads a 64 bit double.
readFloat() | Reads a 32 bit float.
readFully(byte[]) | Reads bytes, blocking until all bytes are read.
readFully(byte[], int, int) | Reads bytes, blocking until all bytes are read.
readInt() | Reads a 32 bit int.
readLine() | Reads in a line that has been terminated by a \n, \r, \r\n or EOF.
readLong() | Reads a 64 bit long.
readObject() | Read an object from the ObjectInputStream.
readShort() | Reads a 16 bit short.
readStreamHeader() | The readStreamHeader method is provided to allow subclasses to read and verify their own stream headers.
readUnsignedByte() | Reads an unsigned 8 bit byte.
readUnsignedShort() | Reads an unsigned 16 bit short.
readUTF() | Reads a UTF format String.
registerValidation(ObjectInputValidation, int) | Register an object to be validated before the graph is returned.
resolveClass(ObjectStreamClass) | Subclasses may implement this method to allow classes to be fetched from an alternate source.
resolveObject(Object) | This method will allow trusted subclasses of ObjectInputStream to substitute one object for another during deserialization.
skipBytes(int) | Skips bytes, block until all bytes are skipped.


 ObjectInputStream.ObjectInputStream

ObjectInputStream.ObjectInputStream

Syntax
public ObjectInputStream( InputStream in ) throws IOException, StreamCorruptedException
Description
Create an ObjectInputStream that reads from the specified InputStream. The stream header containing the magic number and version number are read from the stream and verified. This method will block until the corresponding ObjectOutputStream has written and flushed the header.

Exceptions
StreamCorruptedException The version or magic number are incorrect.
Exceptions
IOException An exception occurred in the underlying stream.


 ObjectInputStream.available

ObjectInputStream.available

Syntax
public int available() throws IOException
Returns
the number of available bytes.
Description
Returns the number of bytes that can be read without blocking.

Overrides
available in class InputStream


 ObjectInputStream.close

ObjectInputStream.close

Syntax
public void close() throws IOException
Description
Closes the input stream. Must be called to release any resources associated with the stream.

Exceptions
IOException If an I/O error has occurred.
Overrides
close in class InputStream


 ObjectInputStream.defaultReadObject

ObjectInputStream.defaultReadObject

Syntax
public final void defaultReadObject() throws IOException, ClassNotFoundException, NotActiveException
Description
Read the non-static and non-transient fields of the current class from this stream. This may only be called from the readObject method of the class being deserialized. It will throw the NotActiveException if it is called otherwise.

Exceptions
ClassNotFoundException if the class of a serialized object could not be found.
Exceptions
IOException if an I/O error occurs.
Exceptions
NotActiveException if the stream is not currently reading objects.


 ObjectInputStream.enableResolveObject

ObjectInputStream.enableResolveObject

Syntax
protected final boolean enableResolveObject( boolean enable ) throws SecurityException
Description
Enable the stream to allow objects read from the stream to be replaced. If the stream is a trusted class it is allowed to enable replacment. Trusted classes are those classes with a classLoader equals null.

When enabled the resolveObject method is called for every object being deserialized.

Exceptions
SecurityException The classloader of this stream object is non-null.


 ObjectInputStream.read

ObjectInputStream.read

Syntax 1
public int read() throws IOException
Returns
the byte read, or -1 if the end of the stream is reached.
Description
Reads a byte of data. This method will block if no input is available.

Exceptions
IOException If an I/O error has occurred.
Overrides
read in class InputStream

Syntax 2
public int read( byte data[], int offset, int length ) throws IOException
Parameters
b
the buffer into which the data is read
off
the start offset of the data
len
the maximum number of bytes read
Returns
the actual number of bytes read, -1 is returned when the end of the stream is reached.
Description
Reads into an array of bytes. This method will block until some input is available.

Exceptions
IOException If an I/O error has occurred.
Overrides
read in class InputStream


 ObjectInputStream.readBoolean

ObjectInputStream.readBoolean

Syntax
public boolean readBoolean() throws IOException
Returns
the boolean read.
Description
Reads in a boolean.

Exceptions
EOFException If end of file is reached.
Exceptions
IOException If other I/O error has occurred.


 ObjectInputStream.readByte

ObjectInputStream.readByte

Syntax
public byte readByte() throws IOException
Returns
the 8 bit byte read.
Description
Reads an 8 bit byte.

Exceptions
EOFException If end of file is reached.
Exceptions
IOException If other I/O error has occurred.


 ObjectInputStream.readChar

ObjectInputStream.readChar

Syntax
public char readChar() throws IOException
Returns
the 16 bit char read.
Description
Reads a 16 bit char.

Exceptions
EOFException If end of file is reached.
Exceptions
IOException If other I/O error has occurred.


 ObjectInputStream.readDouble

ObjectInputStream.readDouble

Syntax
public double readDouble() throws IOException
Returns
the 64 bit double read.
Description
Reads a 64 bit double.

Exceptions
EOFException If end of file is reached.
Exceptions
IOException If other I/O error has occurred.


 ObjectInputStream.readFloat

ObjectInputStream.readFloat

Syntax
public float readFloat() throws IOException
Returns
the 32 bit float read.
Description
Reads a 32 bit float.

Exceptions
EOFException If end of file is reached.
Exceptions
IOException If other I/O error has occurred.


 ObjectInputStream.readFully

ObjectInputStream.readFully

Syntax 1
public void readFully( byte data[] ) throws IOException
Parameters
b
the buffer into which the data is read
Description
Reads bytes, blocking until all bytes are read.

Exceptions
EOFException If end of file is reached.
Exceptions
IOException If other I/O error has occurred.

Syntax 2
public void readFully( byte data[], int offset, int size ) throws IOException
Parameters
b
the buffer into which the data is read
off
the start offset of the data
len
the maximum number of bytes to read
Description
Reads bytes, blocking until all bytes are read.

Exceptions
EOFException If end of file is reached.
Exceptions
IOException If other I/O error has occurred.


 ObjectInputStream.readInt

ObjectInputStream.readInt

Syntax
public int readInt() throws IOException
Returns
the 32 bit integer read.
Description
Reads a 32 bit int.

Exceptions
EOFException If end of file is reached.
Exceptions
IOException If other I/O error has occurred.


 ObjectInputStream.readLine

ObjectInputStream.readLine

Syntax
public String readLine() throws IOException
Returns
a String copy of the line.
Description
Reads in a line that has been terminated by a \n, \r, \r\n or EOF.


 ObjectInputStream.readLong

ObjectInputStream.readLong

Syntax
public long readLong() throws IOException
Returns
the read 64 bit long.
Description
Reads a 64 bit long.

Exceptions
EOFException If end of file is reached.
Exceptions
IOException If other I/O error has occurred.


 ObjectInputStream.readObject

ObjectInputStream.readObject

Syntax
public final Object readObject() throws OptionalDataException, ClassNotFoundException, IOException
Description
Read an object from the ObjectInputStream. The class of the object, the signature of the class, and the values of the non-transient and non-static fields of the class and all of its supertypes are read. Default deserializing for a class can be overriden using the writeObject and readObject methods. Objects referenced by this object are read transitively so that a complete equivalent graph of objects is reconstructed by readObject.

The root object is completly restored when all of its fields and the objects it references are completely restored. At this point the object validation callbacks are executed in order based on their registered priorities. The callbacks are registered by objects (in the readObject special methods) as they are individually restored. Exceptions are thrown for problems with the InputStream and for classes that should not be deserialized. All exceptions are fatal to the InputStream and leave it in an indeterminate state; it is up to the caller to ignore or recover the stream state.

Exceptions
ClassNotFoundException Class of a serialized object cannot be found.
Exceptions
InvalidClassException Something is wrong with a class used by serialization.
Exceptions
StreamCorruptedException Control information in the stream is inconsistent.
Exceptions
OptionalDataException Primitive data was found in the stream instead of objects.
Exceptions
IOException Any of the usual Input/Output related exceptions.


 ObjectInputStream.readShort

ObjectInputStream.readShort

Syntax
public short readShort() throws IOException
Returns
the 16 bit short read.
Description
Reads a 16 bit short.

Exceptions
EOFException If end of file is reached.
Exceptions
IOException If other I/O error has occurred.


 ObjectInputStream.readStreamHeader

ObjectInputStream.readStreamHeader

Syntax
protected void readStreamHeader() throws IOException, StreamCorruptedException
Description
The readStreamHeader method is provided to allow subclasses to read and verify their own stream headers. It reads and verifies the magic number and version number.


 ObjectInputStream.readUnsignedByte

ObjectInputStream.readUnsignedByte

Syntax
public int readUnsignedByte() throws IOException
Returns
the 8 bit byte read.
Description
Reads an unsigned 8 bit byte.

Exceptions
EOFException If end of file is reached.
Exceptions
IOException If other I/O error has occurred.


 ObjectInputStream.readUnsignedShort

ObjectInputStream.readUnsignedShort

Syntax
public int readUnsignedShort() throws IOException
Returns
the 16 bit short read.
Description
Reads an unsigned 16 bit short.

Exceptions
EOFException If end of file is reached.
Exceptions
IOException If other I/O error has occurred.


 ObjectInputStream.readUTF

ObjectInputStream.readUTF

Syntax
public String readUTF() throws IOException
Returns
the String.
Description
Reads a UTF format String.


 ObjectInputStream.registerValidation

ObjectInputStream.registerValidation

Syntax
public synchronized void registerValidation( ObjectInputValidation obj, int prio ) throws NotActiveException, InvalidObjectException
Parameters
obj
the object to receive the validation callback.
prio
controls the order of callbacks;zero is a good default. Use higher numbers to be called back earlier, lower numbers for later callbacks. Within a priority, callbacks are processed in no particular order.
Description
Register an object to be validated before the graph is returned. While similar to resolveObject these validations are called after the entire graph has been reconstituted. Typically, a readObject method will register the object with the stream so that when all of the objects are restored a final set of validations can be performed.

Exceptions
NotActiveException The stream is not currently reading objects so it is invalid to register a callback.
Exceptions
InvalidObjectException The validation object is null.


 ObjectInputStream.resolveClass

ObjectInputStream.resolveClass

Syntax
protected Class resolveClass( ObjectStreamClass v ) throws IOException, ClassNotFoundException
Description
Subclasses may implement this method to allow classes to be fetched from an alternate source. The corresponding method in ObjectOutputStream is annotateClass. This method will be invoked only once for each unique class in the stream. This method can be implemented by subclasses to use an alternate loading mechanism but must return a Class object. Once returned, the serialVersionUID of the class is compared to the serialVersionUID of the serialized class. If there is a mismatch, the deserialization fails and an exception is raised.

By default the class name is resolved relative to the class that called readObject.

Exceptions
ClassNotFoundException If class of a serialized object cannot be found.


 ObjectInputStream.resolveObject

ObjectInputStream.resolveObject

Syntax
protected Object resolveObject( Object obj ) throws IOException
Description
This method will allow trusted subclasses of ObjectInputStream to substitute one object for another during deserialization. Replacing objects is disabled until enableResolveObject is called. The enableResolveObject method checks that the stream requesting to resolve object can be trusted. Every reference to serializable objects is passed to resolveObject. To insure that the private state of objects is not unintentionally exposed only trusted streams may use resolveObject.

This method is called after an object has been read but before it is returned from readObject. The default resolveObject method just returns the new object.

When a subclass is replacing objects it must insure that the substituted object is compatible with every field where the reference will be stored. Objects whose type is not a subclass of the type of the field or array element abort the serialization by raising an exception and the object is not be stored.

This method is called only once when each object is first encountered. All subsequent references to the object will be redirected to the new object.

Exceptions
IOException Any of the usual Input/Output exceptions.


 ObjectInputStream.skipBytes

ObjectInputStream.skipBytes

Syntax
public int skipBytes( int len ) throws IOException
Parameters
n
the number of bytes to be skipped
Returns
the actual number of bytes skipped.
Description
Skips bytes, block until all bytes are skipped.

Exceptions
EOFException If end of file is reached.
Exceptions
IOException If other I/O error has occurred.


 Interface ObjectInputValidation

Interface java.io.ObjectInputValidation

Interface Members | This Package | All Packages

public interface ObjectInputValidation

Callback interface to allow validation of objects within a graph. Allows an object to be called when a complete graph of objects has been deserialized.

See Also:
ObjectInputStream, registerValidation


 ObjectInputValidation Members

ObjectInputValidation Members

Interface Overview | This Package | All Packages

Methods
Name | Description
validateObject() | Validates the object


 ObjectInputValidation.validateObject

ObjectInputValidation.validateObject

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void validateObject() throws InvalidObjectException
Description
Validates the object

Exceptions
InvalidObjectException If the object cannot validate itself.


 Interface ObjectOutput

Interface java.io.ObjectOutput

Interface Members | This Package | All Packages

public interface ObjectOutput
extends DataOutput

ObjectOutput extends the DataOutput interface to include writing of objects. DataOutput includes methods for output of primitive types, ObjectOutput extends that interface to include objects, arrays, and Strings.

See Also:
InputStream, ObjectOutputStream, ObjectInputStream


 ObjectOutput Members

ObjectOutput Members

Interface Overview | This Package | All Packages

Methods
Name | Description
close() | Closes the stream.
flush() | Flushes the stream.
write(byte[]) | Writes an array of bytes.
write(byte[], int, int) | Writes a sub array of bytes.
write(int) | Writes a byte.
writeObject(Object) | Write an object to the underlying storage or stream.


 ObjectOutput.close

ObjectOutput.close

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void close() throws IOException
Description
Closes the stream. This method must be called to release any resources associated with the stream.

Exceptions
IOException If an I/O error has occurred.


 ObjectOutput.flush

ObjectOutput.flush

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void flush() throws IOException
Description
Flushes the stream. This will write any buffered output bytes.

Exceptions
IOException If an I/O error has occurred.


 ObjectOutput.write

ObjectOutput.write

Interface Overview | Interface Members | This Package | All Packages

Syntax 1
public abstract void write( int b ) throws IOException
Parameters
b
the byte
Description
Writes a byte. This method will block until the byte is actually written.

Exceptions
IOException If an I/O error has occurred.

Syntax 2
public abstract void write( byte b[] ) throws IOException
Parameters
b
the data to be written
Description
Writes an array of bytes. This method will block until the bytes are actually written.

Exceptions
IOException If an I/O error has occurred.

Syntax 3
public abstract void write( byte b[], int off, int len ) throws IOException
Parameters
b
the data to be written
off
the start offset in the data
len
the number of bytes that are written
Description
Writes a sub array of bytes.

Exceptions
IOException If an I/O error has occurred.


 ObjectOutput.writeObject

ObjectOutput.writeObject

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void writeObject( Object obj ) throws IOException
Description
Write an object to the underlying storage or stream. The class that implements this interface defines how the object is written.

Exceptions
IOException Any of the usual Input/Output related exceptions.


 Class ObjectOutputStream

Class java.io.ObjectOutputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----java.io.ObjectOutputStream

public class ObjectOutputStream
extends OutputStream
implements ObjectOutput, ObjectStreamConstants

An ObjectOutputStream writes primitive data types and graphs of Java objects to an OutputStream. The objects can be read (reconstituted) using an ObjectInputStream. Persistent storage of objects can be accomplished by using a file for the stream. If the stream is a network socket stream, the objects can be reconsituted on another host or in another process.

Only objects that support the java.io.Serializable interface can be written to streams. The class of each serializable object is encoded including the class name and signature of the class, the values of the object's fields and arrays, and the closure of any other objects referenced from the initial objects.

The method writeObject is used to write an object to the stream. Any object, including Strings and arrays, is written with writeObject. Multiple objects or primitives can be written to the stream. The objects must be read back from the corresponding ObjectInputstream with the same types and in the same order as they were written.

Primitive data types can also be written to the stream using the appropriate methods from DataOutput. Strings can also be written using the writeUTF method.

The default serialization mechanism for an object writes the class of the object, the class signature, and the values of all non-transient and non-static fields. References to other objects (except in transient or static fields) cause those objects to be written also. Multiple references to a single object are encoded using a reference sharing mechanism so that graphs of objects can be restored to the same shape as when the original was written.

For example to write an object that can be read by the example in ObjectInputStream:

    FileOutputStream ostream = new FileOutputStream("t.tmp");
    ObjectOutputStream p = new ObjectOutputStream(ostream);
    p.writeInt(12345);
    p.writeObject("Today");
    p.writeObject(new Date());
    p.flush();
    ostream.close();
Classes that require special handling during the serialization and deserialization process must implement special methods with these exact signatures:

 private void readObject(java.io.ObjectInputStream stream)
     throws IOException, ClassNotFoundException;
 private void writeObject(java.io.ObjectOutputStream stream)
     throws IOException

The writeObject method is responsible for writing the state of the object for its particular class so that the corresponding readObject method can restore it. The method does not need to concern itself with the state belonging to the object's superclasses or subclasses. State is saved by writing the individual fields to the ObjectOutputStream using the writeObject method or by using the methods for primitive data types supported by DataOutput.

Serialization does not write out the fields of any object that does not implement the java.io.Serializable interface. Subclasses of Objects that are not serializable can be serializable. In this case the non-serializable class must have a no-arg constructor to allow its fields to be initialized. In this case it is the responsibility of the subclass to save and restore the state of the non-serializable class. It is frequently the case that the fields of that class are accessible (public, package, or protected) or that there are get and set methods that can be used to restore the state.

Serialization of an object can be prevented by implementing writeObject and readObject methods that throw the NotSerializableException. The exception will be caught by the ObjectOutputStream and abort the serialization process. Implementing the Externalizable interface allows the object to assume complete control over the contents and format of the object's serialized form. The methods of the Externalizable interface, writeExternal and readExternal, are called to save and restore the objects state. When implemented by a class they can write and read their own state using all of the methods of ObjectOutput and ObjectInput. It is the responsibility of the objects to handle any versioning that occurs.

See Also:
DataOutput, ObjectInputStream, Serializable, Externalizable


 ObjectOutputStream Members

ObjectOutputStream Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ObjectOutputStream(OutputStream) | Creates an ObjectOutputStream that writes to the specified OutputStream.

Methods
Name | Description
annotateClass(Class) | Subclasses may implement this method to allow class data to be stored in the stream.
close() | Closes the stream.
defaultWriteObject() | Write the non-static and non-transient fields of the current class to this stream.
drain() | Drain any buffered data in ObjectOutputStream.
enableReplaceObject(boolean) | Enable the stream to do replacement of objects in the stream.
flush() | Flushes the stream.
replaceObject(Object) | This method will allow trusted subclasses of ObjectOutputStream to substitute one object for another during serialization.
reset() | Reset will disregard the state of any objects already written to the stream.
write(byte[]) | Writes an array of bytes.
write(byte[], int, int) | Writes a sub array of bytes.
write(int) | Writes a byte.
writeBoolean(boolean) | Writes a boolean.
writeByte(int) | Writes an 8 bit byte.
writeBytes(String) | Writes a String as a sequence of bytes.
writeChar(int) | Writes a 16 bit char.
writeChars(String) | Writes a String as a sequence of chars.
writeDouble(double) | Writes a 64 bit double.
writeFloat(float) | Writes a 32 bit float.
writeInt(int) | Writes a 32 bit int.
writeLong(long) | Writes a 64 bit long.
writeObject(Object) | Write the specified object to the ObjectOutputStream.
writeShort(int) | Writes a 16 bit short.
writeStreamHeader() | The writeStreamHeader method is provided so subclasses can append or prepend their own header to the stream.
writeUTF(String) | Writes a String in UTF format.


 ObjectOutputStream.ObjectOutputStream

ObjectOutputStream.ObjectOutputStream

Syntax
public ObjectOutputStream( OutputStream out ) throws IOException
Description
Creates an ObjectOutputStream that writes to the specified OutputStream. The stream header is written to the stream. The caller may want to call flush immediately so that the corresponding ObjectInputStream can read the header immediately.

Exceptions
IOException Any exception thrown by the underlying OutputStream.


 ObjectOutputStream.annotateClass

ObjectOutputStream.annotateClass

Syntax
protected void annotateClass( Class cl ) throws IOException
Description
Subclasses may implement this method to allow class data to be stored in the stream. By default this method does nothing. The corresponding method in ObjectInputStream is resolveClass. This method is called exactly once for each unique class in the stream. The class name and signature will have already been written to the stream. This method may make free use of the ObjectOutputStream to save any representation of the class it deems suitable (for example, the bytes of the class file). The resolveClass method in the corresponding subclass of ObjectInputStream must read and use any data or objects written by annotateClass. annotateClass is called only for normal classes. Arrays are not normal classes.

Exceptions
IOException Any exception thrown by the underlying OutputStream.


 ObjectOutputStream.close

ObjectOutputStream.close

Syntax
public void close() throws IOException
Description
Closes the stream. This method must be called to release any resources associated with the stream.

Exceptions
IOException If an I/O error has occurred.
Overrides
close in class OutputStream


 ObjectOutputStream.defaultWriteObject

ObjectOutputStream.defaultWriteObject

Syntax
public final void defaultWriteObject() throws IOException
Description
Write the non-static and non-transient fields of the current class to this stream. This may only be called from the writeObject method of the class being serialized. It will throw the NotActiveException if it is called otherwise.


 ObjectOutputStream.drain

ObjectOutputStream.drain

Syntax
protected void drain() throws IOException
Description
Drain any buffered data in ObjectOutputStream. Similar to flush but does not propagate the flush to the underlaying stream.


 ObjectOutputStream.enableReplaceObject

ObjectOutputStream.enableReplaceObject

Syntax
protected final boolean enableReplaceObject( boolean enable ) throws SecurityException
Description
Enable the stream to do replacement of objects in the stream. If the stream is a trusted class it is allowed to enable replacement. Trusted classes are those classes with a classLoader equals null.

When enabled the replaceObject method is called for every object being serialized.

Exceptions
SecurityException The classloader of this stream object is non-null.


 ObjectOutputStream.flush

ObjectOutputStream.flush

Syntax
public void flush() throws IOException
Description
Flushes the stream. This will write any buffered output bytes and flush through to the underlying stream.

Exceptions
IOException If an I/O error has occurred.
Overrides
flush in class OutputStream


 ObjectOutputStream.replaceObject

ObjectOutputStream.replaceObject

Syntax
protected Object replaceObject( Object obj ) throws IOException
Description
This method will allow trusted subclasses of ObjectOutputStream to substitute one object for another during serialization. Replacing objects is disabled until enableReplaceObject is called. The enableReplaceObject method checks that the stream requesting to do replacment can be trusted. Every reference to serializable objects is passed to replaceObject. To insure that the private state of objects is not unintentionally exposed only trusted streams may use replaceObject.

When a subclass is replacing objects it must insure that either a complementary substitution must be made during deserialization or that the substituted object is compatible with every field where the reference will be stored. Objects whose type is not a subclass of the type of the field or array element abort the serialization by raising an exception and the object is not be stored.

This method is called only once when each object is first encountered. All subsequent references to the object will be redirected to the new object. This method should return the object to be substituted or the original object.

Null can be returned as the object to be substituted, but may cause NullReferenceException in classes that contain references to the original object since they may be expecting an object instead of null.

Exceptions
IOException Any exception thrown by the underlying OutputStream.


 ObjectOutputStream.reset

ObjectOutputStream.reset

Syntax
public void reset() throws IOException
Description
Reset will disregard the state of any objects already written to the stream. The state is reset to be the same as a new ObjectOutputStream. The current point in the stream is marked as reset so the corresponding ObjectInputStream will be reset at the same point. Objects previously written to the stream will not be refered to as already being in the stream. They will be written to the stream again.


 ObjectOutputStream.write

ObjectOutputStream.write

Syntax 1
public void write( int data ) throws IOException
Parameters
b
the byte
Description
Writes a byte. This method will block until the byte is actually written.

Exceptions
IOException If an I/O error has occurred.
Overrides
write in class OutputStream

Syntax 2
public void write( byte b[] ) throws IOException
Parameters
b
the data to be written
Description
Writes an array of bytes. This method will block until the bytes are actually written.

Exceptions
IOException If an I/O error has occurred.
Overrides
write in class OutputStream

Syntax 3
public void write( byte b[], int off, int len ) throws IOException
Parameters
b
the data to be written
off
the start offset in the data
len
the number of bytes that are written
Description
Writes a sub array of bytes.

Exceptions
IOException If an I/O error has occurred.
Overrides
write in class OutputStream


 ObjectOutputStream.writeBoolean

ObjectOutputStream.writeBoolean

Syntax
public void writeBoolean( boolean data ) throws IOException
Parameters
data
the boolean to be written
Description
Writes a boolean.


 ObjectOutputStream.writeByte

ObjectOutputStream.writeByte

Syntax
public void writeByte( int data ) throws IOException
Parameters
data
the byte value to be written
Description
Writes an 8 bit byte.


 ObjectOutputStream.writeBytes

ObjectOutputStream.writeBytes

Syntax
public void writeBytes( String data ) throws IOException
Parameters
s
the String of bytes to be written
Description
Writes a String as a sequence of bytes.


 ObjectOutputStream.writeChar

ObjectOutputStream.writeChar

Syntax
public void writeChar( int data ) throws IOException
Parameters
data
the char value to be written
Description
Writes a 16 bit char.


 ObjectOutputStream.writeChars

ObjectOutputStream.writeChars

Syntax
public void writeChars( String data ) throws IOException
Parameters
s
the String of chars to be written
Description
Writes a String as a sequence of chars.


 ObjectOutputStream.writeDouble

ObjectOutputStream.writeDouble

Syntax
public void writeDouble( double data ) throws IOException
Parameters
data
the double value to be written
Description
Writes a 64 bit double.


 ObjectOutputStream.writeFloat

ObjectOutputStream.writeFloat

Syntax
public void writeFloat( float data ) throws IOException
Parameters
data
the float value to be written
Description
Writes a 32 bit float.


 ObjectOutputStream.writeInt

ObjectOutputStream.writeInt

Syntax
public void writeInt( int data ) throws IOException
Parameters
data
the integer value to be written
Description
Writes a 32 bit int.


 ObjectOutputStream.writeLong

ObjectOutputStream.writeLong

Syntax
public void writeLong( long data ) throws IOException
Parameters
data
the long value to be written
Description
Writes a 64 bit long.


 ObjectOutputStream.writeObject

ObjectOutputStream.writeObject

Syntax
public final void writeObject( Object obj ) throws IOException
Description
Write the specified object to the ObjectOutputStream. The class of the object, the signature of the class, and the values of the non-transient and non-static fields of the class and all of its supertypes are written. Default serialization for a class can be overridden using the writeObject and the readObject methods. Objects referenced by this object are written transitively so that a complete equivalent graph of objects can be reconstructed by an ObjectInputStream.

Exceptions are thrown for problems with the OutputStream and for classes that should not be serialized. All exceptions are fatal to the OutputStream, which is left in an indeterminate state, and it is up to the caller to ignore or recover the stream state.

Exceptions
InvalidClassException Something is wrong with a class used by serialization.
Exceptions
NotSerializableException Some object to be serialized does not implement the java.io.Serializable interface.
Exceptions
IOException Any exception thrown by the underlying OutputStream.


 ObjectOutputStream.writeShort

ObjectOutputStream.writeShort

Syntax
public void writeShort( int data ) throws IOException
Parameters
data
the short value to be written
Description
Writes a 16 bit short.


 ObjectOutputStream.writeStreamHeader

ObjectOutputStream.writeStreamHeader

Syntax
protected void writeStreamHeader() throws IOException
Description
The writeStreamHeader method is provided so subclasses can append or prepend their own header to the stream. It writes the magic number and version to the stream.


 ObjectOutputStream.writeUTF

ObjectOutputStream.writeUTF

Syntax
public void writeUTF( String data ) throws IOException
Parameters
str
the String in UTF format
Description
Writes a String in UTF format.


 Class ObjectStreamClass

Class java.io.ObjectStreamClass

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.ObjectStreamClass

public class ObjectStreamClass
extends Object
implements Serializable

A ObjectStreamClass describes a class that can be serialized to a stream or a class that was serialized to a stream. It contains the name and the serialVersionUID of the class.
The ObjectStreamClass for a specific class loaded in this Java VM can be found using the lookup method.


 ObjectStreamClass Members

ObjectStreamClass Members

Class Overview | This Package | All Packages

Methods
Name | Description
forClass() | Return the class in the local VM that this version is mapped to.
getName() | The name of the class described by this descriptor.
getSerialVersionUID() | Return the serialVersionUID for this class.
lookup(Class) | Find the descriptor for a class that can be serialized.
toString() | Return a string describing this ObjectStreamClass.


 ObjectStreamClass.forClass

ObjectStreamClass.forClass

Syntax
public Class forClass()
Description
Return the class in the local VM that this version is mapped to. Null is returned if there is no corresponding local class.


 ObjectStreamClass.getName

ObjectStreamClass.getName

Syntax
public String getName()
Description
The name of the class described by this descriptor.


 ObjectStreamClass.getSerialVersionUID

ObjectStreamClass.getSerialVersionUID

Syntax
public long getSerialVersionUID()
Description
Return the serialVersionUID for this class. The serialVersionUID defines a set of classes all with the same name that have evolved from a common root class and agree to be serialized and deserialized using a common format.


 ObjectStreamClass.lookup

ObjectStreamClass.lookup

Syntax
public static ObjectStreamClass lookup( Class cl )
Description
Find the descriptor for a class that can be serialized. Null is returned if the specified class does not implement java.io.Serializable or java.io.Externalizable.


 ObjectStreamClass.toString

ObjectStreamClass.toString

Syntax
public String toString()
Description
Return a string describing this ObjectStreamClass.

Overrides
toString in class Object


 Class ObjectStreamException

Class java.io.ObjectStreamException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.io.ObjectStreamException

public abstract class ObjectStreamException
extends IOException

Superclass of all exceptions specific to Object Stream classes.


 ObjectStreamException Members

ObjectStreamException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ObjectStreamException() | Create an ObjectStreamException.
ObjectStreamException(String) | Create an ObjectStreamException with the specified argument.


 ObjectStreamException.ObjectStreamException

ObjectStreamException.ObjectStreamException

Syntax 1
protected ObjectStreamException( String classname )
Description
Create an ObjectStreamException with the specified argument.

Syntax 2
protected ObjectStreamException()
Description
Create an ObjectStreamException.


 Class OptionalDataException

Class java.io.OptionalDataException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.io.ObjectStreamException
                                   |
                                   +----java.io.OptionalDataException

public class OptionalDataException
extends ObjectStreamException

Unexpected data appeared in an ObjectInputStream trying to read an Object. This exception occurs when the stream contains primitive data instead of the object expected by readObject. The eof flag in the exception is true to indicate that no more primitive data is available. The count field contains the number of bytes available to read.


 OptionalDataException Members

OptionalDataException Members

Class Overview | This Package | All Packages

Fields
Name | Description
eof | True if there is no more data in the buffered part of the stream.
length | The number of bytes of primitive data available to be read in the current buffer.


 OptionalDataException.eof

OptionalDataException.eof

Syntax
public boolean eof
Description
True if there is no more data in the buffered part of the stream.


 OptionalDataException.length

OptionalDataException.length

Syntax
public int length
Description
The number of bytes of primitive data available to be read in the current buffer.


 Class OutputStream

Class java.io.OutputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.OutputStream

public abstract class OutputStream
extends Object

This abstract class is the superclass of all classes representing an output stream of bytes.

Applications that need to define a subclass of OutputStream must always provide at least a method that writes one byte of output.

See Also:
BufferedOutputStream, ByteArrayOutputStream, DataOutputStream, FilterOutputStream, InputStream, write


 OutputStream Members

OutputStream Members

Class Overview | This Package | All Packages

Constructors
Name | Description
OutputStream() |

Methods
Name | Description
close() | Closes this output stream and releases any system resources associated with this stream.
flush() | Flushes this output stream and forces any buffered output bytes to be written out.
write(byte[]) | Writes b.length bytes from the specified byte array to this output stream.
write(byte[], int, int) | Writes len bytes from the specified byte array starting at offset off to this output stream.
write(int) | Writes the specified byte to this output stream.


 OutputStream.OutputStream

OutputStream.OutputStream

Syntax
public OutputStream()


 OutputStream.close

OutputStream.close

Syntax
public void close() throws IOException
Description
Closes this output stream and releases any system resources associated with this stream.

The close method of OutputStream does nothing.

Exceptions
IOException if an I/O error occurs.


 OutputStream.flush

OutputStream.flush

Syntax
public void flush() throws IOException
Description
Flushes this output stream and forces any buffered output bytes to be written out.

The flush method of OutputStream does nothing.

Exceptions
IOException if an I/O error occurs.


 OutputStream.write

OutputStream.write

Syntax 1
public abstract void write( int b ) throws IOException
Parameters
b
the byte.
Description
Writes the specified byte to this output stream.

Subclasses of OutputStream must provide an implementation for this method.

Exceptions
IOException if an I/O error occurs.

Syntax 2
public void write( byte b[] ) throws IOException
Parameters
b
the data.
Description
Writes b.length bytes from the specified byte array to this output stream.

The write method of OutputStream calls the write method of three arguments with the three arguments b, 0, and b.length.

Exceptions
IOException if an I/O error occurs.
See Also
write

Syntax 3
public void write( byte b[], int off, int len ) throws IOException
Parameters
b
the data.
off
the start offset in the data.
len
the number of bytes to write.
Description
Writes len bytes from the specified byte array starting at offset off to this output stream.

The write method of OutputStream calls the write method of one argument on each of the bytes to be written out. Subclasses are encouraged to override this method and provide a more efficient implementation.

Exceptions
IOException if an I/O error occurs.


 Class OutputStreamWriter

Class java.io.OutputStreamWriter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Writer
           |
           +----java.io.OutputStreamWriter

public class OutputStreamWriter
extends Writer

Write characters to an output stream, translating characters into bytes according to a specified character encoding. Each OutputStreamWriter incorporates its own CharToByteConverter, and is thus a bridge from character streams to byte streams.

The encoding used by an OutputStreamWriter may be specified by name, by providing a CharToByteConverter, or by accepting the default encoding, which is defined by the system property file.encoding.

Each invocation of a write() method causes the encoding converter to be invoked on the given character(s). The resulting bytes are accumulated in a buffer before being written to the underlying output stream. The size of this buffer may be specified, but by default it is large enough for most purposes. Note that the characters passed to the write() methods are not buffered. For top efficiency, consider wrapping an OutputStreamWriter within a BufferedWriter so as to avoid frequent converter invocations. For example,

 Writer out
   = new BufferedWriter(new OutputStreamWriter(System.out));

See Also:
BufferedWriter, OutputStream


 OutputStreamWriter Members

OutputStreamWriter Members

Class Overview | This Package | All Packages

Constructors
Name | Description
OutputStreamWriter(OutputStream) | Create an OutputStreamWriter that uses the default character encoding.
OutputStreamWriter(OutputStream, String) | Create an OutputStreamWriter that uses the named character encoding.

Methods
Name | Description
close() | Close the stream.
flush() | Flush the stream.
getEncoding() | Return the name of the encoding being used by this stream.
write(char[], int, int) | Write a portion of an array of characters.
write(int) | Write a single character.
write(String, int, int) | Write a portion of a string.


 OutputStreamWriter.OutputStreamWriter

OutputStreamWriter.OutputStreamWriter

Syntax 1
public OutputStreamWriter( OutputStream out, String enc ) throws UnsupportedEncodingException
Parameters
out
An OutputStream
enc
Name of the encoding to be used
Description
Create an OutputStreamWriter that uses the named character encoding.

Exceptions
UnsupportedEncodingException If the named encoding is not supported

Syntax 2
public OutputStreamWriter( OutputStream out )
Parameters
out
An OutputStream
Description
Create an OutputStreamWriter that uses the default character encoding.


 OutputStreamWriter.close

OutputStreamWriter.close

Syntax
public void close() throws IOException
Description
Close the stream.

Exceptions
IOException If an I/O error occurs
Overrides
close in class Writer


 OutputStreamWriter.flush

OutputStreamWriter.flush

Syntax
public void flush() throws IOException
Description
Flush the stream.

Exceptions
IOException If an I/O error occurs
Overrides
flush in class Writer


 OutputStreamWriter.getEncoding

OutputStreamWriter.getEncoding

Syntax
public String getEncoding()
Description
Return the name of the encoding being used by this stream. May return null if the stream has been closed.


 OutputStreamWriter.write

OutputStreamWriter.write

Syntax 1
public void write( int c ) throws IOException
Description
Write a single character.

Exceptions
IOException If an I/O error occurs
Overrides
write in class Writer

Syntax 2
public void write( char cbuf[], int off, int len ) throws IOException
Parameters
cbuf
Buffer of characters
off
Offset from which to start writing characters
len
Number of characters to write
Description
Write a portion of an array of characters.

Exceptions
IOException If an I/O error occurs
Overrides
write in class Writer

Syntax 3
public void write( String str, int off, int len ) throws IOException
Parameters
str
A String
off
Offset from which to start writing characters
len
Number of characters to write
Description
Write a portion of a string.

Exceptions
IOException If an I/O error occurs
Overrides
write in class Writer


 Class PipedInputStream

Class java.io.PipedInputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.PipedInputStream

public class PipedInputStream
extends InputStream

A piped input stream is the receiving end of a communications pipe. Two threads can communicate by having one thread send data through a piped output stream and having the other thread read the data through a piped input stream.

See Also:
PipedOutputStream


 PipedInputStream Members

PipedInputStream Members

Class Overview | This Package | All Packages

Fields
Name | Description
buffer | The circular buffer into which incoming data is placed.
in |
out |
PIPE_SIZE |

Constructors
Name | Description
PipedInputStream() | Creates a piped input stream that is not yet connected to a piped output stream.
PipedInputStream(PipedOutputStream) | Creates a piped input stream connected to the specified piped output stream.

Methods
Name | Description
available() | Returns the number of bytes that can be read from this input stream without blocking.
close() | Closes this piped input stream and releases any system resources associated with the stream.
connect(PipedOutputStream) | Connects this piped input stream to a sender.
read() | Reads the next byte of data from this piped input stream.
read(byte[], int, int) | Reads up to len bytes of data from this piped input stream into an array of bytes.
receive(int) | Receives a byte of data.


 PipedInputStream.buffer

PipedInputStream.buffer

Syntax
protected byte buffer[]
Description
The circular buffer into which incoming data is placed.


 PipedInputStream.in

PipedInputStream.in

Syntax
protected int in


 PipedInputStream.out

PipedInputStream.out

Syntax
protected int out


 PipedInputStream.PIPE_SIZE

PipedInputStream.PIPE_SIZE

Syntax
protected static final int PIPE_SIZE


 PipedInputStream.PipedInputStream

PipedInputStream.PipedInputStream

Syntax 1
public PipedInputStream( PipedOutputStream src ) throws IOException
Parameters
src
the stream to connect to.
Description
Creates a piped input stream connected to the specified piped output stream.

Exceptions
IOException if an I/O error occurs.

Syntax 2
public PipedInputStream()
Description
Creates a piped input stream that is not yet connected to a piped output stream. It must be connected to a piped output stream, either by the receiver or the sender, before being used.

See Also
connect, connect


 PipedInputStream.available

PipedInputStream.available

Syntax
public synchronized int available() throws IOException
Returns
the number of bytes that can be read from this input stream without blocking.
Description
Returns the number of bytes that can be read from this input stream without blocking. This method overrides the available method of the parent class.

Exceptions
IOException if an I/O error occurs.
Overrides
available in class InputStream


 PipedInputStream.close

PipedInputStream.close

Syntax
public void close() throws IOException
Description
Closes this piped input stream and releases any system resources associated with the stream.

Exceptions
IOException if an I/O error occurs.
Overrides
close in class InputStream


 PipedInputStream.connect

PipedInputStream.connect

Syntax
public void connect( PipedOutputStream src ) throws IOException
Parameters
src
The piped output stream to connect to.
Description
Connects this piped input stream to a sender.

Exceptions
IOException if an I/O error occurs.


 PipedInputStream.read

PipedInputStream.read

Syntax 1
public synchronized int read() throws IOException
Returns
the next byte of data, or -1 if the end of the stream is reached.
Description
Reads the next byte of data from this piped input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because this end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

Exceptions
IOException if the pipe is broken.
Overrides
read in class InputStream

Syntax 2
public synchronized int read( byte b[], int off, int len ) throws IOException
Parameters
b
the buffer into which the data is read.
off
the start offset of the data.
len
the maximum number of bytes read.
Returns
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Description
Reads up to len bytes of data from this piped input stream into an array of bytes. This method blocks until at least one byte of input is available.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class InputStream


 PipedInputStream.receive

PipedInputStream.receive

Syntax
protected synchronized void receive( int b ) throws IOException
Parameters
b
the byte being received
Description
Receives a byte of data. This method will block if no input is available.

Exceptions
IOException If the pipe is broken.


 Class PipedOutputStream

Class java.io.PipedOutputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----java.io.PipedOutputStream

public class PipedOutputStream
extends OutputStream

A piped output stream is the sending end of a communications pipe. Two threads can communicate by having one thread send data through a piped output stream and having the other thread read the data through a piped input stream.

See Also:
PipedInputStream


 PipedOutputStream Members

PipedOutputStream Members

Class Overview | This Package | All Packages

Constructors
Name | Description
PipedOutputStream() | Creates a piped output stream that is not yet connected to a piped input stream.
PipedOutputStream(PipedInputStream) | Creates a piped output stream connected to the specified piped input stream.

Methods
Name | Description
close() | Closes this piped output stream and releases any system resources associated with this stream.
connect(PipedInputStream) | Connects this piped output stream to a receiver.
flush() | Flushes this output stream and forces any buffered output bytes to be written out.
write(byte[], int, int) | Writes len bytes from the specified byte array starting at offset off to this piped output stream.
write(int) | Writes the specified byte to the piped output stream.


 PipedOutputStream.PipedOutputStream

PipedOutputStream.PipedOutputStream

Syntax 1
public PipedOutputStream( PipedInputStream snk ) throws IOException
Parameters
snk
The piped input stream to connect to.
Description
Creates a piped output stream connected to the specified piped input stream.

Exceptions
IOException if an I/O error occurs.

Syntax 2
public PipedOutputStream()
Description
Creates a piped output stream that is not yet connected to a piped input stream. It must be connected to a piped input stream, either by the receiver or the sender, before being used.

See Also
connect, connect


 PipedOutputStream.close

PipedOutputStream.close

Syntax
public void close() throws IOException
Description
Closes this piped output stream and releases any system resources associated with this stream.

Exceptions
IOException if an I/O error occurs.
Overrides
close in class OutputStream


 PipedOutputStream.connect

PipedOutputStream.connect

Syntax
public void connect( PipedInputStream snk ) throws IOException
Parameters
snk
the piped output stream to connect to.
Description
Connects this piped output stream to a receiver.

Exceptions
IOException if an I/O error occurs.


 PipedOutputStream.flush

PipedOutputStream.flush

Syntax
public synchronized void flush() throws IOException
Description
Flushes this output stream and forces any buffered output bytes to be written out. This will notify any readers that bytes are waiting in the pipe.

Exceptions
IOException if an I/O error occurs.
Overrides
flush in class OutputStream


 PipedOutputStream.write

PipedOutputStream.write

Syntax 1
public void write( int b ) throws IOException
Parameters
b
the byte to be written.
Description
Writes the specified byte to the piped output stream.

Exceptions
IOException if an I/O error occurs.
Overrides
write in class OutputStream

Syntax 2
public void write( byte b[], int off, int len ) throws IOException
Parameters
b
the data.
off
the start offset in the data.
len
the number of bytes to write.
Description
Writes len bytes from the specified byte array starting at offset off to this piped output stream.

Exceptions
IOException if an I/O error occurs.
Overrides
write in class OutputStream


 Class PipedReader

Class java.io.PipedReader

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Reader
           |
           +----java.io.PipedReader

public class PipedReader
extends Reader

Piped character-input streams.


 PipedReader Members

PipedReader Members

Class Overview | This Package | All Packages

Constructors
Name | Description
PipedReader() | Create a reader that is not yet connected to a piped writer.
PipedReader(PipedWriter) | Create a reader for the specified piped character-output stream.

Methods
Name | Description
close() | Close the stream.
connect(PipedWriter) | Connect the specified piped writer to this reader.
read(char[], int, int) | Read characters into a portion of an array.


 PipedReader.PipedReader

PipedReader.PipedReader

Syntax 1
public PipedReader()
Description
Create a reader that is not yet connected to a piped writer.

Syntax 2
public PipedReader( PipedWriter src ) throws IOException
Description
Create a reader for the specified piped character-output stream.


 PipedReader.close

PipedReader.close

Syntax
public void close() throws IOException
Description
Close the stream.

Exceptions
IOException If an I/O error occurs
Overrides
close in class Reader


 PipedReader.connect

PipedReader.connect

Syntax
public void connect( PipedWriter src ) throws IOException
Description
Connect the specified piped writer to this reader.

Exceptions
IOException If this reader is already connected


 PipedReader.read

PipedReader.read

Syntax
public int read( char cbuf[], int off, int len ) throws IOException
Parameters
cbuf
Destination buffer
off
Offset at which to start storing characters
len
Maximum number of characters to read
Returns
The number of characters read, or -1 if the end of the stream has been reached
Description
Read characters into a portion of an array.

Exceptions
IOException If an I/O error occurs
Overrides
read in class Reader


 Class PipedWriter

Class java.io.PipedWriter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Writer
           |
           +----java.io.PipedWriter

public class PipedWriter
extends Writer

Piped character-output streams.


 PipedWriter Members

PipedWriter Members

Class Overview | This Package | All Packages

Constructors
Name | Description
PipedWriter() | Create a writer that is not yet connected to a piped reader.
PipedWriter(PipedReader) | Create a writer for the specified piped character-input stream.

Methods
Name | Description
close() | Close the stream.
connect(PipedReader) | Connect the specified piped reader to this writer.
flush() | Flush the stream.
write(char[], int, int) | Write a portion of an array of characters.


 PipedWriter.PipedWriter

PipedWriter.PipedWriter

Syntax 1
public PipedWriter()
Description
Create a writer that is not yet connected to a piped reader.

Syntax 2
public PipedWriter( PipedReader sink ) throws IOException
Description
Create a writer for the specified piped character-input stream.


 PipedWriter.close

PipedWriter.close

Syntax
public void close() throws IOException
Description
Close the stream.

Exceptions
IOException If an I/O error occurs
Overrides
close in class Writer


 PipedWriter.connect

PipedWriter.connect

Syntax
public void connect( PipedReader sink ) throws IOException
Description
Connect the specified piped reader to this writer.


 PipedWriter.flush

PipedWriter.flush

Syntax
public void flush() throws IOException
Description
Flush the stream.

Exceptions
IOException If an I/O error occurs
Overrides
flush in class Writer


 PipedWriter.write

PipedWriter.write

Syntax
public void write( char cbuf[], int off, int len ) throws IOException
Parameters
cbuf
Array of characters
off
Offset from which to start writing characters
len
Number of characters to write
Description
Write a portion of an array of characters.

Exceptions
IOException If an I/O error occurs
Overrides
write in class Writer


 Class PrintStream

Class java.io.PrintStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----java.io.FilterOutputStream
                   |
                   +----java.io.PrintStream

public class PrintStream
extends FilterOutputStream

Print values and objects to an output stream, using the platform's default character encoding to convert characters into bytes.

If automatic flushing is enabled at creation time, then the stream will be flushed each time a line is terminated or a newline character is written.

Methods in this class never throw I/O exceptions. Client code may inquire as to whether any errors have occurred by invoking the checkError method.

Note: This class is provided primarily for use in debugging, and for compatibility with existing code; new code should use the PrintWriter class.

See Also:
PrintWriter


 PrintStream Members

PrintStream Members

Class Overview | This Package | All Packages

Constructors
Name | Description
PrintStream(OutputStream) | Create a new print stream. Deprecated.
PrintStream(OutputStream, boolean) | Create a new PrintStream. Deprecated.

Methods
Name | Description
checkError() | Flush the stream and check its error state.
close() | Close the stream.
flush() | Flush the stream.
print(boolean) | Print a boolean value.
print(char) | Print a character.
print(char[]) | Print an array of characters.
print(double) | Print a double-precision floating-point number.
print(float) | Print a floating-point number.
print(int) | Print an integer.
print(long) | Print a long integer.
print(Object) | Print an object.
print(String) | Print a string.
println() | Finish the current line by writing a line separator.
println(boolean) | Print a boolean, and then finish the line.
println(char) | Print a character, and then finish the line.
println(char[]) | Print an array of characters, and then finish the line.
println(double) | Print a double, and then finish the line.
println(float) | Print a float, and then finish the line.
println(int) | Print an integer, and then finish the line.
println(long) | Print a long, and then finish the line.
println(Object) | Print an Object, and then finish the line.
println(String) | Print a String, and then finish the line.
setError() | Indicate that an error has occurred.
write(byte[], int, int) | Write a portion of a byte array, blocking if necessary.
write(int) | Write a byte, blocking if necessary.


 PrintStream.PrintStream

PrintStream.PrintStream

Syntax 1
public PrintStream( OutputStream out )
Parameters
out
The output stream to which values and objects will be printed
Description
Note: PrintStream() is deprecated. As of JDK 1.1, the preferred way to print text is via the PrintWriter class. Consider replacing code of the
form PrintStream p = new PrintStream(out);
with PrintWriter p = new PrintWriter(out);

Create a new print stream.

See Also
PrintWriter

Syntax 2
public PrintStream( OutputStream out, boolean autoFlush )
Parameters
out
The output stream to which values and objects will be printed
autoFlush
A boolean; if true, the output buffer will be flushed whenever a line is terminated or a newline character ('\n') is written
Description
Note: PrintStream() is deprecated. As of JDK 1.1, the preferred way to print text is via the PrintWriter class. Consider replacing code of the
form PrintStream p = new PrintStream(out, autoFlush);
with PrintWriter p = new PrintWriter(out, autoFlush);

Create a new PrintStream.

See Also
PrintWriter


 PrintStream.checkError

PrintStream.checkError

Syntax
public boolean checkError()
Returns
True if the print stream has encountered an error, either on the underlying output stream or during a format conversion, otherwise false.
Description
Flush the stream and check its error state. Errors are cumulative; once the stream encounters an error, this routine will continue to return true on all successive calls.


 PrintStream.close

PrintStream.close

Syntax
public void close()
Description
Close the stream. This is done by flushing the stream and then closing the underlying output stream.

Overrides
close in class FilterOutputStream
See Also
close


 PrintStream.flush

PrintStream.flush

Syntax
public void flush()
Description
Flush the stream. This is done by writing any buffered output bytes to the underlying output stream and then flushing that stream.

Overrides
flush in class FilterOutputStream
See Also
flush


 PrintStream.print

PrintStream.print

Syntax 1
public void print( boolean b )
Parameters
b
The boolean to be printed
Description
Print a boolean value. If the given value is true, then the string "true" is written to the underlying output stream; otherwise, the string "false" is written.

Syntax 2
public void print( char c )
Parameters
c
The char to be printed
Description
Print a character. The character is translated into one or more bytes according to the platform's default character encoding.

Syntax 3
public void print( int i )
Parameters
i
The int to be printed
Description
Print an integer. The string printed is the same as that returned by the toString method of the Integer class when invoked on the given int value.

See Also
toString

Syntax 4
public void print( long l )
Parameters
l
The long to be printed
Description
Print a long integer. The string printed is the same as that returned by the toString method of the Long class when invoked on the given long value.

See Also
toString

Syntax 5
public void print( float f )
Parameters
f
The float to be printed
Description
Print a floating-point number. The string printed is the same as that returned by the toString method of the Float class when invoked on the given float value.

See Also
toString

Syntax 6
public void print( double d )
Parameters
d
The double to be printed
Description
Print a double-precision floating-point number. The string printed is the same as that returned by the toString method of the Double class when invoked on the given double value.

See Also
toString

Syntax 7
public void print( char s[] )
Parameters
s
The array of chars to be printed
Description
Print an array of characters. The characters are converted into bytes according to the platform's default character encoding.

Syntax 8
public void print( String s )
Parameters
s
The String to be printed
Description
Print a string. If the argument is null, the string "null" is written to the underlying output stream. Otherwise, the string's characters are converted into bytes according to the platform's default character encoding.

Syntax 9
public void print( Object obj )
Parameters
obj
The Object to be printed
Description
Print an object. The string printed is the same as that returned by the given object's toString method.

See Also
toString


 PrintStream.println

PrintStream.println

Syntax 1
public void println()
Description
Finish the current line by writing a line separator. The line separator string is defined by the system property line.separator, and is not necessarily a single newline character ('\n').

Syntax 2
public void println( boolean x )
Description
Print a boolean, and then finish the line.

See Also
print

Syntax 3
public void println( char x )
Description
Print a character, and then finish the line.

See Also
print

Syntax 4
public void println( int x )
Description
Print an integer, and then finish the line.

See Also
print

Syntax 5
public void println( long x )
Description
Print a long, and then finish the line.

See Also
print

Syntax 6
public void println( float x )
Description
Print a float, and then finish the line.

See Also
print

Syntax 7
public void println( double x )
Description
Print a double, and then finish the line.

See Also
print

Syntax 8
public void println( char x[] )
Description
Print an array of characters, and then finish the line.

See Also
print

Syntax 9
public void println( String x )
Description
Print a String, and then finish the line.

See Also
print

Syntax 10
public void println( Object x )
Description
Print an Object, and then finish the line.

See Also
print


 PrintStream.setError

PrintStream.setError

Syntax
protected void setError()
Description
Indicate that an error has occurred.


 PrintStream.write

PrintStream.write

Syntax 1
public void write( int b )
Parameters
b
The byte to be written
Description
Write a byte, blocking if necessary. If the character is a newline and automatic flushing is enabled, the stream's flush method will be called.

Note that the byte is written as given; to write a character that will be translated according to the platform's default character encoding, use the print(char) or println(char) methods.

Overrides
write in class FilterOutputStream
See Also
print, println

Syntax 2
public void write( byte buf[], int off, int len )
Parameters
buf
A byte array
off
Offset from which to start taking bytes
len
Number of bytes to write
Description
Write a portion of a byte array, blocking if necessary.

Overrides
write in class FilterOutputStream


 Class PrintWriter

Class java.io.PrintWriter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Writer
           |
           +----java.io.PrintWriter

public class PrintWriter
extends Writer

Print formatted representations of objects to a text-output stream. This class implements all of the print methods found in PrintStream. It does not contain methods for writing raw bytes, for which a program should use unencoded byte streams.

Unlike the PrintStream class, if automatic flushing is enabled it will be done only when one of the println() methods is invoked, rather than whenever a newline character happens to be output. The println() methods use the platform's own notion of line separator rather than the newline character.

Methods in this class never throw I/O exceptions. The client may inquire as to whether any errors have occurred by invoking checkError().


 PrintWriter Members

PrintWriter Members

Class Overview | This Package | All Packages

Constructors
Name | Description
PrintWriter(OutputStream) | Create a new PrintWriter, without automatic line flushing, from an existing OutputStream.
PrintWriter(OutputStream, boolean) | Create a new PrintWriter from an existing OutputStream.
PrintWriter(Writer) | Create a new PrintWriter, without automatic line flushing.
PrintWriter(Writer, boolean) | Create a new PrintWriter.

Methods
Name | Description
checkError() | Flush the stream and check its error state.
close() | Close the stream.
flush() | Flush the stream.
print(boolean) | Print a boolean.
print(char) | Print a character.
print(char[]) | Print an array of chracters.
print(double) | Print a double.
print(float) | Print a float.
print(int) | Print an integer.
print(long) | Print a long.
print(Object) | Print an object.
print(String) | Print a String.
println() | Finish the line.
println(boolean) | Print a boolean, and then finish the line.
println(char) | Print a character, and then finish the line.
println(char[]) | Print an array of characters, and then finish the line.
println(double) | Print a double, and then finish the line.
println(float) | Print a float, and then finish the line.
println(int) | Print an integer, and then finish the line.
println(long) | Print a long, and then finish the line.
println(Object) | Print an Object, and then finish the line.
println(String) | Print a String, and then finish the line.
setError() | Indicate that an error has occurred.
write(char[]) | Write an array of characters.
write(char[], int, int) | Write a portion of an array of characters.
write(int) | Write a single character.
write(String) | Write a string.
write(String, int, int) | Write a portion of a string.


 PrintWriter.PrintWriter

PrintWriter.PrintWriter

Syntax 1
public PrintWriter( Writer out )
Parameters
out
A character-output stream
Description
Create a new PrintWriter, without automatic line flushing.

Syntax 2
public PrintWriter( Writer out, boolean autoFlush )
Parameters
out
A character-output stream
autoFlush
A boolean; if true, the println() methods will flush the output buffer
Description
Create a new PrintWriter.

Syntax 3
public PrintWriter( OutputStream out )
Parameters
out
An output stream
Description
Create a new PrintWriter, without automatic line flushing, from an existing OutputStream. This convenience constructor creates the necessary intermediate OutputStreamWriter, which will convert characters into bytes using the default character encoding.

See Also
OutputStreamWriter

Syntax 4
public PrintWriter( OutputStream out, boolean autoFlush )
Parameters
out
An output stream
autoFlush
A boolean; if true, the println() methods will flush the output buffer
Description
Create a new PrintWriter from an existing OutputStream. This convenience constructor creates the necessary intermediate OutputStreamWriter, which will convert characters into bytes using the default character encoding.

See Also
OutputStreamWriter


 PrintWriter.checkError

PrintWriter.checkError

Syntax
public boolean checkError()
Returns
True if the print stream has encountered an error, either on the underlying output stream or during a format conversion.
Description
Flush the stream and check its error state. Errors are cumulative; once the stream encounters an error, this routine will return true on all successive calls.


 PrintWriter.close

PrintWriter.close

Syntax
public void close()
Description
Close the stream.

Overrides
close in class Writer


 PrintWriter.flush

PrintWriter.flush

Syntax
public void flush()
Description
Flush the stream.

Overrides
flush in class Writer


 PrintWriter.print

PrintWriter.print

Syntax 1
public void print( boolean b )
Description
Print a boolean.

Syntax 2
public void print( char c )
Description
Print a character.

Syntax 3
public void print( int i )
Description
Print an integer.

Syntax 4
public void print( long l )
Description
Print a long.

Syntax 5
public void print( float f )
Description
Print a float.

Syntax 6
public void print( double d )
Description
Print a double.

Syntax 7
public void print( char s[] )
Description
Print an array of chracters.

Syntax 8
public void print( String s )
Description
Print a String.

Syntax 9
public void print( Object obj )
Description
Print an object.


 PrintWriter.println

PrintWriter.println

Syntax 1
public void println()
Description
Finish the line.

Syntax 2
public void println( boolean x )
Description
Print a boolean, and then finish the line.

Syntax 3
public void println( char x )
Description
Print a character, and then finish the line.

Syntax 4
public void println( int x )
Description
Print an integer, and then finish the line.

Syntax 5
public void println( long x )
Description
Print a long, and then finish the line.

Syntax 6
public void println( float x )
Description
Print a float, and then finish the line.

Syntax 7
public void println( double x )
Description
Print a double, and then finish the line.

Syntax 8
public void println( char x[] )
Description
Print an array of characters, and then finish the line.

Syntax 9
public void println( String x )
Description
Print a String, and then finish the line.

Syntax 10
public void println( Object x )
Description
Print an Object, and then finish the line.


 PrintWriter.setError

PrintWriter.setError

Syntax
protected void setError()
Description
Indicate that an error has occurred.


 PrintWriter.write

PrintWriter.write

Syntax 1
public void write( int c )
Description
Write a single character.

Overrides
write in class Writer

Syntax 2
public void write( char buf[], int off, int len )
Description
Write a portion of an array of characters.

Overrides
write in class Writer

Syntax 3
public void write( char buf[] )
Description
Write an array of characters. This method cannot be inherited from the Writer class because it must suppress I/O exceptions.

Overrides
write in class Writer

Syntax 4
public void write( String s, int off, int len )
Description
Write a portion of a string.

Overrides
write in class Writer

Syntax 5
public void write( String s )
Description
Write a string. This method cannot be inherited from the Writer class because it must suppress I/O exceptions.

Overrides
write in class Writer


 Class PushbackInputStream

Class java.io.PushbackInputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.FilterInputStream
                   |
                   +----java.io.PushbackInputStream

public class PushbackInputStream
extends FilterInputStream

This class is an input stream filter that provides a buffer into which data can be "unread." An application may unread data at any time by pushing it back into the buffer, as long as the buffer has sufficient room. Subsequent reads will read all of the pushed-back data in the buffer before reading from the underlying input stream.

This functionality is useful when a fragment of code should read an indefinite number of data bytes that are delimited by particular byte values. After reading the terminating byte the code fragment can push it back, so that the next read operation on the input stream will re-read that byte.


 PushbackInputStream Members

PushbackInputStream Members

Class Overview | This Package | All Packages

Fields
Name | Description
buf | The pushback buffer.
pos | The position within the pushback buffer from which the next byte will be read.

Constructors
Name | Description
PushbackInputStream(InputStream) | Creates a new pushback input stream with a one-byte pushback buffer.
PushbackInputStream(InputStream, int) | Creates a new pushback input stream with a pushback buffer of the specified size.

Methods
Name | Description
available() | Returns the number of bytes that can be read from this input stream without blocking.
markSupported() | Tests if this input stream supports the mark and reset methods, which it does not.
read() | Reads the next byte of data from this input stream.
read(byte[], int, int) | Reads up to len bytes of data from this input stream into an array of bytes.
unread(byte[]) | Pushes back an array of bytes by copying it to the front of the pushback buffer.
unread(byte[], int, int) | Pushes back a portion of an array of bytes by copying it to the front of the pushback buffer.
unread(int) | Pushes back a byte by copying it to the front of the pushback buffer.


 PushbackInputStream.buf

PushbackInputStream.buf

Syntax
protected byte buf[]
Description
The pushback buffer.


 PushbackInputStream.pos

PushbackInputStream.pos

Syntax
protected int pos
Description
The position within the pushback buffer from which the next byte will be read. When the buffer is empty, pos is equal to buf.length; when the buffer is full, pos is equal to zero.


 PushbackInputStream.PushbackInputStream

PushbackInputStream.PushbackInputStream

Syntax 1
public PushbackInputStream( InputStream in, int size )
Parameters
in
the input stream from which bytes will be read.
size
the size of the pushback buffer.
Description
Creates a new pushback input stream with a pushback buffer of the specified size.

Syntax 2
public PushbackInputStream( InputStream in )
Parameters
in
the input stream from which bytes will be read.
Description
Creates a new pushback input stream with a one-byte pushback buffer.


 PushbackInputStream.available

PushbackInputStream.available

Syntax
public int available() throws IOException
Returns
the number of bytes that can be read from the input stream without blocking.
Description
Returns the number of bytes that can be read from this input stream without blocking. This method calls the available method of the underlying input stream; it returns that value plus the number of bytes that have been pushed back.

Exceptions
IOException if an I/O error occurs.
Overrides
available in class FilterInputStream
See Also
in


 PushbackInputStream.markSupported

PushbackInputStream.markSupported

Syntax
public boolean markSupported()
Returns
false, since this class does not support the mark and reset methods.
Description
Tests if this input stream supports the mark and reset methods, which it does not.

Overrides
markSupported in class FilterInputStream
See Also
mark, reset


 PushbackInputStream.read

PushbackInputStream.read

Syntax 1
public int read() throws IOException
Returns
the next byte of data, or -1 if the end of the stream has been reached.
Description
Reads the next byte of data from this input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

This method returns the most recently pushed-back byte, if there is one, and otherwise calls the read method of its underlying input stream and returns whatever value that method returns.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class FilterInputStream
See Also
read

Syntax 2
public int read( byte b[], int off, int len ) throws IOException
Parameters
b
the buffer into which the data is read.
off
the start offset of the data.
len
the maximum number of bytes read.
Returns
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Description
Reads up to len bytes of data from this input stream into an array of bytes. This method first reads any pushed-back bytes; after that, if fewer than than len bytes have been read then it reads from the underlying input stream. This method blocks until at least 1 byte of input is available.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class FilterInputStream


 PushbackInputStream.unread

PushbackInputStream.unread

Syntax 1
public void unread( int b ) throws IOException
Parameters
b
the int value whose low-order byte is to be pushed back.
Description
Pushes back a byte by copying it to the front of the pushback buffer. After this method returns, the next byte to be read will have the value (byte)b.

Exceptions
IOException If there is not enough room in the pushback buffer for the byte.

Syntax 2
public void unread( byte b[], int off, int len ) throws IOException
Parameters
b
the byte array to push back.
off
the start offset of the data.
len
the number of bytes to push back.
Description
Pushes back a portion of an array of bytes by copying it to the front of the pushback buffer. After this method returns, the next byte to be read will have the value b[off], the byte after that will have the value b[off+1], and so forth.

Exceptions
IOException If there is not enough room in the pushback buffer for the specified number of bytes.

Syntax 3
public void unread( byte b[] ) throws IOException
Parameters
b
the byte array to push back
Description
Pushes back an array of bytes by copying it to the front of the pushback buffer. After this method returns, the next byte to be read will have the value b[0], the byte after that will have the value b[1], and so forth.

Exceptions
IOException If there is not enough room in the pushback buffer for the specified number of bytes.


 Class PushbackReader

Class java.io.PushbackReader

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Reader
           |
           +----java.io.FilterReader
                   |
                   +----java.io.PushbackReader

public class PushbackReader
extends FilterReader

A character-stream reader that allows characters to be pushed back into the stream.


 PushbackReader Members

PushbackReader Members

Class Overview | This Package | All Packages

Constructors
Name | Description
PushbackReader(Reader) | Create a new pushback reader with a one-character pushback buffer.
PushbackReader(Reader, int) | Create a new pushback reader with a pushback buffer of the given size.

Methods
Name | Description
close() | Close the stream.
markSupported() | Tell whether this stream supports the mark() operation, which it does not.
read() | Read a single character.
read(char[], int, int) | Read characters into a portion of an array.
ready() | Tell whether this stream is ready to be read.
unread(char[]) | Push back an array of characters by copying it to the front of the pushback buffer.
unread(char[], int, int) | Push back a portion of an array of characters by copying it to the front of the pushback buffer.
unread(int) | Push back a single character.


 PushbackReader.PushbackReader

PushbackReader.PushbackReader

Syntax 1
public PushbackReader( Reader in, int size )
Parameters
in
The reader from which characters will be read
size
The size of the pushback buffer
Description
Create a new pushback reader with a pushback buffer of the given size.

Syntax 2
public PushbackReader( Reader in )
Parameters
in
The reader from which characters will be read
Description
Create a new pushback reader with a one-character pushback buffer.


 PushbackReader.close

PushbackReader.close

Syntax
public void close() throws IOException
Description
Close the stream.

Exceptions
IOException If an I/O error occurs
Overrides
close in class FilterReader


 PushbackReader.markSupported

PushbackReader.markSupported

Syntax
public boolean markSupported()
Description
Tell whether this stream supports the mark() operation, which it does not.

Overrides
markSupported in class FilterReader


 PushbackReader.read

PushbackReader.read

Syntax 1
public int read() throws IOException
Returns
The character read, or -1 if the end of the stream has been reached
Description
Read a single character.

Exceptions
IOException If an I/O error occurs
Overrides
read in class FilterReader

Syntax 2
public int read( char cbuf[], int off, int len ) throws IOException
Parameters
cbuf
Destination buffer
off
Offset at which to start writing characters
len
Maximum number of characters to read
Returns
The number of characters read, or -1 if the end of the stream has been reached
Description
Read characters into a portion of an array.

Exceptions
IOException If an I/O error occurs
Overrides
read in class FilterReader


 PushbackReader.ready

PushbackReader.ready

Syntax
public boolean ready() throws IOException
Description
Tell whether this stream is ready to be read.

Exceptions
IOException If an I/O error occurs
Overrides
ready in class FilterReader


 PushbackReader.unread

PushbackReader.unread

Syntax 1
public void unread( int c ) throws IOException
Parameters
c
The character to push back
Description
Push back a single character.

Exceptions
IOException If the pushback buffer is full, or if some other I/O error occurs

Syntax 2
public void unread( char cbuf[], int off, int len ) throws IOException
Parameters
cbuf
Character array
off
Offset of first character to push back
len
Number of characters to push back
Description
Push back a portion of an array of characters by copying it to the front of the pushback buffer. After this method returns, the next character to be read will have the value cbuf[off], the character after that will have the value cbuf[off+1], and so forth.

Exceptions
IOException If there is insufficient room in the pushback buffer, or if some other I/O error occurs

Syntax 3
public void unread( char cbuf[] ) throws IOException
Parameters
cbuf
Character array to push back
Description
Push back an array of characters by copying it to the front of the pushback buffer. After this method returns, the next character to be read will have the value cbuf[0], the character after that will have the value cbuf[1], and so forth.

Exceptions
IOException If there is insufficient room in the pushback buffer, or if some other I/O error occurs


 Class RandomAccessFile

Class java.io.RandomAccessFile

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.RandomAccessFile

public class RandomAccessFile
extends Object
implements DataOutput, DataInput

Instances of this class support both reading and writing to a random access file. An application can modify the position in the file at which the next read or write occurs. This class provides a sense of security by offering methods that allow specified mode accesses of read-only or read-write to files.


 RandomAccessFile Members

RandomAccessFile Members

Class Overview | This Package | All Packages

Constructors
Name | Description
RandomAccessFile(File, String) | Creates a random access file stream to read from, and optionally to write to, the file specified by the File argument.
RandomAccessFile(String, String) | Creates a random access file stream to read from, and optionally to write to, a file with the specified name.

Methods
Name | Description
close() | Closes this random access file stream and releases any system resources associated with the stream.
getFD() | Returns the opaque file descriptor object associated with this stream.
getFilePointer() | Returns the current offset in this file.
length() | Returns the length of this file.
read() | Reads a byte of data from this file.
read(byte[]) | Reads up to b.length bytes of data from this file into an array of bytes.
read(byte[], int, int) | Reads up to len bytes of data from this file into an array of bytes.
readBoolean() | Reads a boolean from this file.
readByte() | Reads a signed 8-bit value from this file.
readChar() | Reads a Unicode character from this file.
readDouble() | Reads a double from this file.
readFloat() | Reads a float from this file.
readFully(byte[]) | Reads b.length bytes from this file into the byte array.
readFully(byte[], int, int) | Reads exactly len bytes from this file into the byte array.
readInt() | Reads a signed 32-bit integer from this file.
readLine() | Reads the next line of text from this file.
readLong() | Reads a signed 64-bit integer from this file.
readShort() | Reads a signed 16-bit number from this file.
readUnsignedByte() | Reads an unsigned 8-bit number from this file.
readUnsignedShort() | Reads an unsigned 16-bit number from this file.
readUTF() | Reads in a string from this file.
seek(long) | Sets the offset from the beginning of this file at which the next read or write occurs.
skipBytes(int) | Skips exactly n bytes of input.
write(byte[]) | Writes b.length bytes from the specified byte array starting at offset off to this file.
write(byte[], int, int) | Writes len bytes from the specified byte array starting at offset off to this file.
write(int) | Writes the specified byte to this file.
writeBoolean(boolean) | Writes a boolean to the file as a 1-byte value.
writeByte(int) | Writes a byte to the file as a 1-byte value.
writeBytes(String) | Writes the string to the file as a sequence of bytes.
writeChar(int) | Writes a char to the file as a 2-byte value, high byte first.
writeChars(String) | Writes a string to the file as a sequence of characters.
writeDouble(double) | Converts the double argument to a long using the doubleToLongBits method in class Double, and then writes that long value to the file as an 8-byte quantity, high byte first.
writeFloat(float) | Converts the float argument to an int using the floatToIntBits method in class Float, and then writes that int value to the file as a 4-byte quantity, high byte first.
writeInt(int) | Writes an int to the file as four bytes, high byte first.
writeLong(long) | Writes a long to the file as eight bytes, high byte first.
writeShort(int) | Writes a short to the file as two bytes, high byte first.
writeUTF(String) | Writes a string to the file using UTF-8 encoding in a machine-independent manner.


 RandomAccessFile.RandomAccessFile

RandomAccessFile.RandomAccessFile

Syntax 1
public RandomAccessFile( String name, String mode ) throws IOException
Parameters
name
the system-dependent filename.
mode
the access mode.
Description
Creates a random access file stream to read from, and optionally to write to, a file with the specified name.

The mode argument must either be equal to "r" or "rw", indicating either to open the file for input or for both input and output.

Exceptions
IllegalArgumentException if the mode argument is not equal to "r" or to "rw".
Exceptions
IOException if an I/O error occurs.
Exceptions
SecurityException if a security manager exists, its checkRead method is called with the name argument to see if the application is allowed read access to the file. If the mode argument is equal to "rw", its checkWrite method also is called with the name argument to see if the application is allowed write access to the file. Either of these may result in a security exception.
See Also
SecurityException, checkRead

Syntax 2
public RandomAccessFile( File file, String mode ) throws IOException
Parameters
file
the file object.
mode
the access mode.
Description
Creates a random access file stream to read from, and optionally to write to, the file specified by the File argument.

The mode argument must either be equal to "r" or to "rw", indicating either to open the file for input, or for both input and output, respectively.

Exceptions
IllegalArgumentException if the mode argument is not equal to "r" or to "rw".
Exceptions
IOException if an I/O error occurs.
Exceptions
SecurityException if a security manager exists, its checkRead method is called with the pathname of the File argument to see if the application is allowed read access to the file. If the mode argument is equal to "rw", its checkWrite method also is called with the pathname to see if the application is allowed write access to the file.
See Also
getPath, checkRead


 RandomAccessFile.close

RandomAccessFile.close

Syntax
public native void close() throws IOException
Description
Closes this random access file stream and releases any system resources associated with the stream.

Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.getFD

RandomAccessFile.getFD

Syntax
public final FileDescriptor getFD() throws IOException
Returns
the file descriptor object associated with this stream.
Description
Returns the opaque file descriptor object associated with this stream.

Exceptions
IOException if an I/O error occurs.
See Also
FileDescriptor


 RandomAccessFile.getFilePointer

RandomAccessFile.getFilePointer

Syntax
public native long getFilePointer() throws IOException
Returns
the offset from the beginning of the file, in bytes, at which the next read or write occurs.
Description
Returns the current offset in this file.

Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.length

RandomAccessFile.length

Syntax
public native long length() throws IOException
Returns
the length of this file.
Description
Returns the length of this file.

Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.read

RandomAccessFile.read

Syntax 1
public native int read() throws IOException
Returns
the next byte of data, or -1 if the end of the file is reached.
Description
Reads a byte of data from this file. This method blocks if no input is yet available.

Exceptions
IOException if an I/O error occurs.

Syntax 2
public int read( byte b[], int off, int len ) throws IOException
Parameters
b
the buffer into which the data is read.
off
the start offset of the data.
len
the maximum number of bytes read.
Returns
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached.
Description
Reads up to len bytes of data from this file into an array of bytes. This method blocks until at least one byte of input is available.

Exceptions
IOException if an I/O error occurs.

Syntax 3
public int read( byte b[] ) throws IOException
Parameters
b
the buffer into which the data is read.
Returns
the total number of bytes read into the buffer, or -1 if there is no more data because the end of this file has been reached.
Description
Reads up to b.length bytes of data from this file into an array of bytes. This method blocks until at least one byte of input is available.

Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.readBoolean

RandomAccessFile.readBoolean

Syntax
public final boolean readBoolean() throws IOException
Returns
the boolean value read.
Description
Reads a boolean from this file. This method reads a single byte from the file. A value of 0 represents false. Any other value represents true. This method blocks until the byte is read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this file has reached the end.
Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.readByte

RandomAccessFile.readByte

Syntax
public final byte readByte() throws IOException
Returns
the next byte of this file as a signed 8-bit byte.
Description
Reads a signed 8-bit value from this file. This method reads a byte from the file. If the byte read is b, where 0 <= b <= 255, then the result is:
    (byte)(b)

This method blocks until the byte is read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this file has reached the end.
Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.readChar

RandomAccessFile.readChar

Syntax
public final char readChar() throws IOException
Returns
the next two bytes of this file as a Unicode character.
Description
Reads a Unicode character from this file. This method reads two bytes from the file. If the bytes read, in order, are b1 and b2, where 0 <= b1, b2 <= 255, then the result is equal to:
    (char)((b1 << 8) | b2)

This method blocks until the two bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this file reaches the end before reading two bytes.
Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.readDouble

RandomAccessFile.readDouble

Syntax
public final double readDouble() throws IOException
Returns
the next eight bytes of this file, interpreted as a double.
Description
Reads a double from this file. This method reads a long value as if by the readLong method and then converts that long to a double using the longBitsToDouble method in class Double.

This method blocks until the eight bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this file reaches the end before reading eight bytes.
Exceptions
IOException if an I/O error occurs.
See Also
readLong, longBitsToDouble


 RandomAccessFile.readFloat

RandomAccessFile.readFloat

Syntax
public final float readFloat() throws IOException
Returns
the next four bytes of this file, interpreted as a float.
Description
Reads a float from this file. This method reads an int value as if by the readInt method and then converts that int to a float using the intBitsToFloat method in class Float.

This method blocks until the four bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this file reaches the end before reading four bytes.
Exceptions
IOException if an I/O error occurs.
See Also
readInt, intBitsToFloat


 RandomAccessFile.readFully

RandomAccessFile.readFully

Syntax 1
public final void readFully( byte b[] ) throws IOException
Parameters
b
the buffer into which the data is read.
Description
Reads b.length bytes from this file into the byte array. This method reads repeatedly from the file until all the bytes are read. This method blocks until all the bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this file reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.

Syntax 2
public final void readFully( byte b[], int off, int len ) throws IOException
Parameters
b
the buffer into which the data is read.
off
the start offset of the data.
len
the number of bytes to read.
Description
Reads exactly len bytes from this file into the byte array. This method reads repeatedly from the file until all the bytes are read. This method blocks until all the bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this file reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.readInt

RandomAccessFile.readInt

Syntax
public final int readInt() throws IOException
Returns
the next four bytes of this file, interpreted as an int.
Description
Reads a signed 32-bit integer from this file. This method reads 4 bytes from the file. If the bytes read, in order, are b1, b2, b3, and b4, where 0 <= b1, b2, b3, b4 <= 255, then the result is equal to:
    (b1 << 24) | (b2 << 16) + (b3 << 8) + b4

This method blocks until the four bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this file reaches the end before reading four bytes.
Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.readLine

RandomAccessFile.readLine

Syntax
public final String readLine() throws IOException
Returns
the next line of text from this file.
Description
Reads the next line of text from this file. This method successively reads bytes from the file until it reaches the end of a line of text.

A line of text is terminated by a carriage-return character ('\r'), a newline character ('\n'), a carriage-return character immediately followed by a newline character, or the end of the input stream. The line-terminating character(s), if any, are included as part of the string returned.

This method blocks until a newline character is read, a carriage return and the byte following it are read (to see if it is a newline), the end of the stream is detected, or an exception is thrown.

Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.readLong

RandomAccessFile.readLong

Syntax
public final long readLong() throws IOException
Returns
the next eight bytes of this file, interpreted as a long.
Description
Reads a signed 64-bit integer from this file. This method reads eight bytes from the file. If the bytes read, in order, are b1, b2, b3, b4, b5, b6, b7, and b8, where:
    0 <= b1, b2, b3, b4, b5, b6, b7, b8 <=255,

then the result is equal to:

     ((long)b1 << 56) + ((long)b2 << 48)
     + ((long)b3 << 40) + ((long)b4 << 32)
     + ((long)b5 << 24) + ((long)b6 << 16)
     + ((long)b7 << 8) + b8

This method blocks until the eight bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this file reaches the end before reading eight bytes.
Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.readShort

RandomAccessFile.readShort

Syntax
public final short readShort() throws IOException
Returns
the next two bytes of this file, interpreted as a signed 16-bit number.
Description
Reads a signed 16-bit number from this file. The method reads 2 bytes from this file. If the two bytes read, in order, are b1 and b2, where each of the two values is between 0 and 255, inclusive, then the result is equal to:
    (short)((b1 << 8) | b2)

This method blocks until the two bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this file reaches the end before reading two bytes.
Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.readUnsignedByte

RandomAccessFile.readUnsignedByte

Syntax
public final int readUnsignedByte() throws IOException
Returns
the next byte of this file, interpreted as an unsigned 8-bit number.
Description
Reads an unsigned 8-bit number from this file. This method reads a byte from this file and returns that byte.

This method blocks until the byte is read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this file has reached the end.
Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.readUnsignedShort

RandomAccessFile.readUnsignedShort

Syntax
public final int readUnsignedShort() throws IOException
Returns
the next two bytes of this file, interpreted as an unsigned 16-bit integer.
Description
Reads an unsigned 16-bit number from this file. This method reads two bytes from the file. If the bytes read, in order, are b1 and b2, where 0 <= b1, b2 <= 255, then the result is equal to:
    (b1 << 8) | b2

This method blocks until the two bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this file reaches the end before reading two bytes.
Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.readUTF

RandomAccessFile.readUTF

Syntax
public final String readUTF() throws IOException
Returns
a Unicode string.
Description
Reads in a string from this file. The string has been encoded using a modified UTF-8 format.

The first two bytes are read as if by readUnsignedShort. This value gives the number of following bytes that are in the encoded string, not the length of the resulting string. The following bytes are then interpreted as bytes encoding characters in the UTF-8 format and are converted into characters.

This method blocks until all the bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this file reaches the end before reading all the bytes.
Exceptions
IOException if an I/O error occurs.
Exceptions
UTFDataFormatException if the bytes do not represent valid UTF-8 encoding of a Unicode string.
See Also
readUnsignedShort


 RandomAccessFile.seek

RandomAccessFile.seek

Syntax
public native void seek( long pos ) throws IOException
Parameters
pos
the absolute position.
Description
Sets the offset from the beginning of this file at which the next read or write occurs.

Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.skipBytes

RandomAccessFile.skipBytes

Syntax
public int skipBytes( int n ) throws IOException
Parameters
n
the number of bytes to be skipped.
Returns
the number of bytes skipped, which is always n.
Description
Skips exactly n bytes of input.

This method blocks until all the bytes are skipped, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this file reaches the end before skipping all the bytes.
Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.write

RandomAccessFile.write

Syntax 1
public native void write( int b ) throws IOException
Parameters
b
the byte to be written.
Description
Writes the specified byte to this file.

Exceptions
IOException if an I/O error occurs.

Syntax 2
public void write( byte b[] ) throws IOException
Parameters
b
the data.
Description
Writes b.length bytes from the specified byte array starting at offset off to this file.

Exceptions
IOException if an I/O error occurs.

Syntax 3
public void write( byte b[], int off, int len ) throws IOException
Parameters
b
the data.
off
the start offset in the data.
len
the number of bytes to write.
Description
Writes len bytes from the specified byte array starting at offset off to this file.

Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.writeBoolean

RandomAccessFile.writeBoolean

Syntax
public final void writeBoolean( boolean v ) throws IOException
Parameters
v
a boolean value to be written.
Description
Writes a boolean to the file as a 1-byte value. The value true is written out as the value (byte)1; the value false is written out as the value (byte)0.

Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.writeByte

RandomAccessFile.writeByte

Syntax
public final void writeByte( int v ) throws IOException
Parameters
v
a byte value to be written.
Description
Writes a byte to the file as a 1-byte value.

Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.writeBytes

RandomAccessFile.writeBytes

Syntax
public final void writeBytes( String s ) throws IOException
Parameters
s
a string of bytes to be written.
Description
Writes the string to the file as a sequence of bytes. Each character in the string is written out, in sequence, by discarding its high eight bits.

Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.writeChar

RandomAccessFile.writeChar

Syntax
public final void writeChar( int v ) throws IOException
Parameters
v
a char value to be written.
Description
Writes a char to the file as a 2-byte value, high byte first.

Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.writeChars

RandomAccessFile.writeChars

Syntax
public final void writeChars( String s ) throws IOException
Parameters
s
a String value to be written.
Description
Writes a string to the file as a sequence of characters. Each character is written to the data output stream as if by the writeChar method.

Exceptions
IOException if an I/O error occurs.
See Also
writeChar


 RandomAccessFile.writeDouble

RandomAccessFile.writeDouble

Syntax
public final void writeDouble( double v ) throws IOException
Parameters
v
a double value to be written.
Description
Converts the double argument to a long using the doubleToLongBits method in class Double, and then writes that long value to the file as an 8-byte quantity, high byte first.

Exceptions
IOException if an I/O error occurs.
See Also
doubleToLongBits


 RandomAccessFile.writeFloat

RandomAccessFile.writeFloat

Syntax
public final void writeFloat( float v ) throws IOException
Parameters
v
a float value to be written.
Description
Converts the float argument to an int using the floatToIntBits method in class Float, and then writes that int value to the file as a 4-byte quantity, high byte first.

Exceptions
IOException if an I/O error occurs.
See Also
floatToIntBits


 RandomAccessFile.writeInt

RandomAccessFile.writeInt

Syntax
public final void writeInt( int v ) throws IOException
Parameters
v
an int to be written.
Description
Writes an int to the file as four bytes, high byte first.

Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.writeLong

RandomAccessFile.writeLong

Syntax
public final void writeLong( long v ) throws IOException
Parameters
v
a long to be written.
Description
Writes a long to the file as eight bytes, high byte first.

Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.writeShort

RandomAccessFile.writeShort

Syntax
public final void writeShort( int v ) throws IOException
Parameters
v
a short to be written.
Description
Writes a short to the file as two bytes, high byte first.

Exceptions
IOException if an I/O error occurs.


 RandomAccessFile.writeUTF

RandomAccessFile.writeUTF

Syntax
public final void writeUTF( String str ) throws IOException
Parameters
str
a string to be written.
Description
Writes a string to the file using UTF-8 encoding in a machine-independent manner.

First, two bytes are written to the file as if by the writeShort method giving the number of bytes to follow. This value is the number of bytes actually written out, not the length of the string. Following the length, each character of the string is output, in sequence, using the UTF-8 encoding for each character.

Exceptions
IOException if an I/O error occurs.


 Class Reader

Class java.io.Reader

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Reader

public abstract class Reader
extends Object

Abstract class for reading character streams. The only methods that a subclass must implement are read(char[], int, int) and close(). Most subclasses, however, will override some of the methods defined here in order to provide higher efficiency, additional functionality, or both.

See Also:
BufferedReader, LineNumberReader, CharArrayReader, InputStreamReader, FileReader, FilterReader, PushbackReader, PipedReader, StringReader, Writer


 Reader Members

Reader Members

Class Overview | This Package | All Packages

Fields
Name | Description
lock | The object used to synchronize operations on this stream.

Constructors
Name | Description
Reader() | Create a new character-stream reader whose critical sections will synchronize on the reader itself.
Reader(Object) | Create a new character-stream reader whose critical sections will synchronize on the given object.

Methods
Name | Description
close() | Close the stream.
mark(int) | Mark the present position in the stream.
markSupported() | Tell whether this stream supports the mark() operation.
read() | Read a single character.
read(char[]) | Read characters into an array.
read(char[], int, int) | Read characters into a portion of an array.
ready() | Tell whether this stream is ready to be read.
reset() | Reset the stream.
skip(long) | Skip characters.


 Reader.lock

Reader.lock

Syntax
protected Object lock
Description
The object used to synchronize operations on this stream. For efficiency, a character-stream object may use an object other than itself to protect critical sections. A subclass should therefore use the object in this field rather than this or a synchronized method.


 Reader.Reader

Reader.Reader

Syntax 1
protected Reader()
Description
Create a new character-stream reader whose critical sections will synchronize on the reader itself.

Syntax 2
protected Reader( Object lock )
Description
Create a new character-stream reader whose critical sections will synchronize on the given object.


 Reader.close

Reader.close

Syntax
public abstract void close() throws IOException
Description
Close the stream. Once a stream has been closed, further read(), ready(), mark(), or reset() invocations will throw an IOException. Closing a previously-closed stream, however, has no effect.

Exceptions
IOException If an I/O error occurs


 Reader.mark

Reader.mark

Syntax
public void mark( int readAheadLimit ) throws IOException
Parameters
readAheadLimit
Limit on the number of characters that may be read while still preserving the mark. After reading this many characters, attempting to reset the stream may fail.
Description
Mark the present position in the stream. Subsequent calls to reset() will attempt to reposition the stream to this point. Not all character-input streams support the mark() operation.

Exceptions
IOException If the stream does not support mark(), or if some other I/O error occurs


 Reader.markSupported

Reader.markSupported

Syntax
public boolean markSupported()
Description
Tell whether this stream supports the mark() operation.


 Reader.read

Reader.read

Syntax 1
public int read() throws IOException
Returns
The character read, as an integer in the range 0 to 16383 (0x00-0xffff), or -1 if the end of the stream has been reached
Description
Read a single character. This method will block until a character is available, an I/O error occurs, or the end of the stream is reached.

Subclasses that intend to support efficient single-character input should override this method.

Exceptions
IOException If an I/O error occurs

Syntax 2
public int read( char cbuf[] ) throws IOException
Parameters
cbuf
Destination buffer
Returns
The number of bytes read, or -1 if the end of the stream has been reached
Description
Read characters into an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

Exceptions
IOException If an I/O error occurs

Syntax 3
public abstract int read( char cbuf[], int off, int len ) throws IOException
Parameters
cbuf
Destination buffer
off
Offset at which to start storing characters
len
Maximum number of characters to read
Returns
The number of characters read, or -1 if the end of the stream has been reached
Description
Read characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

Exceptions
IOException If an I/O error occurs


 Reader.ready

Reader.ready

Syntax
public boolean ready() throws IOException
Returns
True if the next read() is guaranteed not to block for input, false otherwise. Note that returning false does not guarantee that the next read will block.
Description
Tell whether this stream is ready to be read.

Exceptions
IOException If an I/O error occurs


 Reader.reset

Reader.reset

Syntax
public void reset() throws IOException
Description
Reset the stream. If the stream has been marked, then attempt to reposition it at the mark. If the stream has not been marked, then attempt to reset it in some way appropriate to the particular stream, for example by repositioning it to its starting point. Not all character-input streams support the reset() operation, and some support reset() without supporting mark().

Exceptions
IOException If the stream has not been marked, or if the mark has been invalidated, or if the stream does not support reset(), or if some other I/O error occurs


 Reader.skip

Reader.skip

Syntax
public long skip( long n ) throws IOException
Parameters
n
The number of characters to skip
Returns
The number of characters actually skipped
Description
Skip characters. This method will block until some characters are available, an I/O error occurs, or the end of the stream is reached.

Exceptions
IOException If an I/O error occurs


 Class SequenceInputStream

Class java.io.SequenceInputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.SequenceInputStream

public class SequenceInputStream
extends InputStream

The sequence input stream class allows an application to combine several input streams serially and make them appear as if they were a single input stream. Each input stream is read from, in turn, until it reaches the end of the stream. The sequence input stream class then closes that stream and automatically switches to the next input stream.


 SequenceInputStream Members

SequenceInputStream Members

Class Overview | This Package | All Packages

Constructors
Name | Description
SequenceInputStream(Enumeration) | Constructs a new sequence input stream initialized to the specified enumeration of input streams.
SequenceInputStream(InputStream, InputStream) | Constructs a new sequence input stream initialized to read first from the input stream s1, and then from the input stream s2.

Methods
Name | Description
available() | Returns the number of bytes available on the current stream.
close() | Closes this input stream and releases any system resources associated with the stream.
read() | Reads the next byte of data from this input stream.
read(byte[], int, int) | Reads up to len bytes of data from this input stream into an array of bytes.


 SequenceInputStream.SequenceInputStream

SequenceInputStream.SequenceInputStream

Syntax 1
public SequenceInputStream( Enumeration e )
Parameters
e
an enumeration of input streams.
Description
Constructs a new sequence input stream initialized to the specified enumeration of input streams. Each object in the enumeration must be an InputStream.

See Also
Enumeration

Syntax 2
public SequenceInputStream( InputStream s1, InputStream s2 )
Parameters
s1
the first input stream to read.
s2
the second input stream to read.
Description
Constructs a new sequence input stream initialized to read first from the input stream s1, and then from the input stream s2.


 SequenceInputStream.available

SequenceInputStream.available

Syntax
public int available() throws IOException
Description
Returns the number of bytes available on the current stream.

Overrides
available in class InputStream


 SequenceInputStream.close

SequenceInputStream.close

Syntax
public void close() throws IOException
Description
Closes this input stream and releases any system resources associated with the stream.

The close method of SequenceInputStream calls the close method of both the substream from which it is currently reading and the close method of all the substreams that it has not yet begun to read from.

Exceptions
IOException if an I/O error occurs.
Overrides
close in class InputStream


 SequenceInputStream.read

SequenceInputStream.read

Syntax 1
public int read() throws IOException
Returns
the next byte of data, or -1 if the end of the stream is reached.
Description
Reads the next byte of data from this input stream. The byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

The read method of SequenceInputStream tries to read one character from the current substream. If it reaches the end of the stream, it calls the close method of the current substream and begins reading from the next substream.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class InputStream

Syntax 2
public int read( byte buf[], int pos, int len ) throws IOException
Parameters
b
the buffer into which the data is read.
off
the start offset of the data.
len
the maximum number of bytes read.
Description
Reads up to len bytes of data from this input stream into an array of bytes. This method blocks until at least 1 byte of input is available. If the first argument is null, up to len bytes are read and discarded.

The read method of SequenceInputStream tries to read the data from the current substream. If it fails to read any characters because the substream has reached the end of the stream, it calls the close method of the current substream and begins reading from the next substream.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class InputStream


 Interface Serializable

Interface java.io.Serializable

This Package | All Packages

public interface Serializable

Serializability of a class is enabled by the class implementing the java.io.Serializable interface. Classes that do not implement this interface will not have any of their state serialized or deserialized. All subtypes of a serializable class are themselves serializable. The serialization interface has no methods or fields and serves only to identify the semantics of being serializable.

To allow subtypes of non-serializable classes to be serialized, the subtype may assume responsibility for saving and restoring the state of the supertype's public, protected, and (if accessible) package fields. The subtype may assume this responsibility only if the class it extends has an accessible no-arg constructor to initialize the class's state. It is an error to declare a class Serializable in this case. The error will be detected at runtime.

During deserialization, the fields of non-serializable classes will be initialized using the public or protected no-arg constructor of the class. A no-arg constructor must be accessible to the subclass that is serializable. The fields of serializable subclasses will be restored from the stream.

When traversing a graph, an object may be encountered that does not support the Serializable interface. In this case the NotSerializableException will be thrown and will identify the class of the non-serializable object.

Classes that require special handling during the serialization and deserialization process must implement special methods with these exact signatures:

 private void writeObject(java.io.ObjectOutputStream out)
     throws IOException
 private void readObject(java.io.ObjectInputStream in)
     throws IOException, ClassNotFoundException;

The writeObject method is responsible for writing the state of the object for its particular class so that the corresponding readObject method can restore it. The default mechanism for saving the Object's fields can be invoked by calling out.defaultWriteObject. The method does not need to concern itself with the state belonging to its superclasses or subclasses. State is saved by writing the individual fields to the ObjectOutputStream using the writeObject method or by using the methods for primitive data types supported by DataOutput.

The readObject method is responsible for reading from the stream and restoring the classes fields. It may call in.defaultReadObject to invoke the default mechanism for restoring the object's non-static and non-transient fields. The defaultReadObject method uses information in the stream to assign the fields of the object saved in the stream with the correspondingly named fields in the current object. This handles the case when the class has evolved to add new fields. The method does not need to concern itself with the state belonging to its superclasses or subclasses. State is saved by writing the individual fields to the ObjectOutputStream using the writeObject method or by using the methods for primitive data types supported by DataOutput.

See Also:
ObjectOutputStream, ObjectInputStream, ObjectOutput, ObjectInput, Externalizable


 Class StreamCorruptedException

Class java.io.StreamCorruptedException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.io.ObjectStreamException
                                   |
                                   +----java.io.StreamCorruptedException

public class StreamCorruptedException
extends ObjectStreamException

Raised when control information read from an object stream violates internal consistency checks.


 StreamCorruptedException Members

StreamCorruptedException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
StreamCorruptedException() | Create a StreamCorruptedException with no reason.
StreamCorruptedException(String) | Create a StreamCorruptedException with a reason.


 StreamCorruptedException.StreamCorruptedException

StreamCorruptedException.StreamCorruptedException

Syntax 1
public StreamCorruptedException( String reason )
Description
Create a StreamCorruptedException with a reason.

Syntax 2
public StreamCorruptedException()
Description
Create a StreamCorruptedException with no reason.


 Class StreamTokenizer

Class java.io.StreamTokenizer

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.StreamTokenizer

public class StreamTokenizer
extends Object

The StreamTokenizer class takes an input stream and parses it into "tokens", allowing the tokens to be read one at a time. The parsing process is controlled by a table and a number of flags that can be set to various states. The stream tokenizer can recognize identifiers, numbers, quoted strings, and various comment styles.

Each byte read from the input stream is regarded as a character in the range '\u0000' through '\u00FF'. The character value is used to look up five possible attributes of the character: white space, alphabetic, numeric, string quote, and comment character. Each character can have zero or more of these attributes.

In addition, an instance has four flags. These flags indicate:

  • Whether line terminators are to be returned as tokens or treated as white space that merely separates tokens.
  • Whether C-style comments are to be recognized and skipped.
  • Whether C++-style comments are to be recognized and skipped.
  • Whether the characters of identifiers are converted to lowercase.

A typical application first constructs an instance of this class, sets up the syntax tables, and then repeatedly loops calling the nextToken method in each iteration of the loop until it returns the value TT_EOF.

See Also:
nextToken, TT_EOF


 StreamTokenizer Members

StreamTokenizer Members

Class Overview | This Package | All Packages

Fields
Name | Description
nval | If the current token is a number, this field contains the value of that number.
sval | If the current token is a word token, this field contains a string giving the characters of the word token.
TT_EOF | A constant indicating that the end of the stream has been read.
TT_EOL | A constant indicating that the end of the line has been read.
TT_NUMBER | A constant indicating that a number token has been read.
TT_WORD | A constant indicating that a word token has been read.
ttype | After a call to the nextToken method, this field contains the type of the token just read.

Constructors
Name | Description
StreamTokenizer(InputStream) | Creates a stream tokenizer that parses the specified input stream. Deprecated.
StreamTokenizer(Reader) | Create a tokenizer that parses the given character stream.

Methods
Name | Description
commentChar(int) | Specified that the character argument starts a single-line comment.
eolIsSignificant(boolean) | Determines whether or not ends of line are treated as tokens.
lineno() | Return the current line number.
lowerCaseMode(boolean) | Determines whether or not word token are automatically lowercased.
nextToken() | Parses the next token from the input stream of this tokenizer.
ordinaryChar(int) | Specifies that the character argument is "ordinary" in this tokenizer.
ordinaryChars(int, int) | Specifies that all characters c in the range low <= c <= high are "ordinary" in this tokenizer.
parseNumbers() | Specifies that numbers should be parsed by this tokenizer.
pushBack() | Causes the next call to the nextToken method of this tokenizer to return the current value in the ttype field, and not to modify the value in the nval or sval field.
quoteChar(int) | Specifies that matching pairs of this character delimit string constants in this tokenizer.
resetSyntax() | Resets this tokenizer's syntax table so that all characters are "ordinary." See the ordinaryChar method for more information on a character being ordinary.
slashSlashComments(boolean) | Determines whether or not the tokenizer recognizes C++-style comments.
slashStarComments(boolean) | Determines whether or not the tokenizer recognizes C-style comments.
toString() | Returns the string representation of the current stream token.
whitespaceChars(int, int) | Specifies that all characters c in the range low <= c <= high are white space characters.
wordChars(int, int) | Specifies that all characters c in the range low <= c <= high are word constituents.


 StreamTokenizer.nval

StreamTokenizer.nval

Syntax
public double nval
Description
If the current token is a number, this field contains the value of that number. The current token is a number when the value of the ttype field is TT_NUMBER.

See Also
TT_NUMBER, ttype


 StreamTokenizer.sval

StreamTokenizer.sval

Syntax
public String sval
Description
If the current token is a word token, this field contains a string giving the characters of the word token. When the current token is a quoted string token, this field contains the body of the string.

The current token is a word when the value of the ttype field is TT_WORD. The current token is a quoted string token when the value of the ttype field is a quote character.

See Also
quoteChar, TT_WORD, ttype


 StreamTokenizer.TT_EOF

StreamTokenizer.TT_EOF

Syntax
public static final int TT_EOF
Description
A constant indicating that the end of the stream has been read.


 StreamTokenizer.TT_EOL

StreamTokenizer.TT_EOL

Syntax
public static final int TT_EOL
Description
A constant indicating that the end of the line has been read.


 StreamTokenizer.TT_NUMBER

StreamTokenizer.TT_NUMBER

Syntax
public static final int TT_NUMBER
Description
A constant indicating that a number token has been read.


 StreamTokenizer.TT_WORD

StreamTokenizer.TT_WORD

Syntax
public static final int TT_WORD
Description
A constant indicating that a word token has been read.


 StreamTokenizer.ttype

StreamTokenizer.ttype

Syntax
public int ttype
Description
After a call to the nextToken method, this field contains the type of the token just read. For a single character token, its value is the single character, converted to an integer. For a quoted string token (see , its value is the quote character. Otherwise, its value is one of the following:
  • TT_WORD indicates that the token is a word.
  • TT_NUMBER indicates that the token is a number.
  • TT_EOL indicates that the end of line has been read. The field can only have this value if the eolIsSignificant method has been called with the argument true.
  • TT_EOF indicates that the end of the input stream has been reached.

See Also
eolIsSignificant, nextToken, quoteChar, TT_EOF, TT_EOL, TT_NUMBER, TT_WORD


 StreamTokenizer.StreamTokenizer

StreamTokenizer.StreamTokenizer

Syntax 1
public StreamTokenizer( InputStream is )
Parameters
is
an input stream.
Description
Note: StreamTokenizer() is deprecated. As of JDK version 1.1, the preferred way to tokenize an input stream is to convert it into a character stream, for example:

   Reader r = new BufferedReader(new InputStreamReader(is));
   StreamTokenizer st = new StreamTokenizer(r);

Creates a stream tokenizer that parses the specified input stream. The stream tokenizer is initialized to the following default state:

  • All byte values 'A' through 'Z', 'a' through 'z', and '\u00A0' through '\u00FF' are considered to be alphabetic.
  • All byte values '\u0000' through '\u0020' are considered to be white space.
  • '/' is a comment character.
  • Single quote '\'' and double quote '"' are string quote characters.
  • Numbers are parsed.
  • Ends of lines are treated as white space, not as separate tokens.
  • C-style and C++-style comments are not recognized.

See Also
BufferedReader, InputStreamReader, StreamTokenizer

Syntax 2
public StreamTokenizer( Reader r )
Description
Create a tokenizer that parses the given character stream.


 StreamTokenizer.commentChar

StreamTokenizer.commentChar

Syntax
public void commentChar( int ch )
Parameters
ch
the character.
Description
Specified that the character argument starts a single-line comment. All characters from the comment character to the end of the line are ignored by this stream tokenizer.


 StreamTokenizer.eolIsSignificant

StreamTokenizer.eolIsSignificant

Syntax
public void eolIsSignificant( boolean flag )
Parameters
flag
true indicates that end-of-line characters are separate tokens; false indicates that end-of-line characters are white space.
Description
Determines whether or not ends of line are treated as tokens. If the flag argument is true, this tokenizer treats end of lines as tokens; the nextToken method returns TT_EOL and also sets the ttype field to this value when an end of line is read.

A line is a sequence of characters ending with either a carriage-return character ('\r') or a newline character ('\n'). In addition, a carriage-return character followed immediately by a newline character is treated as a single end-of-line token.

If the flag is false, end-of-line characters are treated as white space and serve only to separate tokens.

See Also
nextToken, ttype, TT_EOL


 StreamTokenizer.lineno

StreamTokenizer.lineno

Syntax
public int lineno()
Returns
the current line number of this stream tokenizer.
Description
Return the current line number.


 StreamTokenizer.lowerCaseMode

StreamTokenizer.lowerCaseMode

Syntax
public void lowerCaseMode( boolean fl )
Parameters
fl
true indicates that all word tokens should be lowercased.
Description
Determines whether or not word token are automatically lowercased. If the flag argument is true, then the value in the sval field is lowercased whenever a word token is returned (the ttype field has the value TT_WORD by the nextToken method of this tokenizer.

If the flag argument is false, then the sval field is not modified.

See Also
nextToken, ttype, TT_WORD


 StreamTokenizer.nextToken

StreamTokenizer.nextToken

Syntax
public int nextToken() throws IOException
Returns
the value of the ttype field.
Description
Parses the next token from the input stream of this tokenizer. The type of the next token is returned in the ttype field. Additional information about the token may be in the nval field or the sval field of this tokenizer.

Typical clients of this class first set up the syntax tables and then sit in a loop calling nextToken to parse successive tokens until TT_EOF is returned.

Exceptions
IOException if an I/O error occurs.
See Also
nval, sval, ttype


 StreamTokenizer.ordinaryChar

StreamTokenizer.ordinaryChar

Syntax
public void ordinaryChar( int ch )
Parameters
ch
the character.
Description
Specifies that the character argument is "ordinary" in this tokenizer. It removes any special significance the character has as a comment character, word component, string delimiter, white space, or number character. When such a character is encountered by the parser, the parser treates it as a single-character token and sets ttype field to the character value.

See Also
ttype


 StreamTokenizer.ordinaryChars

StreamTokenizer.ordinaryChars

Syntax
public void ordinaryChars( int low, int hi )
Parameters
low
the low end of the range.
hi
the high end of the range.
Description
Specifies that all characters c in the range low <= c <= high are "ordinary" in this tokenizer. See the ordinaryChar method for more information on a character being ordinary.

See Also
ordinaryChar


 StreamTokenizer.parseNumbers

StreamTokenizer.parseNumbers

Syntax
public void parseNumbers()
Description
Specifies that numbers should be parsed by this tokenizer. The syntax table of this tokenizer is modified so that each of the twelve characters:
    0 1 2 3 4 5 6 7 8 9 . -

has the "numeric" attribute.

When the parser encounters a word token that has the format of a double precision floating-point number, it treats the token as a number rather than a word, by setting the the ttype field to the value TT_NUMBER and putting the numeric value of the token into the nval field.

See Also
nval, TT_NUMBER, ttype


 StreamTokenizer.pushBack

StreamTokenizer.pushBack

Syntax
public void pushBack()
Description
Causes the next call to the nextToken method of this tokenizer to return the current value in the ttype field, and not to modify the value in the nval or sval field.

See Also
nextToken, nval, sval, ttype


 StreamTokenizer.quoteChar

StreamTokenizer.quoteChar

Syntax
public void quoteChar( int ch )
Parameters
ch
the character.
Description
Specifies that matching pairs of this character delimit string constants in this tokenizer.

When the nextToken method encounters a string constant, the ttype field is set to the string delimiter and the sval field is set to the body of the string.

If a string quote character is encountered, then a string is recognized, consisting of all characters after (but not including) the string quote character, up to (but not including) the next occurrence of that same string quote character, or a line terminator, or end of file. The usual escape sequences such as "\n" and "\t" are recognized and converted to single characters as the string is parsed.

See Also
nextToken, sval, ttype


 StreamTokenizer.resetSyntax

StreamTokenizer.resetSyntax

Syntax
public void resetSyntax()
Description
Resets this tokenizer's syntax table so that all characters are "ordinary." See the ordinaryChar method for more information on a character being ordinary.

See Also
ordinaryChar


 StreamTokenizer.slashSlashComments

StreamTokenizer.slashSlashComments

Syntax
public void slashSlashComments( boolean flag )
Parameters
flag
true indicates to recognize and ignore C++-style comments.
Description
Determines whether or not the tokenizer recognizes C++-style comments. If the flag argument is true, this stream tokenizer recognizes C++-style comments. Any occurrence of two consecutive slash characters ('/') is treated as the beginning of a comment that extends to the end of the line.

If the flag argument is false, then C++-style comments are not treated specially.


 StreamTokenizer.slashStarComments

StreamTokenizer.slashStarComments

Syntax
public void slashStarComments( boolean flag )
Parameters
flag
true indicates to recognize and ignore C-style comments.
Description
Determines whether or not the tokenizer recognizes C-style comments. If the flag argument is true, this stream tokenizer recognizes C-style comments. All text between successive occurrences of /* and */ are discarded.

If the flag argument is false, then C-style comments are not treated specially.


 StreamTokenizer.toString

StreamTokenizer.toString

Syntax
public String toString()
Returns
a string representation of the token specified by the ttype, nval, and sval fields.
Description
Returns the string representation of the current stream token.

Overrides
toString in class Object
See Also
nval, sval, ttype


 StreamTokenizer.whitespaceChars

StreamTokenizer.whitespaceChars

Syntax
public void whitespaceChars( int low, int hi )
Parameters
low
the low end of the range.
hi
the high end of the range.
Description
Specifies that all characters c in the range low <= c <= high are white space characters. White space characters serve only to separate tokens in the input stream.


 StreamTokenizer.wordChars

StreamTokenizer.wordChars

Syntax
public void wordChars( int low, int hi )
Parameters
low
the low end of the range.
hi
the high end of the range.
Description
Specifies that all characters c in the range low <= c <= high are word constituents. A word token consists of a word constituent followed by zero or more word constituents or number constituents.


 Class StringBufferInputStream

Class java.io.StringBufferInputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.StringBufferInputStream

public class StringBufferInputStream
extends InputStream

Note: StringBufferInputStream is deprecated. This class does not properly convert characters into bytes. As of JDK 1.1, the preferred way to create a stream from a string is via the StringReader class.

This class allows an application to create an input stream in which the bytes read are supplied by the contents of a string. Applications can also read bytes from a byte array by using a ByteArrayInputStream.

Only the low eight bits of each character in the string are used by this class.

See Also:
ByteArrayInputStream, StringReader


 StringBufferInputStream Members

StringBufferInputStream Members

Class Overview | This Package | All Packages

Fields
Name | Description
buffer | The string from which bytes are read.
count | The number of valid characters in the input stream buffer.
pos | The index of the next character to read from the input stream buffer.

Constructors
Name | Description
StringBufferInputStream(String) | Creates a string input stream to read data from the specified string.

Methods
Name | Description
available() | Returns the number of bytes that can be read from the input stream without blocking.
read() | Reads the next byte of data from this input stream.
read(byte[], int, int) | Reads up to len bytes of data from this input stream into an array of bytes.
reset() | Resets the input stream to begin reading from the first character of this input stream's underlying buffer.
skip(long) | Skips n bytes of input from this input stream.


 StringBufferInputStream.buffer

StringBufferInputStream.buffer

Syntax
protected String buffer
Description
The string from which bytes are read.


 StringBufferInputStream.count

StringBufferInputStream.count

Syntax
protected int count
Description
The number of valid characters in the input stream buffer.

See Also
buffer


 StringBufferInputStream.pos

StringBufferInputStream.pos

Syntax
protected int pos
Description
The index of the next character to read from the input stream buffer.

See Also
buffer


 StringBufferInputStream.StringBufferInputStream

StringBufferInputStream.StringBufferInputStream

Syntax
public StringBufferInputStream( String s )
Parameters
s
the underlying input buffer.
Description
Creates a string input stream to read data from the specified string.


 StringBufferInputStream.available

StringBufferInputStream.available

Syntax
public synchronized int available()
Returns
the value of count - pos, which is the number of bytes remaining to be read from the input buffer.
Description
Returns the number of bytes that can be read from the input stream without blocking.

Overrides
available in class InputStream


 StringBufferInputStream.read

StringBufferInputStream.read

Syntax 1
public synchronized int read()
Returns
the next byte of data, or -1 if the end of the stream is reached.
Description
Reads the next byte of data from this input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned.

The read method of StringBufferInputStream cannot block. It returns the low eight bits of the next character in this input stream's buffer.

Overrides
read in class InputStream

Syntax 2
public synchronized int read( byte b[], int off, int len )
Parameters
b
the buffer into which the data is read.
off
the start offset of the data.
len
the maximum number of bytes read.
Returns
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Description
Reads up to len bytes of data from this input stream into an array of bytes.

The read method of StringBufferInputStream cannot block. It copies the low eight bits from the characters in this input stream's buffer into the byte array argument.

Overrides
read in class InputStream


 StringBufferInputStream.reset

StringBufferInputStream.reset

Syntax
public synchronized void reset()
Description
Resets the input stream to begin reading from the first character of this input stream's underlying buffer.

Overrides
reset in class InputStream


 StringBufferInputStream.skip

StringBufferInputStream.skip

Syntax
public synchronized long skip( long n )
Parameters
n
the number of bytes to be skipped.
Returns
the actual number of bytes skipped.
Description
Skips n bytes of input from this input stream. Fewer bytes might be skipped if the end of the input stream is reached.

Overrides
skip in class InputStream


 Class StringReader

Class java.io.StringReader

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Reader
           |
           +----java.io.StringReader

public class StringReader
extends Reader

A character stream whose source is a string.


 StringReader Members

StringReader Members

Class Overview | This Package | All Packages

Constructors
Name | Description
StringReader(String) | Create a new string reader.

Methods
Name | Description
close() | Close the stream.
mark(int) | Mark the present position in the stream.
markSupported() | Tell whether this stream supports the mark() operation, which it does.
read() | Read a single character.
read(char[], int, int) | Read characters into a portion of an array.
ready() | Tell whether this stream is ready to be read.
reset() | Reset the stream to the most recent mark, or to the beginning of the string if it has never been marked.
skip(long) | Skip characters.


 StringReader.StringReader

StringReader.StringReader

Syntax
public StringReader( String s )
Description
Create a new string reader.


 StringReader.close

StringReader.close

Syntax
public void close()
Description
Close the stream.

Overrides
close in class Reader


 StringReader.mark

StringReader.mark

Syntax
public void mark( int readAheadLimit ) throws IOException
Parameters
readAheadLimit
Limit on the number of characters that may be read while still preserving the mark. Because the stream's input comes from a string, there is no actual limit, so this argument is ignored.
Description
Mark the present position in the stream. Subsequent calls to reset() will reposition the stream to this point.

Exceptions
IOException If an I/O error occurs
Overrides
mark in class Reader


 StringReader.markSupported

StringReader.markSupported

Syntax
public boolean markSupported()
Description
Tell whether this stream supports the mark() operation, which it does.

Overrides
markSupported in class Reader


 StringReader.read

StringReader.read

Syntax 1
public int read() throws IOException
Returns
The character read, or -1 if the end of the stream has been reached
Description
Read a single character.

Exceptions
IOException If an I/O error occurs
Overrides
read in class Reader

Syntax 2
public int read( char cbuf[], int off, int len ) throws IOException
Parameters
cbuf
Destination buffer
off
Offset at which to start writing characters
len
Maximum number of characters to read
Returns
The number of characters read, or -1 if the end of the stream has been reached
Description
Read characters into a portion of an array.

Exceptions
IOException If an I/O error occurs
Overrides
read in class Reader


 StringReader.ready

StringReader.ready

Syntax
public boolean ready()
Description
Tell whether this stream is ready to be read. String readers are always ready to be read.

Overrides
ready in class Reader


 StringReader.reset

StringReader.reset

Syntax
public void reset() throws IOException
Description
Reset the stream to the most recent mark, or to the beginning of the string if it has never been marked.

Exceptions
IOException If an I/O error occurs
Overrides
reset in class Reader


 StringReader.skip

StringReader.skip

Syntax
public long skip( long ns ) throws IOException
Description
Skip characters.

Exceptions
IOException If an I/O error occurs
Overrides
skip in class Reader


 Class StringWriter

Class java.io.StringWriter

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Writer
           |
           +----java.io.StringWriter

public class StringWriter
extends Writer

A character stream that collects its output in a string buffer, which can then be used to construct a string.


 StringWriter Members

StringWriter Members

Class Overview | This Package | All Packages

Constructors
Name | Description
StringWriter() | Create a new string writer, using the default initial string-buffer size.
StringWriter(int) | Create a new string writer, using the specified initial string-buffer size.

Methods
Name | Description
close() | Close the stream.
flush() | Flush the stream.
getBuffer() | Return the string buffer itself.
toString() | Return the buffer's current value as a string.
write(char[], int, int) | Write a portion of an array of characters.
write(int) | Write a single character.
write(String) | Write a string.
write(String, int, int) | Write a portion of a string.


 StringWriter.StringWriter

StringWriter.StringWriter

Syntax 1
public StringWriter()
Description
Create a new string writer, using the default initial string-buffer size.

Syntax 2
protected StringWriter( int initialSize )
Description
Create a new string writer, using the specified initial string-buffer size.


 StringWriter.close

StringWriter.close

Syntax
public void close()
Description
Close the stream. This method does not release the buffer, since its contents might still be required.

Overrides
close in class Writer


 StringWriter.flush

StringWriter.flush

Syntax
public void flush()
Description
Flush the stream.

Overrides
flush in class Writer


 StringWriter.getBuffer

StringWriter.getBuffer

Syntax
public StringBuffer getBuffer()
Description
Return the string buffer itself.


 StringWriter.toString

StringWriter.toString

Syntax
public String toString()
Description
Return the buffer's current value as a string.

Overrides
toString in class Object


 StringWriter.write

StringWriter.write

Syntax 1
public void write( int c )
Description
Write a single character.

Overrides
write in class Writer

Syntax 2
public void write( char cbuf[], int off, int len )
Parameters
cbuf
Array of characters
off
Offset from which to start writing characters
len
Number of characters to write
Description
Write a portion of an array of characters.

Overrides
write in class Writer

Syntax 3
public void write( String str )
Description
Write a string.

Overrides
write in class Writer

Syntax 4
public void write( String str, int off, int len )
Parameters
str
String to be written
off
Offset from which to start writing characters
len
Number of characters to write
Description
Write a portion of a string.

Overrides
write in class Writer


 Class SyncFailedException

Class java.io.SyncFailedException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.io.SyncFailedException

public class SyncFailedException
extends IOException


 SyncFailedException Members

SyncFailedException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
SyncFailedException(String) | Constructs an SyncFailedException with a detail message.


 SyncFailedException.SyncFailedException

SyncFailedException.SyncFailedException

Syntax
public SyncFailedException( String desc )
Description
Constructs an SyncFailedException with a detail message. A detail message is a String that describes this particular exception.


 Class UTFDataFormatException

Class java.io.UTFDataFormatException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.io.UTFDataFormatException

public class UTFDataFormatException
extends IOException

Signals that a malformed UTF-8 string has been read in a data input stream or by any class that implements the data input interface. See the writeUTF method for the format in which UTF-8 strings are read and written.

See Also:
DataInput, readUTF, IOException


 UTFDataFormatException Members

UTFDataFormatException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
UTFDataFormatException() | Constructs a UTFDataFormatException with no detail message.
UTFDataFormatException(String) | Constructs a UTFDataFormatException with the specified detail message.


 UTFDataFormatException.UTFDataFormatException

UTFDataFormatException.UTFDataFormatException

Syntax 1
public UTFDataFormatException()
Description
Constructs a UTFDataFormatException with no detail message.

Syntax 2
public UTFDataFormatException( String s )
Parameters
s
the detail message.
Description
Constructs a UTFDataFormatException with the specified detail message.


 Class UnsupportedEncodingException

Class java.io.UnsupportedEncodingException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.io.UnsupportedEncodingException

public class UnsupportedEncodingException
extends IOException

The Character Encoding is not supported


 UnsupportedEncodingException Members

UnsupportedEncodingException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
UnsupportedEncodingException() | no detailed message
UnsupportedEncodingException(String) | detailed message


 UnsupportedEncodingException.UnsupportedEncodingException

UnsupportedEncodingException.UnsupportedEncodingException

Syntax 1
public UnsupportedEncodingException()
Description
no detailed message

Syntax 2
public UnsupportedEncodingException( String s )
Parameters
s
- detailed message
Description
detailed message


 Class WriteAbortedException

Class java.io.WriteAbortedException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.io.ObjectStreamException
                                   |
                                   +----java.io.WriteAbortedException

public class WriteAbortedException
extends ObjectStreamException


 WriteAbortedException Members

WriteAbortedException Members

Class Overview | This Package | All Packages

Fields
Name | Description
detail |

Constructors
Name | Description
WriteAbortedException(String, Exception) | A WriteAbortedException is thrown during a read when one of the ObjectStreamExceptions was thrown during writing.

Methods
Name | Description
getMessage() | Produce the message, include the message from the nested exception if there is one.


 WriteAbortedException.detail

WriteAbortedException.detail

Syntax
public Exception detail


 WriteAbortedException.WriteAbortedException

WriteAbortedException.WriteAbortedException

Syntax
public WriteAbortedException( String s, Exception ex )
Description
A WriteAbortedException is thrown during a read when one of the ObjectStreamExceptions was thrown during writing. The exception that terminated the write can be found in the detail field. The stream is reset to it's initial state, all references to objects already deserialized are discarded.


 WriteAbortedException.getMessage

WriteAbortedException.getMessage

Syntax
public String getMessage()
Description
Produce the message, include the message from the nested exception if there is one.

Overrides
getMessage in class Throwable


 Class Writer

Class java.io.Writer

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.Writer

public abstract class Writer
extends Object

Abstract class for writing to character streams. The only methods that a subclass must implement are write(char[], int, int), flush(), and close(). Most subclasses, however, will override some of the methods defined here in order to provide higher efficiency, additional functionality, or both.

See Also:
Writer, BufferedWriter, CharArrayWriter, FilterWriter, OutputStreamWriter, FileWriter, PipedWriter, PrintWriter, StringWriter, Reader


 Writer Members

Writer Members

Class Overview | This Package | All Packages

Fields
Name | Description
lock | The object used to synchronize operations on this stream.

Constructors
Name | Description
Writer() | Create a new character-stream writer whose critical sections will synchronize on the writer itself.
Writer(Object) | Create a new character-stream writer whose critical sections will synchronize on the given object.

Methods
Name | Description
close() | Close the stream, flushing it first.
flush() | Flush the stream.
write(char[]) | Write an array of characters.
write(char[], int, int) | Write a portion of an array of characters.
write(int) | Write a single character.
write(String) | Write a string.
write(String, int, int) | Write a portion of a string.


 Writer.lock

Writer.lock

Syntax
protected Object lock
Description
The object used to synchronize operations on this stream. For efficiency, a character-stream object may use an object other than itself to protect critical sections. A subclass should therefore use the object in this field rather than this or a synchronized method.


 Writer.Writer

Writer.Writer

Syntax 1
protected Writer()
Description
Create a new character-stream writer whose critical sections will synchronize on the writer itself.

Syntax 2
protected Writer( Object lock )
Description
Create a new character-stream writer whose critical sections will synchronize on the given object.


 Writer.close

Writer.close

Syntax
public abstract void close() throws IOException
Description
Close the stream, flushing it first. Once a stream has been closed, further write() or flush() invocations will cause an IOException to be thrown. Closing a previously-closed stream, however, has no effect.

Exceptions
IOException If an I/O error occurs


 Writer.flush

Writer.flush

Syntax
public abstract void flush() throws IOException
Description
Flush the stream. If the stream has saved any characters from the various write() methods in a buffer, write them immediately to their intended destination. Then, if that destination is another character or byte stream, flush it. Thus one flush() invocation will flush all the buffers in a chain of Writers and OutputStreams.

Exceptions
IOException If an I/O error occurs


 Writer.write

Writer.write

Syntax 1
public void write( int c ) throws IOException
Description
Write a single character. The character to be written is contained in the 16 low-order bits of the given integer value; the 16 high-order bits are ignored.

Subclasses that intend to support efficient single-character output should override this method.

Exceptions
IOException If an I/O error occurs

Syntax 2
public void write( char cbuf[] ) throws IOException
Parameters
cbuf
Array of characters to be written
Description
Write an array of characters.

Exceptions
IOException If an I/O error occurs

Syntax 3
public abstract void write( char cbuf[], int off, int len ) throws IOException
Parameters
cbuf
Array of characters
off
Offset from which to start writing characters
len
Number of characters to write
Description
Write a portion of an array of characters.

Exceptions
IOException If an I/O error occurs

Syntax 4
public void write( String str ) throws IOException
Parameters
str
String to be written
Description
Write a string.

Exceptions
IOException If an I/O error occurs

Syntax 5
public void write( String str, int off, int len ) throws IOException
Parameters
str
A String
off
Offset from which to start writing characters
len
Number of characters to write
Description
Write a portion of a string.

Exceptions
IOException If an I/O error occurs


 Package java.lang

Package java.lang

All Packages

Interfaces

  • Cloneable
  • Runnable

    • Classes

  • Boolean
  • Byte
  • Character
  • Class
  • ClassLoader
  • Compiler
  • Double
  • Float
  • Integer
  • Long
  • Math
  • Number
  • Object
  • Process
  • Runtime
  • SecurityManager
  • Short
  • String
  • StringBuffer
  • System
  • Thread
  • ThreadGroup
  • Throwable
  • Void

    • Exceptions

  • ArithmeticException
  • ArrayIndexOutOfBoundsException
  • ArrayStoreException
  • ClassCastException
  • ClassNotFoundException
  • CloneNotSupportedException
  • Exception
  • IllegalAccessException
  • IllegalArgumentException
  • IllegalMonitorStateException
  • IllegalStateException
  • IllegalThreadStateException
  • IndexOutOfBoundsException
  • InstantiationException
  • InterruptedException
  • NegativeArraySizeException
  • NoSuchFieldException
  • NoSuchMethodException
  • NullPointerException
  • NumberFormatException
  • RuntimeException
  • SecurityException
  • StringIndexOutOfBoundsException

    • Errors

  • AbstractMethodError
  • ClassCircularityError
  • ClassFormatError
  • Error
  • ExceptionInInitializerError
  • IllegalAccessError
  • IncompatibleClassChangeError
  • InstantiationError
  • InternalError
  • LinkageError
  • NoClassDefFoundError
  • NoSuchFieldError
  • NoSuchMethodError
  • OutOfMemoryError
  • StackOverflowError
  • ThreadDeath
  • UnknownError
  • UnsatisfiedLinkError
  • VerifyError
  • VirtualMachineError


 Class AbstractMethodError

Class java.lang.AbstractMethodError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.LinkageError
                           |
                           +----java.lang.IncompatibleClassChangeError
                                   |
                                   +----java.lang.AbstractMethodError

public class AbstractMethodError
extends IncompatibleClassChangeError

Thrown when an application tries to call an abstract method. Normally, this error is caught by the compiler; this error can only occur at run time if the definition of some class has incompatibly changed since the currently executing method was last compiled.


 AbstractMethodError Members

AbstractMethodError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
AbstractMethodError() | Constructs an AbstractMethodError with no detail message.
AbstractMethodError(String) | Constructs an AbstractMethodError with the specified detail message.


 AbstractMethodError.AbstractMethodError

AbstractMethodError.AbstractMethodError

Syntax 1
public AbstractMethodError()
Description
Constructs an AbstractMethodError with no detail message.

Syntax 2
public AbstractMethodError( String s )
Parameters
s
the detail message.
Description
Constructs an AbstractMethodError with the specified detail message.


 Class ArithmeticException

Class java.lang.ArithmeticException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.lang.ArithmeticException

public class ArithmeticException
extends RuntimeException

Thrown when an exceptional arithmetic condition has occurred. For example, an integer "divide by zero" throws an instance of this class.


 ArithmeticException Members

ArithmeticException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ArithmeticException() | Constructs an ArithmeticException with no detail message.
ArithmeticException(String) | Constructs an ArithmeticException with the specified detail message.


 ArithmeticException.ArithmeticException

ArithmeticException.ArithmeticException

Syntax 1
public ArithmeticException()
Description
Constructs an ArithmeticException with no detail message.

Syntax 2
public ArithmeticException( String s )
Parameters
s
the detail message.
Description
Constructs an ArithmeticException with the specified detail message.


 Class ArrayIndexOutOfBoundsException

Class java.lang.ArrayIndexOutOfBoundsException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.lang.IndexOutOfBoundsException
                                   |
                                   +----java.lang.ArrayIndexOutOfBoundsException

public class ArrayIndexOutOfBoundsException
extends IndexOutOfBoundsException

Thrown to indicate that an array has been accessed with an illegal index. The index is either negative or greater than or equal to the size of the array.


 ArrayIndexOutOfBoundsException Members

ArrayIndexOutOfBoundsException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ArrayIndexOutOfBoundsException() | Constructs an ArrayIndexOutOfBoundsException with no detail message.
ArrayIndexOutOfBoundsException(int) | Constructs a new ArrayIndexOutOfBoundsException class with an argument indicating the illegal index.
ArrayIndexOutOfBoundsException(String) | Constructs an ArrayIndexOutOfBoundsException class with the specified detail message.


 ArrayIndexOutOfBoundsException.ArrayIndexOutOfBoundsException

ArrayIndexOutOfBoundsException.ArrayIndexOutOfBoundsException

Class Overview | Class Members | This Package | All Packages

Syntax 1
public ArrayIndexOutOfBoundsException()
Description
Constructs an ArrayIndexOutOfBoundsException with no detail message.

Syntax 2
public ArrayIndexOutOfBoundsException( int index )
Parameters
index
the illegal index.
Description
Constructs a new ArrayIndexOutOfBoundsException class with an argument indicating the illegal index.

Syntax 3
public ArrayIndexOutOfBoundsException( String s )
Parameters
s
the detail message.
Description
Constructs an ArrayIndexOutOfBoundsException class with the specified detail message.


 Class ArrayStoreException

Class java.lang.ArrayStoreException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.lang.ArrayStoreException

public class ArrayStoreException
extends RuntimeException

Thrown to indicate that an attempt has been made to store the wrong type of object into an array of objects. For example, the following code generates an ArrayStoreException:

     Object x[] = new String[3];
     x[0] = new Integer(0);


 ArrayStoreException Members

ArrayStoreException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ArrayStoreException() | Constructs an ArrayStoreException with no detail message.
ArrayStoreException(String) | Constructs an ArrayStoreException with the specified detail message.


 ArrayStoreException.ArrayStoreException

ArrayStoreException.ArrayStoreException

Syntax 1
public ArrayStoreException()
Description
Constructs an ArrayStoreException with no detail message.

Syntax 2
public ArrayStoreException( String s )
Parameters
s
the detail message.
Description
Constructs an ArrayStoreException with the specified detail message.


 Class Boolean

Class java.lang.Boolean

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Boolean

public final class Boolean
extends Object
implements Serializable

The Boolean class wraps a value of the primitive type boolean in an object. An object of type Boolean contains a single field whose type is boolean.

In addition, this class provides many methods for converting a boolean to a String and a String to a boolean, as well as other constants and methods useful when dealing with a boolean.


 Boolean Members

Boolean Members

Class Overview | This Package | All Packages

Fields
Name | Description
FALSE | The Boolean object corresponding to the primitive value false.
TRUE | The Boolean object corresponding to the primitive value true.
TYPE | The Class object representing the primitive type boolean.

Constructors
Name | Description
Boolean(boolean) | Allocates a Boolean object representing the value argument.
Boolean(String) | Allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string "true".

Methods
Name | Description
booleanValue() | Returns the value of this Boolean object as a boolean.
equals(Object) | Returns true if and only if the argument is not null and is a Boolean object that contains the same boolean value as this object.
getBoolean(String) | Returns is true if and only if the system property named by the argument exists and is equal to the string "true".
hashCode() | Returns a hash code for this Boolean.
toString() | Returns a String object representing this Boolean's value.
valueOf(String) | Returns the boolean value represented by the specified String.


 Boolean.FALSE

Boolean.FALSE

Syntax
public static final Boolean FALSE
Description
The Boolean object corresponding to the primitive value false.


 Boolean.TRUE

Boolean.TRUE

Syntax
public static final Boolean TRUE
Description
The Boolean object corresponding to the primitive value true.


 Boolean.TYPE

Boolean.TYPE

Syntax
public static final Class TYPE
Description
The Class object representing the primitive type boolean.


 Boolean.Boolean

Boolean.Boolean

Syntax 1
public Boolean( boolean value )
Parameters
value
the value of the Boolean.
Description
Allocates a Boolean object representing the value argument.

Syntax 2
public Boolean( String s )
Parameters
s
the string to be converted to a Boolean.
Description
Allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string "true". Otherwise, allocate a Boolean object representing the value false.


 Boolean.booleanValue

Boolean.booleanValue

Syntax
public boolean booleanValue()
Returns
the primitive boolean value of this object.
Description
Returns the value of this Boolean object as a boolean.


 Boolean.equals

Boolean.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the object to compare with.
Returns
true if the objects are the same; false otherwise.
Description
Returns true if and only if the argument is not null and is a Boolean object that contains the same boolean value as this object.

Overrides
equals in class Object


 Boolean.getBoolean

Boolean.getBoolean

Syntax
public static boolean getBoolean( String name )
Parameters
name
the system property name.
Returns
the boolean value of the system property.
Description
Returns is true if and only if the system property named by the argument exists and is equal to the string "true". (Beginning with Java 1.0.2, the test of this string is case insensitive.) A system property is accessible through getProperty, a method defined by the System class.

See Also
getProperty, getProperty


 Boolean.hashCode

Boolean.hashCode

Syntax
public int hashCode()
Returns
a hash code value for this object.
Description
Returns a hash code for this Boolean.

Overrides
hashCode in class Object


 Boolean.toString

Boolean.toString

Syntax
public String toString()
Returns
a string representation of this object.
Description
Returns a String object representing this Boolean's value. If this object contains the value true, a string equal to "true" is returned. Otherwise, a string equal to "false" is returned.

Overrides
toString in class Object


 Boolean.valueOf

Boolean.valueOf

Syntax
public static Boolean valueOf( String s )
Parameters
s
a string.
Returns
the Boolean value represented by the string.
Description
Returns the boolean value represented by the specified String. A new Boolean object is constructed. This Boolean contains the value true if the string argument is not null and is equal, ignoring case, to the string "true".


 Class Byte

Class java.lang.Byte

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Number
           |
           +----java.lang.Byte

public final class Byte
extends Number

The Byte class is the standard wrapper for byte values.

See Also:
Number


 Byte Members

Byte Members

Class Overview | This Package | All Packages

Fields
Name | Description
MAX_VALUE | The maximum value a Byte can have.
MIN_VALUE | The minimum value a Byte can have.
TYPE | The Class object representing the primitive type byte.

Constructors
Name | Description
Byte(byte) | Constructs a Byte object initialized to the specified byte value.
Byte(String) | Constructs a Byte object initialized to the value specified by the String parameter.

Methods
Name | Description
byteValue() | Returns the value of this Byte as a byte.
decode(String) | Decodes a String into a Byte.
doubleValue() | Returns the value of this Byte as a double.
equals(Object) | Compares this object to the specified object.
floatValue() | Returns the value of this Byte as a float.
hashCode() | Returns a hashcode for this Byte.
intValue() | Returns the value of this Byte as an int.
longValue() | Returns the value of this Byte as a long.
parseByte(String) | Assuming the specified String represents a byte, returns that byte's value.
parseByte(String, int) | Assuming the specified String represents a byte, returns that byte's value.
shortValue() | Returns the value of this Byte as a short.
toString() | Returns a String object representing this Byte's value.
toString(byte) | Returns a new String object representing the specified Byte.
valueOf(String) | Assuming the specified String represents a byte, returns a new Byte object initialized to that value.
valueOf(String, int) | Assuming the specified String represents a byte, returns a new Byte object initialized to that value.


 Byte.MAX_VALUE

Byte.MAX_VALUE

Syntax
public static final byte MAX_VALUE
Description
The maximum value a Byte can have.


 Byte.MIN_VALUE

Byte.MIN_VALUE

Syntax
public static final byte MIN_VALUE
Description
The minimum value a Byte can have.


 Byte.TYPE

Byte.TYPE

Syntax
public static final Class TYPE
Description
The Class object representing the primitive type byte.


 Byte.Byte

Byte.Byte

Syntax 1
public Byte( byte value )
Parameters
value
the initial value of the Byte
Description
Constructs a Byte object initialized to the specified byte value.

Syntax 2
public Byte( String s ) throws NumberFormatException
Parameters
s
the String to be converted to a Byte
Description
Constructs a Byte object initialized to the value specified by the String parameter. The radix is assumed to be 10.

Exceptions
NumberFormatException If the String does not contain a parsable byte.


 Byte.byteValue

Byte.byteValue

Syntax
public byte byteValue()
Description
Returns the value of this Byte as a byte.

Overrides
byteValue in class Number


 Byte.decode

Byte.decode

Syntax
public static Byte decode( String nm ) throws NumberFormatException
Parameters
nm
the string to decode
Description
Decodes a String into a Byte. The String may represent decimal, hexadecimal, and octal numbers.


 Byte.doubleValue

Byte.doubleValue

Syntax
public double doubleValue()
Description
Returns the value of this Byte as a double.

Overrides
doubleValue in class Number


 Byte.equals

Byte.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the object to compare with
Returns
true if the objects are the same; false otherwise.
Description
Compares this object to the specified object.

Overrides
equals in class Object


 Byte.floatValue

Byte.floatValue

Syntax
public float floatValue()
Description
Returns the value of this Byte as a float.

Overrides
floatValue in class Number


 Byte.hashCode

Byte.hashCode

Syntax
public int hashCode()
Description
Returns a hashcode for this Byte.

Overrides
hashCode in class Object


 Byte.intValue

Byte.intValue

Syntax
public int intValue()
Description
Returns the value of this Byte as an int.

Overrides
intValue in class Number


 Byte.longValue

Byte.longValue

Syntax
public long longValue()
Description
Returns the value of this Byte as a long.

Overrides
longValue in class Number


 Byte.parseByte

Byte.parseByte

Syntax 1
public static byte parseByte( String s ) throws NumberFormatException
Parameters
s
the String containing the byte
Description
Assuming the specified String represents a byte, returns that byte's value. Throws an exception if the String cannot be parsed as a byte. The radix is assumed to be 10.

Exceptions
NumberFormatException If the string does not contain a parsable byte.

Syntax 2
public static byte parseByte( String s, int radix ) throws NumberFormatException
Parameters
s
the String containing the byte
radix
the radix to be used
Description
Assuming the specified String represents a byte, returns that byte's value. Throws an exception if the String cannot be parsed as a byte.

Exceptions
NumberFormatException If the String does not contain a parsable byte.


 Byte.shortValue

Byte.shortValue

Syntax
public short shortValue()
Description
Returns the value of this Byte as a short.

Overrides
shortValue in class Number


 Byte.toString

Byte.toString

Syntax
public static String toString( byte b )
Parameters
b
the byte to be converted
Description
Returns a new String object representing the specified Byte. The radix is assumed to be 10.


 Byte.toString

Byte.toString

Syntax
public String toString()
Description
Returns a String object representing this Byte's value.

Overrides
toString in class Object


 Byte.valueOf

Byte.valueOf

Syntax 1
public static Byte valueOf( String s, int radix ) throws NumberFormatException
Parameters
s
the String containing the integer
radix
the radix to be used
Description
Assuming the specified String represents a byte, returns a new Byte object initialized to that value. Throws an exception if the String cannot be parsed as a byte.

Exceptions
NumberFormatException If the String does not contain a parsable byte.

Syntax 2
public static Byte valueOf( String s ) throws NumberFormatException
Parameters
s
the String containing the integer
Description
Assuming the specified String represents a byte, returns a new Byte object initialized to that value. Throws an exception if the String cannot be parsed as a byte. The radix is assumed to be 10.

Exceptions
NumberFormatException If the String does not contain a parsable byte.


 Class Character

Class java.lang.Character

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Character

public final class Character
extends Object
implements Serializable

The Character class wraps a value of the primitive type char in an object. An object of type Character contains a single field whose type is char.

In addition, this class provides several methods for determining the type of a character and converting characters from uppercase to lowercase and vice versa.

Many of the methods of class Character are defined in terms of a "Unicode attribute table" that specifies a name for every defined Unicode code point. The table also includes other attributes, such as a decimal value, an uppercase equivalent, a lowercase equivalent, and/or a titlecase equivalent. The Unicode attribute table is available on the World Wide Web as the file:

    ftp://unicode.org/pub/MappingTables/UnicodeData1.1.5.txt

For a more detailed specification of the Character class, one that encompasses the exact behavior of methods such as isDigit, isLetter, isLowerCase, and isUpperCase over the full range of Unicode values, see Gosling, Joy, and Steele, The Java Language Specification.


 Character Members

Character Members

Class Overview | This Package | All Packages

Fields
Name | Description
COMBINING_SPACING_MARK |
CONNECTOR_PUNCTUATION |
CONTROL |
CURRENCY_SYMBOL |
DASH_PUNCTUATION |
DECIMAL_DIGIT_NUMBER |
ENCLOSING_MARK |
END_PUNCTUATION |
FORMAT |
LETTER_NUMBER |
LINE_SEPARATOR |
LOWERCASE_LETTER |
MATH_SYMBOL |
MAX_RADIX | The maximum radix available for conversion to and from Strings.
MAX_VALUE | The constant value of this field is the largest value of type char.
MIN_RADIX | The minimum radix available for conversion to and from Strings.
MIN_VALUE | The constant value of this field is the smallest value of type char.
MODIFIER_LETTER |
MODIFIER_SYMBOL |
NON_SPACING_MARK |
OTHER_LETTER |
OTHER_NUMBER |
OTHER_PUNCTUATION |
OTHER_SYMBOL |
PARAGRAPH_SEPARATOR |
PRIVATE_USE |
SPACE_SEPARATOR |
START_PUNCTUATION |
SURROGATE |
TITLECASE_LETTER |
TYPE | The Class object representing the primitive type char.
UNASSIGNED |
UPPERCASE_LETTER |

Constructors
Name | Description
Character(char) | Constructs a Character object and initializes it so that it represents the primitive value argument.

Methods
Name | Description
charValue() | Returns the value of this Character object.
digit(char, int) | Returns the numeric value of the character ch in the specified radix.
equals(Object) | Compares this object against the specified object.
forDigit(int, int) | Determines the character representation for a specific digit in the specified radix.
getNumericValue(char) | Returns the Unicode numeric value of the character as a nonnegative integer.
getType(char) | Returns a value indicating a character category.
hashCode() | Returns a hash code for this Character.
isDefined(char) | Determines if a character has a defined meaning in Unicode.
isDigit(char) | Determines if the specified character is a digit.
isIdentifierIgnorable(char) | Determines if the specified character should be regarded as an ignorable character in a Java identifier or a Unicode identifier.
isISOControl(char) | Determines if the specified character is an ISO control character.
isJavaIdentifierPart(char) | Determines if the specified character may be part of a Java identifier as other than the first character.
isJavaIdentifierStart(char) | Determines if the specified character is permissible as the first character in a Java identifier.
isJavaLetter(char) | Determines if the specified character is a "Java" letter, that is, the character is permissible as the first character in an identifier in the Java language. Deprecated.
isJavaLetterOrDigit(char) | Determines if the specified character is a "Java" letter or digit, that is, the character is permissible as a non-initial character in an identifier in the Java language. Deprecated.
isLetter(char) | Determines if the specified character is a letter.
isLetterOrDigit(char) | Determines if the specified character is a letter or digit.
isLowerCase(char) | Determines if the specified character is a lowercase character.
isSpace(char) | Determines if the specified character is ISO-LATIN-1 white space. Deprecated.
isSpaceChar(char) | Determines if the specified character is a Unicode space character.
isTitleCase(char) | Determines if the specified character is a titlecase character.
isUnicodeIdentifierPart(char) | Determines if the specified character may be part of a Unicode identifier as other than the first character.
isUnicodeIdentifierStart(char) | Determines if the specified character is permissible as the first character in a Unicode identifier.
isUpperCase(char) | Determines if the specified character is an uppercase character.
isWhitespace(char) | Determines if the specified character is white space according to Java.
toLowerCase(char) | The given character is mapped to its lowercase equivalent; if the character has no lowercase equivalent, the character itself is returned.
toString() | Returns a String object representing this character's value.
toTitleCase(char) | Converts the character argument to titlecase.
toUpperCase(char) | Converts the character argument to uppercase.


 Character.COMBINING_SPACING_MARK

Character.COMBINING_SPACING_MARK

Syntax
public static final byte COMBINING_SPACING_MARK


 Character.CONNECTOR_PUNCTUATION

Character.CONNECTOR_PUNCTUATION

Syntax
public static final byte CONNECTOR_PUNCTUATION


 Character.CONTROL

Character.CONTROL

Syntax
public static final byte CONTROL


 Character.CURRENCY_SYMBOL

Character.CURRENCY_SYMBOL

Syntax
public static final byte CURRENCY_SYMBOL


 Character.DASH_PUNCTUATION

Character.DASH_PUNCTUATION

Syntax
public static final byte DASH_PUNCTUATION


 Character.DECIMAL_DIGIT_NUMBER

Character.DECIMAL_DIGIT_NUMBER

Syntax
public static final byte DECIMAL_DIGIT_NUMBER


 Character.ENCLOSING_MARK

Character.ENCLOSING_MARK

Syntax
public static final byte ENCLOSING_MARK


 Character.END_PUNCTUATION

Character.END_PUNCTUATION

Syntax
public static final byte END_PUNCTUATION


 Character.FORMAT

Character.FORMAT

Syntax
public static final byte FORMAT


 Character.LETTER_NUMBER

Character.LETTER_NUMBER

Syntax
public static final byte LETTER_NUMBER


 Character.LINE_SEPARATOR

Character.LINE_SEPARATOR

Syntax
public static final byte LINE_SEPARATOR


 Character.LOWERCASE_LETTER

Character.LOWERCASE_LETTER

Syntax
public static final byte LOWERCASE_LETTER


 Character.MATH_SYMBOL

Character.MATH_SYMBOL

Syntax
public static final byte MATH_SYMBOL


 Character.MAX_RADIX

Character.MAX_RADIX

Syntax
public static final int MAX_RADIX
Description
The maximum radix available for conversion to and from Strings. The constant value of this field is the largest value permitted for the radix argument in radix-conversion methods such as the digit method, the forDigit method, and the toString method of class Integer.

See Also
digit, forDigit, toString, valueOf


 Character.MAX_VALUE

Character.MAX_VALUE

Syntax
public static final char MAX_VALUE
Description
The constant value of this field is the largest value of type char.


 Character.MIN_RADIX

Character.MIN_RADIX

Syntax
public static final int MIN_RADIX
Description
The minimum radix available for conversion to and from Strings. The constant value of this field is the smallest value permitted for the radix argument in radix-conversion methods such as the digit method, the forDigit method, and the toString method of class Integer.

See Also
digit, forDigit, toString, valueOf


 Character.MIN_VALUE

Character.MIN_VALUE

Syntax
public static final char MIN_VALUE
Description
The constant value of this field is the smallest value of type char.


 Character.MODIFIER_LETTER

Character.MODIFIER_LETTER

Syntax
public static final byte MODIFIER_LETTER


 Character.MODIFIER_SYMBOL

Character.MODIFIER_SYMBOL

Syntax
public static final byte MODIFIER_SYMBOL


 Character.NON_SPACING_MARK

Character.NON_SPACING_MARK

Syntax
public static final byte NON_SPACING_MARK


 Character.OTHER_LETTER

Character.OTHER_LETTER

Syntax
public static final byte OTHER_LETTER


 Character.OTHER_NUMBER

Character.OTHER_NUMBER

Syntax
public static final byte OTHER_NUMBER


 Character.OTHER_PUNCTUATION

Character.OTHER_PUNCTUATION

Syntax
public static final byte OTHER_PUNCTUATION


 Character.OTHER_SYMBOL

Character.OTHER_SYMBOL

Syntax
public static final byte OTHER_SYMBOL


 Character.PARAGRAPH_SEPARATOR

Character.PARAGRAPH_SEPARATOR

Syntax
public static final byte PARAGRAPH_SEPARATOR


 Character.PRIVATE_USE

Character.PRIVATE_USE

Syntax
public static final byte PRIVATE_USE


 Character.SPACE_SEPARATOR

Character.SPACE_SEPARATOR

Syntax
public static final byte SPACE_SEPARATOR


 Character.START_PUNCTUATION

Character.START_PUNCTUATION

Syntax
public static final byte START_PUNCTUATION


 Character.SURROGATE

Character.SURROGATE

Syntax
public static final byte SURROGATE


 Character.TITLECASE_LETTER

Character.TITLECASE_LETTER

Syntax
public static final byte TITLECASE_LETTER


 Character.TYPE

Character.TYPE

Syntax
public static final Class TYPE
Description
The Class object representing the primitive type char.


 Character.UNASSIGNED

Character.UNASSIGNED

Syntax
public static final byte UNASSIGNED


 Character.UPPERCASE_LETTER

Character.UPPERCASE_LETTER

Syntax
public static final byte UPPERCASE_LETTER


 Character.Character

Character.Character

Syntax
public Character( char value )
Parameters
value
value for the new Character object.
Description
Constructs a Character object and initializes it so that it represents the primitive value argument.


 Character.charValue

Character.charValue

Syntax
public char charValue()
Returns
the primitive char value represented by this object.
Description
Returns the value of this Character object.


 Character.digit

Character.digit

Syntax
public static int digit( char ch, int radix )
Parameters
ch
the character to be converted.
radix
the radix.
Returns
the numeric value represented by the character in the specified radix.
Description
Returns the numeric value of the character ch in the specified radix.

If the radix is not in the range MIN_RADIX <= radix <= MAX_RADIX or if the value of ch is not a valid digit in the specified radix, -1 is returned. A character is a valid digit if at least one of the following is true:

  • The method isDigit is true of the character and the Unicode decimal digit value of the character (or its single-character decomposition) is less than the specified radix. In this case the decimal digit value is returned.
  • The character is one of the uppercase Latin letters 'A' through 'Z' and its code is less than radix + 'A' - 10. In this case, ch - 'A' + 10 is returned.
  • The character is one of the lowercase Latin letters 'a' through 'z' and its code is less than radix + 'a' - 10. In this case, ch - 'a' + 10 is returned.

See Also
forDigit, isDigit


 Character.equals

Character.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the object to compare with.
Returns
true if the objects are the same; false otherwise.
Description
Compares this object against the specified object. The result is true if and only if the argument is not null and is a Character object that represents the same char value as this object.

Overrides
equals in class Object


 Character.forDigit

Character.forDigit

Syntax
public static char forDigit( int digit, int radix )
Parameters
digit
the number to convert to a character.
radix
the radix.
Returns
the char representation of the specified digit in the specified radix.
Description
Determines the character representation for a specific digit in the specified radix. If the value of radix is not a valid radix, or the value of digit is not a valid digit in the specified radix, the null character ('\u0000') is returned.

The radix argument is valid if it is greater than or equal to MIN_RADIX and less than or equal to MAX_RADIX. The digit argument is valid if 0 <= digit <= radix.

If the digit is less than 10, then '0' + digit is returned. Otherwise, the value 'a' + digit - 10 is returned.

See Also
MIN_RADIX, MAX_RADIX, digit


 Character.getNumericValue

Character.getNumericValue

Syntax
public static int getNumericValue( char ch )
Parameters
ch
the character to be converted.
radix
the radix.
Returns
the numeric value of the character, as a nonnegative int value; -2 if the character has a numeric value that is not a nonnegative integer; -1 if the character has no numeric value.
Description
Returns the Unicode numeric value of the character as a nonnegative integer. If the character does not have a numeric value, then -1 is returned. If the character has a numeric value that cannot be represented as a nonnegative integer (for example, a fractional value), then -2 is returned.

See Also
forDigit, isDigit


 Character.getType

Character.getType

Syntax
public static int getType( char ch )
Parameters
ch
the character to be tested.
Returns
a value of type int, the character category.
Description
Returns a value indicating a character category.

See Also
COMBINING_SPACING_MARK, CONNECTOR_PUNCTUATION, CONTROL, CURRENCY_SYMBOL, DASH_PUNCTUATION, DECIMAL_DIGIT_NUMBER, ENCLOSING_MARK, END_PUNCTUATION, FORMAT, LETTER_NUMBER, LINE_SEPARATOR, LOWERCASE_LETTER, MATH_SYMBOL, MODIFIER_LETTER, MODIFIER_SYMBOL, NON_SPACING_MARK, OTHER_LETTER, OTHER_NUMBER, OTHER_PUNCTUATION, OTHER_SYMBOL, PARAGRAPH_SEPARATOR, PRIVATE_USE, SPACE_SEPARATOR, START_PUNCTUATION, SURROGATE, TITLECASE_LETTER, UNASSIGNED, UPPERCASE_LETTER


 Character.hashCode

Character.hashCode

Syntax
public int hashCode()
Returns
a hash code value for this object.
Description
Returns a hash code for this Character.

Overrides
hashCode in class Object


 Character.isDefined

Character.isDefined

Syntax
public static boolean isDefined( char ch )
Parameters
ch
the character to be tested
Returns
true if the character has a defined meaning in Unicode; false otherwise.
Description
Determines if a character has a defined meaning in Unicode. A character is defined if at least one of the following is true:
  • It has an entry in the Unicode attribute table.
  • Its value is in the range '\u3040' <= ch <= '\u9FA5'.
  • Its value is in the range '\uF900' <= ch <= '\uFA2D'.

See Also
isDigit, isLetter, isLetterOrDigit, isLowerCase, isTitleCase, isUpperCase


 Character.isDigit

Character.isDigit

Syntax
public static boolean isDigit( char ch )
Parameters
ch
the character to be tested.
Returns
true if the character is a digit; false otherwise.
Description
Determines if the specified character is a digit. A character is considered to be a digit if it is not in the range '\u2000' <= ch <= '\u2FFF' and its Unicode name contains the word "DIGIT". For a more complete specification that encompasses all Unicode characters that are defined as digits, see Gosling, Joy, and Steele, The Java Language Specification.

These are the ranges of Unicode characters that are considered digits:
0x0030 through 0x0039 | ISO-LATIN-1 digits ('0' through '9')
0x0660 through 0x0669 | Arabic-Indic digits
0x06F0 through 0x06F9 | Extended Arabic-Indic digits
0x0966 through 0x096F | Devanagari digits
0x09E6 through 0x09EF | Bengali digits
0x0A66 through 0x0A6F | Gurmukhi digits
0x0AE6 through 0x0AEF | Gujarati digits
0x0B66 through 0x0B6F | Oriya digits
0x0BE7 through 0x0BEF | Tamil digits
0x0C66 through 0x0C6F | Telugu digits
0x0CE6 through 0x0CEF | Kannada digits
0x0D66 through 0x0D6F | Malayalam digits
0x0E50 through 0x0E59 | Thai digits
0x0ED0 through 0x0ED9 | Lao digits
0x0F20 through 0x0F29 | Tibetan digits
0xFF10 through 0xFF19 | Fullwidth digits

See Also
digit, forDigit


 Character.isIdentifierIgnorable

Character.isIdentifierIgnorable

Syntax
public static boolean isIdentifierIgnorable( char ch )
Parameters
ch
the character to be tested.
Returns
true if the character may be part of a Unicode identifier; false otherwise.
Description
Determines if the specified character should be regarded as an ignorable character in a Java identifier or a Unicode identifier. The following Unicode characters are ignorable in a Java identifier or a Unicode identifier:

0x0000 through 0x0008, | ISO control characters that
0x000E through 0x001B, | are not whitespace
and 0x007F through 0x009F
0x200C through 0x200F | join controls
0x200A through 0x200E | bidirectional controls
0x206A through 0x206F | format controls
0xFEFF | zero-width no-break space

See Also
isJavaIdentifierPart, isUnicodeIdentifierPart


 Character.isISOControl

Character.isISOControl

Syntax
public static boolean isISOControl( char ch )
Parameters
ch
the character to be tested.
Returns
true if the character is an ISO control character; false otherwise.
Description
Determines if the specified character is an ISO control character. A character is considered to be an ISO control character if its code is in the range \u0000 through \u001F or in the range \u007F through \u009F.

See Also
isSpaceChar, isWhitespace


 Character.isJavaIdentifierPart

Character.isJavaIdentifierPart

Syntax
public static boolean isJavaIdentifierPart( char ch )
Parameters
ch
the character to be tested.
Returns
true if the character may be part of a Unicode identifier; false otherwise.
Description
Determines if the specified character may be part of a Java identifier as other than the first character. A character may be part of a Java identifier if and only if it is one of the following:
  • a letter
  • a currency symbol (such as "$")
  • a connecting punctuation character (such as "_").
  • a digit
  • a numeric letter (such as a Roman numeral character)
  • a combining mark
  • a non-spacing mark
  • an ignorable control character

See Also
isIdentifierIgnorable, isJavaIdentifierStart, isLetterOrDigit, isUnicodeIdentifierPart


 Character.isJavaIdentifierStart

Character.isJavaIdentifierStart

Syntax
public static boolean isJavaIdentifierStart( char ch )
Parameters
ch
the character to be tested.
Returns
true if the character may start a Java identifier; false otherwise.
Description
Determines if the specified character is permissible as the first character in a Java identifier. A character may start a Java identifier if and only if it is one of the following:
  • a letter
  • a currency symbol (such as "$")
  • a connecting punctuation character (such as "_").

See Also
isJavaIdentifierPart, isLetter, isUnicodeIdentifierStart


 Character.isJavaLetter

Character.isJavaLetter

Syntax
public static boolean isJavaLetter( char ch )
Parameters
ch
the character to be tested.
Returns
true if the character is a Java letter; false otherwise.
Description
Note: isJavaLetter() is deprecated. Replaced by isJavaIdentifierStart(char).

Determines if the specified character is a "Java" letter, that is, the character is permissible as the first character in an identifier in the Java language.

A character is considered to be a Java letter if and only if it is a letter, the ASCII dollar sign character '$', or the underscore character '_'.

See Also
isJavaIdentifierStart, isJavaLetterOrDigit, isLetter, isLetterOrDigit, isUnicodeIdentifierStart


 Character.isJavaLetterOrDigit

Character.isJavaLetterOrDigit

Syntax
public static boolean isJavaLetterOrDigit( char ch )
Parameters
ch
the character to be tested.
Returns
true if the character is a Java letter or digit; false otherwise.
Description
Note: isJavaLetterOrDigit() is deprecated. Replaced by isJavaIdentifierPart(char).

Determines if the specified character is a "Java" letter or digit, that is, the character is permissible as a non-initial character in an identifier in the Java language.

A character is considered to be a Java letter or digit if and only if it is a letter, a digit, the ASCII dollar sign character '$', or the underscore character '_'.

See Also
isJavaIdentifierPart, isJavaLetter, isLetter, isLetterOrDigit, isUnicodeIdentifierPart


 Character.isLetter

Character.isLetter

Syntax
public static boolean isLetter( char ch )
Parameters
ch
the character to be tested.
Returns
true if the character is a letter; false otherwise.
Description
Determines if the specified character is a letter. For a more complete specification that encompasses all Unicode characters, see Gosling, Joy, and Steele, The Java Language Specification.

A character is considered to be a letter if and only if it is specified to be a letter by the Unicode 2.0 standard (category "Lu", "Ll", "Lt", "Lm", or "Lo" in the Unicode specification data file).

Note that most ideographic characters are considered to be letters (category "Lo") for this purpose.

Note also that not all letters have case: many Unicode characters are letters but are neither uppercase nor lowercase nor titlecase.

See Also
isDigit, isJavaIdentifierStart, isJavaLetter, isJavaLetterOrDigit, isLetterOrDigit, isLowerCase, isTitleCase, isUnicodeIdentifierStart, isUpperCase


 Character.isLetterOrDigit

Character.isLetterOrDigit

Syntax
public static boolean isLetterOrDigit( char ch )
Parameters
ch
the character to be tested.
Returns
true if the character is a letter or digit; false otherwise.
Description
Determines if the specified character is a letter or digit. For a more complete specification that encompasses all Unicode characters, see Gosling, Joy, and Steele, The Java Language Specification.

A character is considered to be a letter if and only if it is specified to be a letter or a digit by the Unicode 2.0 standard (category "Lu", "Ll", "Lt", "Lm", "Lo", or "Nd" in the Unicode specification data file). In other words, isLetterOrDigit is true of a character if and only if either isLetter is true of the character or isDigit is true of the character.

See Also
isDigit, isJavaIdentifierPart, isJavaLetter, isJavaLetterOrDigit, isLetter, isUnicodeIdentifierPart


 Character.isLowerCase

Character.isLowerCase

Syntax
public static boolean isLowerCase( char ch )
Parameters
ch
the character to be tested.
Returns
true if the character is lowercase; false otherwise.
Description
Determines if the specified character is a lowercase character. A character is lowercase if it is not in the range '\u2000' through '\u2FFF', the Unicode attribute table does not specify a mapping to lowercase for the character, and at least one of the following is true:
  • The attribute table specifies a mapping to uppercase for the character.
  • The name for the character contains the words "SMALL LETTER".
  • The name for the character contains the words "SMALL LIGATURE".

A character is considered to be lowercase if and only if it is specified to be lowercase by the Unicode 2.0 standard (category "Ll" in the Unicode specification data file).

Of the ISO-LATIN-1 characters (character codes 0x0000 through 0x00FF), the following are lowercase:

 a b c d e f g h i j k l m n o p q r s t u v w x y z
 \u00DF \u00E0 \u00E1 \u00E2 \u00E3 \u00E4 \u00E5 \u00E6 \u00E7
 \u00E8 \u00E9 \u00EA \u00EB \u00EC \u00ED \u00EE \u00EF \u00F0
 \u00F1 \u00F2 \u00F3 \u00F4 \u00F5 \u00F6 \u00F8 \u00F9 \u00FA
 \u00FB \u00FC \u00FD \u00FE \u00FF

Many other Unicode characters are lowercase, too.

See Also
isLowerCase, isTitleCase, toLowerCase


 Character.isSpace

Character.isSpace

Syntax
public static boolean isSpace( char ch )
Parameters
ch
the character to be tested.
Returns
true if the character is ISO-LATIN-1 white space; false otherwise.
Description
Note: isSpace() is deprecated. Replaced by isWhitespace(char).

Determines if the specified character is ISO-LATIN-1 white space. This method returns true for the following five characters only:

'\t' | \u0009 | HORIZONTAL TABULATION
'\n' | \u000A | NEW LINE
'\f' | \u000C | FORM FEED
'\r' | \u000D | CARRIAGE RETURN
' ' | \u0020 | SPACE

See Also
isSpaceChar, isWhitespace


 Character.isSpaceChar

Character.isSpaceChar

Syntax
public static boolean isSpaceChar( char ch )
Parameters
ch
the character to be tested.
Returns
true if the character is a space character; false otherwise.
Description
Determines if the specified character is a Unicode space character. A character is considered to be a space character if and only if it is specified to be a space character by the Unicode 2.0 standard (category "Zs", "Zl, or "Zp" in the Unicode specification data file).

See Also
isWhitespace


 Character.isTitleCase

Character.isTitleCase

Syntax
public static boolean isTitleCase( char ch )
Parameters
ch
the character to be tested.
Returns
true if the character is titlecase; false otherwise.
Description
Determines if the specified character is a titlecase character. A character is considered to be titlecase if and only if it is specified to be titlecase by the Unicode 2.0 standard (category "Lt" in the Unicode specification data file).

The printed representations of four Unicode characters look like pairs of Latin letters. For example, there is an uppercase letter that looks like "LJ" and has a corresponding lowercase letter that looks like "lj". A third form, which looks like "Lj", is the appropriate form to use when rendering a word in lowercase with initial capitals, as for a book title.

These are the Unicode characters for which this method returns true:

  • LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON
  • LATIN CAPITAL LETTER L WITH SMALL LETTER J
  • LATIN CAPITAL LETTER N WITH SMALL LETTER J
  • LATIN CAPITAL LETTER D WITH SMALL LETTER Z

See Also
isLowerCase, isUpperCase, toTitleCase


 Character.isUnicodeIdentifierPart

Character.isUnicodeIdentifierPart

Syntax
public static boolean isUnicodeIdentifierPart( char ch )
Parameters
ch
the character to be tested.
Returns
true if the character may be part of a Unicode identifier; false otherwise.
Description
Determines if the specified character may be part of a Unicode identifier as other than the first character. A character may be part of a Unicode identifier if and only if it is one of the following:
  • a letter
  • a connecting punctuation character (such as "_").
  • a digit
  • a numeric letter (such as a Roman numeral character)
  • a combining mark
  • a non-spacing mark
  • an ignorable control character

See Also
isIdentifierIgnorable, isJavaIdentifierPart, isLetterOrDigit, isUnicodeIdentifierStart


 Character.isUnicodeIdentifierStart

Character.isUnicodeIdentifierStart

Syntax
public static boolean isUnicodeIdentifierStart( char ch )
Parameters
ch
the character to be tested.
Returns
true if the character may start a Unicode identifier; false otherwise.
Description
Determines if the specified character is permissible as the first character in a Unicode identifier. A character may start a Unicode identifier if and only if it is a letter.

See Also
isJavaIdentifierStart, isLetter, isUnicodeIdentifierPart


 Character.isUpperCase

Character.isUpperCase

Syntax
public static boolean isUpperCase( char ch )
Parameters
ch
the character to be tested.
Returns
true if the character is uppercase; false otherwise.
Description
Determines if the specified character is an uppercase character. A character is uppercase if it is not in the range '\u2000' through '\u2FFF', the Unicode attribute table does not specify a mapping to uppercase for the character, and at least one of the following is true:
  • The attribute table specifies a mapping to lowercase for the character.
  • The name for the character contains the words "CAPITAL LETTER".
  • The name for the character contains the words "CAPITAL LIGATURE".

Of the ISO-LATIN-1 characters (character codes 0x0000 through 0x00FF), the following are uppercase:

 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
 \u00C0 \u00C1 \u00C2 \u00C3 \u00C4 \u00C5 \u00C6 \u00C7
 \u00C8 \u00C9 \u00CA \u00CB \u00CC \u00CD \u00CE \u00CF \u00D0
 \u00D1 \u00D2 \u00D3 \u00D4 \u00D5 \u00D6 \u00D8 \u00D9 \u00DA
 \u00DB \u00DC \u00DD \u00DE

Many other Unicode characters are uppercase, too.

See Also
isLowerCase, isTitleCase, toUpperCase


 Character.isWhitespace

Character.isWhitespace

Syntax
public static boolean isWhitespace( char ch )
Parameters
ch
the character to be tested.
Returns
true if the character is a Java whitespace character; false otherwise.
Description
Determines if the specified character is white space according to Java. A character is considered to be a Java whitespace character if and only if it satisfies one of the following criteria:
  • It is a Unicode space separator (category "Zs"), but is not a no-break space (\u00A0 or \uFEFF).
  • It is a Unicode line separator (category "Zl").
  • It is a Unicode paragraph separator (category "Zp").
  • It is \u0009, HORIZONTAL TABULATION.
  • It is \u000A, LINE FEED.
  • It is \u000B, VERTICAL TABULATION.
  • It is \u000C, FORM FEED.
  • It is \u000D, CARRIAGE RETURN.
  • It is \u001C, FILE SEPARATOR.
  • It is \u001D, GROUP SEPARATOR.
  • It is \u001E, RECORD SEPARATOR.
  • It is \u001F, UNIT SEPARATOR.

See Also
isSpaceChar


 Character.toLowerCase

Character.toLowerCase

Syntax
public static char toLowerCase( char ch )
Parameters
ch
the character to be converted.
Returns
the lowercase equivalent of the character, if any; otherwise the character itself.
Description
The given character is mapped to its lowercase equivalent; if the character has no lowercase equivalent, the character itself is returned.

A character has a lowercase equivalent if and only if a lowercase mapping is specified for the character in the Unicode attribute table.

Note that some Unicode characters in the range '\u2000' to '\u2FFF' have lowercase mappings; this method does map such characters to their lowercase equivalents even though the method isUpperCase does not return true for such characters.

See Also
isLowerCase, isUpperCase, toTitleCase, toUpperCase


 Character.toString

Character.toString

Syntax
public String toString()
Returns
a string representation of this object.
Description
Returns a String object representing this character's value. Converts this Character object to a string. The result is a string whose length is 1. The string's sole component is the primitive char value represented by this object.

Overrides
toString in class Object


 Character.toTitleCase

Character.toTitleCase

Syntax
public static char toTitleCase( char ch )
Parameters
ch
the character to be converted.
Returns
the titlecase equivalent of the character, if any; otherwise the character itself.
Description
Converts the character argument to titlecase. A character has a titlecase equivalent if and only if a titlecase mapping is specified for the character in the Unicode attribute table.

Note that some Unicode characters in the range '\u2000' through '\u2FFF' have titlecase mappings; this method does map such characters to their titlecase equivalents even though the method isTitleCase does not return true for such characters.

There are only four Unicode characters that are truly titlecase forms that are distinct from uppercase forms. As a rule, if a character has no true titlecase equivalent but does have an uppercase mapping, then the Unicode 2.0 attribute table specifies a titlecase mapping that is the same as the uppercase mapping.

See Also
isTitleCase, toLowerCase, toUpperCase


 Character.toUpperCase

Character.toUpperCase

Syntax
public static char toUpperCase( char ch )
Parameters
ch
the character to be converted.
Returns
the uppercase equivalent of the character, if any; otherwise the character itself.
Description
Converts the character argument to uppercase. A character has an uppercase equivalent if and only if an uppercase mapping is specified for the character in the Unicode attribute table.

Note that some Unicode characters in the range '\u2000' to '\u2000FFF' have uppercase mappings; this method does map such characters to their titlecase equivalents even though the method isLowerCase does not return true for such characters.

See Also
isLowerCase, isUpperCase, toLowerCase, toTitleCase


 Class Class

Class java.lang.Class

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Class

public final class Class
extends Object
implements Serializable

Instances of the class Class represent classes and interfaces in a running Java application. Every array also belongs to a class that is reflected as a Class object that is shared by all arrays with the same element type and number of dimensions. Finally, the either primitive Java types (boolean, byte, char, short, int, long, float, and double) and the keyword void are also represented as Class objects.

There is no public constructor for the class Class. Class objects are constructed automatically by the Java Virtual Machine as classes are loaded and by calls to the defineClass method in the class loader.

The following example uses a Class object to print the Class name of an object:

     void printClassName(Object obj) {
         System.out.println("The class of " + obj +
                            " is " + obj.getClass().getName());
     }

See Also:
defineClass


 Class Members

Class Members

Class Overview | This Package | All Packages

Methods
Name | Description
forName(String) | Returns the Class object associated with the class with the given string name.
getClasses() | Returns an array containing Class objects representing all the public classes and interfaces that are members of the class represented by this Class object.
getClassLoader() | Determines the class loader for the class.
getComponentType() | If this class represents an array type, returns the Class object representing the component type of the array; otherwise returns null.
getConstructor(Class[]) | Returns a Constructor object that reflects the specified public constructor of the class represented by this Class object.
getConstructors() | Returns an array containing Constructor objects reflecting all the public constructors of the class represented by this Class object.
getDeclaredClasses() | Returns an array of Class objects reflecting all the classes and interfaces declared as members of the class represented by this Class object.
getDeclaredConstructor(Class[]) | Returns a Constructor object that reflects the specified declared constructor of the class or interface represented by this Class object.
getDeclaredConstructors() | Returns an array of Constructor objects reflecting all the constructors declared by the class represented by this Class object.
getDeclaredField(String) | Returns a Field object that reflects the specified declared field of the class or interface represented by this Class object.
getDeclaredFields() | Returns an array of Field objects reflecting all the fields declared by the class or interface represented by this Class object.
getDeclaredMethod(String, Class[]) | Returns a Method object that reflects the specified declared method of the class or interface represented by this Class object.
getDeclaredMethods() | Returns an array of Method objects reflecting all the methods declared by the class or interface represented by this Class object.
getDeclaringClass() | If the class or interface represented by this Class object is a member of another class, returns the Class object representing the class of which it is a member (its declaring class).
getField(String) | Returns a Field object that reflects the specified public member field of the class or interface represented by this Class object.
getFields() | Returns an array containing Field objects reflecting all the accessible public fields of the class or interface represented by this Class object.
getInterfaces() | Determines the interfaces implemented by the class or interface represented by this object.
getMethod(String, Class[]) | Returns a Method object that reflects the specified public member method of the class or interface represented by this Class object.
getMethods() | Returns an array containing Method objects reflecting all the public member methods of the class or interface represented by this Class object, including those declared by the class or interface and and those inherited from superclasses and superinterfaces.
getModifiers() | Returns the Java language modifiers for this class or interface, encoded in an integer.
getName() | Returns the fully-qualified name of the type (class, interface, array, or primitive) represented by this Class object, as a String.
getResource(String) |
getResourceAsStream(String) | Find a resource with a given name.
getSigners() | Get the signers of this class.
getSuperclass() | If this object represents any class other than the class Object, then the object that represents the superclass of that class is returned.
isArray() | If this Class object represents an array type, returns true, otherwise returns false.
isAssignableFrom(Class) | Determines if the class or interface represented by this Class object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified Class parameter.
isInstance(Object) | This method is the dynamic equivalent of the Java language instanceof operator.
isInterface() | Determines if the specified Class object represents an interface type.
isPrimitive() | Determines if the specified Class object represents a primitive Java type.
newInstance() | Creates a new instance of a class.
toString() | Converts the object to a string.


 Class.forName

Class.forName

Syntax
public static native Class forName( String className ) throws ClassNotFoundException
Parameters
className
the fully qualified name of the desired class.
Returns
the Class descriptor for the class with the specified name.
Description
Returns the Class object associated with the class with the given string name. Given the fully-qualified name for a class or interface, this method attempts to locate, load and link the class. If it succeeds, returns the Class object representing the class. If it fails, the method throws a ClassNotFoundException.

For example, the following code fragment returns the runtime Class descriptor for the class named java.lang.Thread:

    Class t = Class.forName("java.lang.Thread")

Exceptions
ClassNotFoundException if the class could not be found.


 Class.getClasses

Class.getClasses

Syntax
public Class[] getClasses()
Description
Returns an array containing Class objects representing all the public classes and interfaces that are members of the class represented by this Class object. This includes public class and interface members inherited from superclasses and public class and interface members declared by the class. Returns an array of length 0 if the class has no public member classes or interfaces, or if this Class object represents a primitive type.


 Class.getClassLoader

Class.getClassLoader

Syntax
public native ClassLoader getClassLoader()
Returns
the class loader that created the class or interface represented by this object, or null if the class was not created by a class loader.
Description
Determines the class loader for the class.

See Also
ClassLoader


 Class.getComponentType

Class.getComponentType

Syntax
public native Class getComponentType()
Description
If this class represents an array type, returns the Class object representing the component type of the array; otherwise returns null.

See Also
Array


 Class.getConstructor

Class.getConstructor

Syntax
public Constructor getConstructor( Class parameterTypes[] ) throws NoSuchMethodException, SecurityException
Description
Returns a Constructor object that reflects the specified public constructor of the class represented by this Class object. The parameterTypes parameter is an array of Class objects that identify the constructor's formal parameter types, in declared order.

The constructor to reflect is located by searching all the constructors of the class represented by this Class object for a public constructor with the exactly the same formal parameter types.

Exceptions
NoSuchMethodException if a matching method is not found.
Exceptions
SecurityException if access to the information is denied.
See Also
Constructor


 Class.getConstructors

Class.getConstructors

Syntax
public Constructor[] getConstructors() throws SecurityException
Description
Returns an array containing Constructor objects reflecting all the public constructors of the class represented by this Class object. An array of length 0 is returned if the class has no public constructors.

Exceptions
SecurityException if access to the information is denied.
See Also
Constructor


 Class.getDeclaredClasses

Class.getDeclaredClasses

Syntax
public Class[] getDeclaredClasses() throws SecurityException
Description
Returns an array of Class objects reflecting all the classes and interfaces declared as members of the class represented by this Class object. This includes public, protected, default (package) access, and private classes and interfaces declared by the class, but excludes inherited classes and interfaces. Returns an array of length 0 if the class declares no classes or interfaces as members, or if this Class object represents a primitive type.

Exceptions
SecurityException if access to the information is denied.


 Class.getDeclaredConstructor

Class.getDeclaredConstructor

Syntax
public Constructor getDeclaredConstructor( Class parameterTypes[] ) throws NoSuchMethodException, SecurityException
Description
Returns a Constructor object that reflects the specified declared constructor of the class or interface represented by this Class object. The parameterTypes parameter is an array of Class objects that identify the constructor's formal parameter types, in declared order.

Exceptions
NoSuchMethodException if a matching method is not found.
Exceptions
SecurityException if access to the information is denied.
See Also
Constructor


 Class.getDeclaredConstructors

Class.getDeclaredConstructors

Syntax
public Constructor[] getDeclaredConstructors() throws SecurityException
Description
Returns an array of Constructor objects reflecting all the constructors declared by the class represented by this Class object. These are public, protected, default (package) access, and private constructors. Returns an array of length 0 if this Class object represents an interface or a primitive type.

See The Java Language Specification, section 8.2.

Exceptions
SecurityException if access to the information is denied.
See Also
Constructor


 Class.getDeclaredField

Class.getDeclaredField

Syntax
public Field getDeclaredField( String name ) throws NoSuchFieldException, SecurityException
Description
Returns a Field object that reflects the specified declared field of the class or interface represented by this Class object. The name parameter is a String that specifies the simple name of the desired field.

Exceptions
NoSuchFieldException if a field with the specified name is not found.
Exceptions
SecurityException if access to the information is denied.
See Also
Field


 Class.getDeclaredFields

Class.getDeclaredFields

Syntax
public Field[] getDeclaredFields() throws SecurityException
Description
Returns an array of Field objects reflecting all the fields declared by the class or interface represented by this Class object. This includes public, protected, default (package) access, and private fields, but excludes inherited fields. Returns an array of length 0 if the class or interface declares no fields, or if this Class object represents a primitive type. See The Java Language Specification, sections 8.2 and 8.3.

Exceptions
SecurityException if access to the information is denied.
See Also
Field


 Class.getDeclaredMethod

Class.getDeclaredMethod

Syntax
public Method getDeclaredMethod( String name, Class parameterTypes[] ) throws NoSuchMethodException, SecurityException
Description
Returns a Method object that reflects the specified declared method of the class or interface represented by this Class object. The name parameter is a String that specifies the simple name of the desired method, and the parameterTypes parameter is an array of Class objects that identify the method's formal parameter types, in declared order.

Exceptions
NoSuchMethodException if a matching method is not found.
Exceptions
SecurityException if access to the information is denied.
See Also
Method


 Class.getDeclaredMethods

Class.getDeclaredMethods

Syntax
public Method[] getDeclaredMethods() throws SecurityException
Description
Returns an array of Method objects reflecting all the methods declared by the class or interface represented by this Class object. This includes public, protected, default (package) access, and private methods, but excludes inherited methods. Returns an array of length 0 if the class or interface declares no methods, or if this Class object represents a primitive type.

See The Java Language Specification, section 8.2.

Exceptions
SecurityException if access to the information is denied.
See Also
Method


 Class.getDeclaringClass

Class.getDeclaringClass

Syntax
public Class getDeclaringClass()
Description
If the class or interface represented by this Class object is a member of another class, returns the Class object representing the class of which it is a member (its declaring class). Returns null if this class or interface is not a member of any other class.


 Class.getField

Class.getField

Syntax
public Field getField( String name ) throws NoSuchFieldException, SecurityException
Description
Returns a Field object that reflects the specified public member field of the class or interface represented by this Class object. The name parameter is a String specifying the simple name of the desired field.

The field to be reflected is located by searching all the member fields of the class or interface represented by this Class object for a public field with the specified name.

See The Java Language Specification, sections 8.2 and 8.3.

Exceptions
NoSuchFieldException if a field with the specified name is not found.
Exceptions
SecurityException if access to the information is denied.
See Also
Field


 Class.getFields

Class.getFields

Syntax
public Field[] getFields() throws SecurityException
Description
Returns an array containing Field objects reflecting all the accessible public fields of the class or interface represented by this Class object. Returns an array of length 0 if the class or interface has no accessible public fields, or if it represents an array type or a primitive type.

Specifically, if this Class object represents a class, returns the public fields of this class and of all its superclasses. If this Class object represents an interface, returns the fields of this interface and of all its superinterfaces. If this Class object represents an array type or a primitive type, returns an array of length 0.

The implicit length field for array types is not reflected by this method. User code should use the methods of class Array to manipulate arrays.

See The Java Language Specification, sections 8.2 and 8.3.

Exceptions
SecurityException if access to the information is denied.
See Also
Field


 Class.getInterfaces

Class.getInterfaces

Syntax
public native Class[] getInterfaces()
Returns
an array of interfaces implemented by this class.
Description
Determines the interfaces implemented by the class or interface represented by this object.

If this object represents a class, the return value is an array containing objects representing all interfaces implemented by the class. The order of the interface objects in the array corresponds to the order of the interface names in the implements clause of the declaration of the class represented by this object.

If this object represents an interface, the array contains objects representing all interfaces extended by the interface. The order of the interface objects in the array corresponds to the order of the interface names in the extends clause of the declaration of the interface represented by this object.

If the class or interface implements no interfaces, the method returns an array of length 0.


 Class.getMethod

Class.getMethod

Syntax
public Method getMethod( String name, Class parameterTypes[] ) throws NoSuchMethodException, SecurityException
Description
Returns a Method object that reflects the specified public member method of the class or interface represented by this Class object. The name parameter is a String specifying the simple name the desired method, and the parameterTypes parameter is an array of Class objects that identify the method's formal parameter types, in declared order.

The method to reflect is located by searching all the member methods of the class or interface represented by this Class object for a public method with the specified name and exactly the same formal parameter types.

See The Java Language Specification, sections 8.2 and 8.4.

Exceptions
NoSuchMethodException if a matching method is not found.
Exceptions
SecurityException if access to the information is denied.
See Also
Method


 Class.getMethods

Class.getMethods

Syntax
public Method[] getMethods() throws SecurityException
Description
Returns an array containing Method objects reflecting all the public member methods of the class or interface represented by this Class object, including those declared by the class or interface and and those inherited from superclasses and superinterfaces. Returns an array of length 0 if the class or interface has no public member methods.

See The Java Language Specification, sections 8.2 and 8.4.

Exceptions
SecurityException if access to the information is denied.
See Also
Method


 Class.getModifiers

Class.getModifiers

Syntax
public native int getModifiers()
Description
Returns the Java language modifiers for this class or interface, encoded in an integer. The modifiers consist of the Java Virtual Machine's constants for public, protected, private, final, and interface; they should be decoded using the methods of class Modifier.

The modifier encodings are defined in The Java Virtual Machine Specification, table 4.1.

See Also
Modifier


 Class.getName

Class.getName

Syntax
public native String getName()
Returns
the fully qualified name of the class or interface represented by this object.
Description
Returns the fully-qualified name of the type (class, interface, array, or primitive) represented by this Class object, as a String.


 Class.getResource

Class.getResource

Syntax
public URL getResource( String name )


 Class.getResourceAsStream

Class.getResourceAsStream

Syntax
public InputStream getResourceAsStream( String name )
Description
Find a resource with a given name. Will return null if no resource with this name is found. The rules for searching a resources associated with a given class are implemented by the ClassLoader of the class.

The Class methods delegate to ClassLoader methods, after applying a naming convention: if the resource name starts with "/", it is used as is. Otherwise, the name of the package is prepended, after converting "." to "/".

See Also
ClassLoader


 Class.getSigners

Class.getSigners

Syntax
public native Object[] getSigners()
Description
Get the signers of this class.


 Class.getSuperclass

Class.getSuperclass

Syntax
public native Class getSuperclass()
Returns
the superclass of the class represented by this object.
Description
If this object represents any class other than the class Object, then the object that represents the superclass of that class is returned.

If this object is the one that represents the class Object or this object represents an interface, null is returned.


 Class.isArray

Class.isArray

Syntax
public native boolean isArray()
Description
If this Class object represents an array type, returns true, otherwise returns false.


 Class.isAssignableFrom

Class.isAssignableFrom

Syntax
public native boolean isAssignableFrom( Class cls )
Description
Determines if the class or interface represented by this Class object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified Class parameter. It returns true if so, false otherwise. If this Class object represents a primitive type, returns true if the specified Class parameter is exactly this Class object, false otherwise.

Specifically, this method tests whether the type represented by the specified Class parameter can be converted to the type represented by this Class object via an identity conversion or via a widening reference conversion. See The Java Language Specification, sections 5.1.1 and 5.1.4 , for details.

Exceptions
NullPointerException if the specified Class parameter is null.


 Class.isInstance

Class.isInstance

Syntax
public native boolean isInstance( Object obj )
Parameters
obj
The object to check
Description
This method is the dynamic equivalent of the Java language instanceof operator. The method returns true if the specified Object argument is non-null and can be cast to the reference type represented by this Class object without raising a ClassCastException. It returns false otherwise.

Specifically, if this Class object represents a declared class, returns true if the specified Object argument is an instance of the represented class (or of any of its subclasses); false otherwise. If this Class object represents an array class, returns true if the specified Object argument can be converted to an object of the array type by an identity conversion or by a widening reference conversion; false otherwise. If this Class object represents an interface, returns true if the class or any superclass of the specified Object argument implements this interface; false otherwise. If this Class object represents a primitive type, returns false.


 Class.isInterface

Class.isInterface

Syntax
public native boolean isInterface()
Returns
true if this object represents an interface; false otherwise.
Description
Determines if the specified Class object represents an interface type.


 Class.isPrimitive

Class.isPrimitive

Syntax
public native boolean isPrimitive()
Description
Determines if the specified Class object represents a primitive Java type.

There are nine predefined Class objects to represent the eight primitive Java types and void. These are created by the Java Virtual Machine, and have the same names as the primitive types that they represent, namely boolean, byte, char, short, int, long, float, and double, and void.

These objects may only be accessed via the following public static final variables, and are the only Class objects for which this method returns true.

See Also
TYPE, TYPE, TYPE, TYPE, TYPE, TYPE, TYPE, TYPE, TYPE


 Class.newInstance

Class.newInstance

Syntax
public native Object newInstance() throws InstantiationException, IllegalAccessException
Returns
a newly allocated instance of the class represented by this object. This is done exactly as if by a new expression with an empty argument list.
Description
Creates a new instance of a class.

Exceptions
IllegalAccessException if the class or initializer is not accessible.
Exceptions
InstantiationException if an application tries to instantiate an abstract class or an interface, or if the instantiation fails for some other reason.


 Class.toString

Class.toString

Syntax
public String toString()
Returns
a string representation of this class object.
Description
Converts the object to a string. The string representation is the string "class" or "interface" followed by a space and then the fully qualified name of the class. If this Class object represents a primitive type, returns the name of the primitive type.

Overrides
toString in class Object


 Class ClassCastException

Class java.lang.ClassCastException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.lang.ClassCastException

public class ClassCastException
extends RuntimeException

Thrown to indicate that the code has attempted to cast an object to a subclass of which it is not an instance. For example, the following code generates a ClassCastException:

     Object x = new Integer(0);
     System.out.println((String)x);


 ClassCastException Members

ClassCastException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ClassCastException() | Constructs a ClassCastException with no detail message.
ClassCastException(String) | Constructs a ClassCastException with the specified detail message.


 ClassCastException.ClassCastException

ClassCastException.ClassCastException

Syntax 1
public ClassCastException()
Description
Constructs a ClassCastException with no detail message.

Syntax 2
public ClassCastException( String s )
Parameters
s
the detail message.
Description
Constructs a ClassCastException with the specified detail message.


 Class ClassCircularityError

Class java.lang.ClassCircularityError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.LinkageError
                           |
                           +----java.lang.ClassCircularityError

public class ClassCircularityError
extends LinkageError

Thrown when a circularity has been detected while initializing a class.


 ClassCircularityError Members

ClassCircularityError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ClassCircularityError() | Constructs a ClassCircularityError with no detail message.
ClassCircularityError(String) | Constructs a ClassCircularityError with the specified detail message.


 ClassCircularityError.ClassCircularityError

ClassCircularityError.ClassCircularityError

Syntax 1
public ClassCircularityError()
Description
Constructs a ClassCircularityError with no detail message.

Syntax 2
public ClassCircularityError( String s )
Parameters
s
the detail message.
Description
Constructs a ClassCircularityError with the specified detail message.


 Class ClassFormatError

Class java.lang.ClassFormatError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.LinkageError
                           |
                           +----java.lang.ClassFormatError

public class ClassFormatError
extends LinkageError

Thrown when the Java Virtual Machine attempts to read a class file and determines that the file is malformed or otherwise cannot be interpreted as a class file.


 ClassFormatError Members

ClassFormatError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ClassFormatError() | Constructs a ClassFormatError with no detail message.
ClassFormatError(String) | Constructs a ClassFormatError with the specified detail message.


 ClassFormatError.ClassFormatError

ClassFormatError.ClassFormatError

Syntax 1
public ClassFormatError()
Description
Constructs a ClassFormatError with no detail message.

Syntax 2
public ClassFormatError( String s )
Parameters
s
the detail message.
Description
Constructs a ClassFormatError with the specified detail message.


 Class ClassLoader

Class java.lang.ClassLoader

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.ClassLoader

public abstract class ClassLoader
extends Object

The class ClassLoader is an abstract class. Applications implement subclasses of ClassLoader in order to extend the manner in which the Java Virtual Machine dynamically loads classes.

Normally, the Java Virtual Machine loads classes from the local file system in a platform-dependent manner. For example, on UNIX systems, the Virtual Machine loads classes from the directory defined by the CLASSPATH environment variable.

However, some classes may not originate from a file; they may originate from other sources, such as the network, or they could be constructed by an application. The method defineClass converts an array of bytes into an instance of class Class. Instances of this newly defined class can be created using the newInstance method in class Class.

The methods and constructors of objects created by a class loader may reference other classes. To determine the class(es) referred to, the Java Virtual Machine calls the loadClass method of the class loader that originally created the class. If the Java Virtual Machine only needs to determine if the class exists and if it does exist to know its superclass, the resolve flag is set to false. However, if an instance of the class is being created or any of its methods are being called, the class must also be resolved. In this case the resolve flag is set to true, and the resolveClass method should be called.

For example, an application could create a network class loader to download class files from a server. Sample code might look like:

    ClassLoader loader = new NetworkClassLoader(host, port);
    Object main = loader.loadClass("Main", true).newInstance();
    . . .

The network class loader subclass must define the method loadClass to load a class from the network. Once it has downloaded the bytes that make up the class, it should use the method defineClass to create a class instance. A sample implementation is:

     class NetworkClassLoader {
         String host;
         int port;
         Hashtable cache = new Hashtable();
         private byte loadClassData(String name)[] {
         // load the class data from the connection
          . . .
         }
         public synchronized Class loadClass(String name,
                                             boolean resolve) {
             Class c = cache.get(name);
             if (c == null) {
                 byte data[] = loadClassData(name);
                 c = defineClass(data, 0, data.length);
                 cache.put(name, c);
             }
             if (resolve)
                 resolveClass(c);
             return c;
         }
     }

See Also:
Class, newInstance, defineClass, loadClass, resolveClass


 ClassLoader Members

ClassLoader Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ClassLoader() | Constructs a new class loader and initializes it.

Methods
Name | Description
defineClass(byte[], int, int) | Converts an array of bytes into an instance of class Class. Deprecated.
defineClass(String, byte[], int, int) | Converts an array of bytes to an instance of class Class.
findLoadedClass(String) |
findSystemClass(String) | Finds the system class with the specified name, loading it in if necessary.
getResource(String) | Find a resource with a given name.
getResourceAsStream(String) | Get an InputStream on a given resource.
getSystemResource(String) | Find a resource with a given name.
getSystemResourceAsStream(String) | Get an InputStream on a given resource..
loadClass(String) | Requests the class loader to load a class with the specified name.
loadClass(String, boolean) | Resolves the specified name to a Class.
resolveClass(Class) | Resolves the class so that an instance of the class can be created, or so that one of its methods can be called.
setSigners(Class, Object[]) | Sets the signers of a class.


 ClassLoader.ClassLoader

ClassLoader.ClassLoader

Syntax
protected ClassLoader()
Description
Constructs a new class loader and initializes it.

If there is a security manager, its checkCreateClassLoader method is called. This may result in a security exception.

Exceptions
SecurityException if the current thread does not have permission to create a new class loader.
See Also
SecurityException, checkCreateClassLoader


 ClassLoader.defineClass

ClassLoader.defineClass

Syntax 1
protected final Class defineClass( byte data[], int offset, int length )
Parameters
data
the bytes that make up the Class.
offset
the start offset of the Class data.
length
the length of the Class data.
Returns
the Class object that was created from the data.
Description
Note: defineClass() is deprecated. Replaced by defineClass(java.lang.String, byte[], int, int).

Converts an array of bytes into an instance of class Class. Before the Class can be used it must be resolved. This method is deprecated in favor of the version that takes a "name" as a first argument, and is more secure.

Exceptions
ClassFormatError if the data does not contain a valid Class.
See Also
loadClass, resolveClass

Syntax 2
protected final Class defineClass( String name, byte data[], int offset, int length )
Parameters
name
the expected name of the class; null if unknown; using '.' and not '/' as separator, and without a trailing ".class" suffix.
data
the bytes that make up the Class.
offset
the start offset of the Class data.
length
the length of the Class data.
Returns
the Class object that was created from the data.
Description
Converts an array of bytes to an instance of class Class. Before the Class can be used it must be resolved.

Exceptions
ClassFormatError if the data does not contain a valid Class.
See Also
loadClass, resolveClass


 ClassLoader.findLoadedClass

ClassLoader.findLoadedClass

Syntax
protected final Class findLoadedClass( String name )


 ClassLoader.findSystemClass

ClassLoader.findSystemClass

Syntax
protected final Class findSystemClass( String name ) throws ClassNotFoundException
Parameters
name
the name of the system class.
Returns
a system class with the given name.
Description
Finds the system class with the specified name, loading it in if necessary.

A system class is a class loaded from the local file system in a platform- dependent way. It has no class loader.

Exceptions
ClassNotFoundException if it could not find a definition for the class.
Exceptions
NoClassDefFoundError if the class is not found.


 ClassLoader.getResource

ClassLoader.getResource

Syntax
public URL getResource( String name )
Parameters
name
the name of the resource, to be used as is.
Returns
an InputStream on the resource, or null if not found.
Description
Find a resource with a given name. The return is a URL to the resource. Doing a getContent() on the URL may return an Image, an AudioClip, or an InputStream.

The class loader can choose what to do to locate the resource.


 ClassLoader.getResourceAsStream

ClassLoader.getResourceAsStream

Syntax
public InputStream getResourceAsStream( String name )
Parameters
name
the name of the resource, to be used as is.
Returns
an InputStream on the resource, or null if not found.
Description
Get an InputStream on a given resource. Will return null if no resource with this name is found.

The class loader can choose what to do to locate the resource.


 ClassLoader.getSystemResource

ClassLoader.getSystemResource

Syntax
public static final URL getSystemResource( String name )
Parameters
name
the name of the resource, to be used as is.
Returns
the URL on the resource, or null if not found.
Description
Find a resource with a given name. The return is a URL to the resource Doing a getContent() on the URL may return an Image, an AudioClip, or an InputStream.

The resource name may be any system resource (e.g. follows CLASSPATH order).


 ClassLoader.getSystemResourceAsStream

ClassLoader.getSystemResourceAsStream

Syntax
public static final InputStream getSystemResourceAsStream( String name )
Parameters
name
the name of the resource, to be used as is.
Returns
an InputStream on the resource, or null if not found.
Description
Get an InputStream on a given resource.. Will return null if no resource with this name is found.

The resource name may be any system resource (e.g. follows CLASSPATH order).


 ClassLoader.loadClass

ClassLoader.loadClass

Syntax 1
public Class loadClass( String name ) throws ClassNotFoundException
Parameters
name
the name of the desired Class.
resolve
true if the Class must be resolved.
Returns
the resulting Class, or null if it was not found.
Description
Requests the class loader to load a class with the specified name. The loadClass method is called by the Java Virtual Machine when a class loaded by a class loader first references another class. Every subclass of class ClassLoader must define this method.

If the resolve flag is true, the method should call the resolveClass method on the resulting class object.

Class loaders should use a hashtable or other cache to avoid defining classes with the same name multiple times.

Exceptions
ClassNotFoundException if the class loader cannot find a definition for the class.

Syntax 2
protected abstract Class loadClass( String name, boolean resolve ) throws ClassNotFoundException
Parameters
name
the name of the desired Class.
resolve
true if the Class needs to be resolved.
Returns
the resulting Class, or null if it was not found.
Description
Resolves the specified name to a Class. The method loadClass() is called by the virtual machine. As an abstract method, loadClass() must be defined in a subclass of ClassLoader. By using a Hashtable, you can avoid loading the same Class more than once.

Exceptions
ClassNotFoundException if the class loader cannot find a definition for the class.
See Also
Hashtable


 ClassLoader.resolveClass

ClassLoader.resolveClass

Syntax
protected final void resolveClass( Class c )
Parameters
c
the Class instance to be resolved.
Description
Resolves the class so that an instance of the class can be created, or so that one of its methods can be called. This method should be called by loadClass if the resolve flag is true.

See Also
defineClass


 ClassLoader.setSigners

ClassLoader.setSigners

Syntax
protected final void setSigners( Class cl, Object signers[] )
Description
Sets the signers of a class. This is called after defining a class, by signature-aware class loading code.


 Class ClassNotFoundException

Class java.lang.ClassNotFoundException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.ClassNotFoundException

public class ClassNotFoundException
extends Exception

Thrown when an application tries to load in a class through its string name using:

  • The forName method in class Class.
  • The findSystemClass method in class ClassLoader .
  • The loadClass method in class ClassLoader.

but no definition for the class with the specifed name could be found.

See Also:
forName, findSystemClass, loadClass


 ClassNotFoundException Members

ClassNotFoundException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ClassNotFoundException() | Constructs a ClassNotFoundException with no detail message.
ClassNotFoundException(String) | Constructs a ClassNotFoundException with the specified detail message.


 ClassNotFoundException.ClassNotFoundException

ClassNotFoundException.ClassNotFoundException

Syntax 1
public ClassNotFoundException()
Description
Constructs a ClassNotFoundException with no detail message.

Syntax 2
public ClassNotFoundException( String s )
Parameters
s
the detail message.
Description
Constructs a ClassNotFoundException with the specified detail message.


 Class CloneNotSupportedException

Class java.lang.CloneNotSupportedException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.CloneNotSupportedException

public class CloneNotSupportedException
extends Exception

Thrown to indicate that the clone method in class Object has been called to clone an object, but that the object's class does not implement the Cloneable interface.

Applications that override the clone method can also throw this exception to indicate that an object could not or should not be cloned.

See Also:
Cloneable, clone


 CloneNotSupportedException Members

CloneNotSupportedException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
CloneNotSupportedException() | Constructs a CloneNotSupportedException with no detail message.
CloneNotSupportedException(String) | Constructs a CloneNotSupportedException with the specified detail message.


 CloneNotSupportedException.CloneNotSupportedException

CloneNotSupportedException.CloneNotSupportedException

Syntax 1
public CloneNotSupportedException()
Description
Constructs a CloneNotSupportedException with no detail message.

Syntax 2
public CloneNotSupportedException( String s )
Parameters
s
the detail message.
Description
Constructs a CloneNotSupportedException with the specified detail message.


 Interface Cloneable

Interface java.lang.Cloneable

This Package | All Packages

public interface Cloneable

A class implements the Cloneable interface to indicate to the clone method in class Object that it is legal for that method to make a field-for-field copy of instances of that class.

Attempts to clone instances that do not implement the Cloneable interface result in the exception CloneNotSupportedException being thrown.

See Also:
CloneNotSupportedException


 Class Compiler

Class java.lang.Compiler

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Compiler

public final class Compiler
extends Object

The Compiler class is provided to support Java-to-native-code compilers and related services. By design, the Compiler class does nothing; it serves as a placeholder for a JIT compiler implementation.

When the Java Virtual Machine first starts, it determines if the system property java.compiler exists. (System properties are accessible through getProperty and , a method defined by the System class.) If so, it is assumed to be the name of a library (with a platform-dependent exact location and type); the loadLibrary method in class System is called to load that library. If this loading succeeds, the function named java_lang_Compiler_start() in that library is called.

If no compiler is available, these methods do nothing.

See Also:
getProperty, getProperty, loadLibrary


 Compiler Members

Compiler Members

Class Overview | This Package | All Packages

Methods
Name | Description
command(Object) | Examines the argument type and its fields and perform some documented operation.
compileClass(Class) | Compiles the specified class.
compileClasses(String) | Compiles all classes whose name matches the specified string.
disable() | Cause the Compiler to cease operation.
enable() | Cause the Compiler to resume operation.


 Compiler.command

Compiler.command

Syntax
public static native Object command( Object any )
Parameters
any
an argument.
Returns
a compiler-specific value, or null if no compiler is available.
Description
Examines the argument type and its fields and perform some documented operation. No specific operations are required.


 Compiler.compileClass

Compiler.compileClass

Syntax
public static native boolean compileClass( Class clazz )
Parameters
clazz
a class.
Returns
true if the compilation succeeded; false if the compilation failed or no compiler is available.
Description
Compiles the specified class.


 Compiler.compileClasses

Compiler.compileClasses

Syntax
public static native boolean compileClasses( String string )
Parameters
string
the name of the classes to compile.
Returns
true if the compilation succeeded; false if the compilation failed or no compiler is available.
Description
Compiles all classes whose name matches the specified string.


 Compiler.disable

Compiler.disable

Syntax
public static native void disable()
Description
Cause the Compiler to cease operation.


 Compiler.enable

Compiler.enable

Syntax
public static native void enable()
Description
Cause the Compiler to resume operation.


 Class Double

Class java.lang.Double

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Number
           |
           +----java.lang.Double

public final class Double
extends Number

The Double class wraps a value of the primitive type double in an object. An object of type Double contains a single field whose type is double.

In addition, this class provides several methods for converting a double to a String and a String to a double, as well as other constants and methods useful when dealing with a double.


 Double Members

Double Members

Class Overview | This Package | All Packages

Fields
Name | Description
MAX_VALUE | The largest positive value of type double.
MIN_VALUE | The smallest positive value of type double.
NaN | A NaN value of type double.
NEGATIVE_INFINITY | The negative infinity of type double.
POSITIVE_INFINITY | The positive infinity of type double.
TYPE | The Class object representing the primitive type double.

Constructors
Name | Description
Double(double) | Constructs a newly allocated Double object that represents the primitive double argument.
Double(String) | Constructs a newly allocated Double object that represents the floating- point value of type double represented by the string.

Methods
Name | Description
byteValue() | Returns the value of this Double as a byte (by casting to a byte).
doubleToLongBits(double) | Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout.
doubleValue() | Returns the double value of this Double.
equals(Object) | Compares this object against the specified object.
floatValue() | Returns the float value of this Double.
hashCode() | Returns a hashcode for this Double.
intValue() | Returns the integer value of this Double (by casting to an int).
isInfinite() | Returns true if this Double value is infinitely large in magnitude.
isInfinite(double) | Returns true if the specified number is infinitely large in magnitude.
isNaN() | Returns true if this Double value is the special Not-a-Number (NaN) value.
isNaN(double) | Returns true if the specified number is the special Not-a-Number (NaN) value.
longBitsToDouble(long) | Returns the double-float corresponding to a given bit represention.
longValue() | Returns the long value of this Double (by casting to a long).
shortValue() | Returns the value of this Double as a short (by casting to a short).
toString() | Returns a String representation of this Double object.
toString(double) | Creates a string representation of the double argument.
valueOf(String) | Returns a new Double value initialized to the value represented by the specified String.


 Double.MAX_VALUE

Double.MAX_VALUE

Syntax
public static final double MAX_VALUE
Description
The largest positive value of type double.


 Double.MIN_VALUE

Double.MIN_VALUE

Syntax
public static final double MIN_VALUE
Description
The smallest positive value of type double.


 Double.NaN

Double.NaN

Syntax
public static final double NaN
Description
A NaN value of type double.


 Double.NEGATIVE_INFINITY

Double.NEGATIVE_INFINITY

Syntax
public static final double NEGATIVE_INFINITY
Description
The negative infinity of type double.


 Double.POSITIVE_INFINITY

Double.POSITIVE_INFINITY

Syntax
public static final double POSITIVE_INFINITY
Description
The positive infinity of type double.


 Double.TYPE

Double.TYPE

Syntax
public static final Class TYPE
Description
The Class object representing the primitive type double.


 Double.Double

Double.Double

Syntax 1
public Double( double value )
Parameters
value
the value to be represented by the Double.
Description
Constructs a newly allocated Double object that represents the primitive double argument.

Syntax 2
public Double( String s ) throws NumberFormatException
Parameters
s
a string to be converted to a Double.
Description
Constructs a newly allocated Double object that represents the floating- point value of type double represented by the string. The string is converted to a double value as if by the valueOf method.

Exceptions
NumberFormatException if the string does not contain a parsable number.
See Also
valueOf


 Double.byteValue

Double.byteValue

Syntax
public byte byteValue()
Description
Returns the value of this Double as a byte (by casting to a byte).

Overrides
byteValue in class Number


 Double.doubleToLongBits

Double.doubleToLongBits

Syntax
public static native long doubleToLongBits( double value )
Parameters
value
a double precision floating-point number.
Returns
the bits that represent the floating-point number.
Description
Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout.

Bit 63 represents the sign of the floating-point number. Bits 62-52 represent the exponent. Bits 51-0 represent the significand (sometimes called the mantissa) of the floating-point number.

If the argument is positive infinity, the result is 0x7ff0000000000000L.

If the argument is negative infinity, the result is 0xfff0000000000000L.

If the argument is NaN, the result is 0x7ff8000000000000L.


 Double.doubleValue

Double.doubleValue

Syntax
public double doubleValue()
Returns
the double value represented by this object.
Description
Returns the double value of this Double.

Overrides
doubleValue in class Number


 Double.equals

Double.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the object to compare with.
Returns
true if the objects are the same; false otherwise.
Description
Compares this object against the specified object. The result is true if and only if the argument is not null and is a Double object that represents a double that has the identical bit pattern to the bit pattern of the double represented by this object.

Note that in most cases, for two instances of class Double, d1 and d2, the value of d1.equals(d2) is true if and only if

    d1.doubleValue() == d2.doubleValue()

also has the value true. However, there are two exceptions:

  • If d1 and d2 both represent Double.NaN, then the equals method returns true, even though Double.NaN==Double.NaN has the value false.
  • If d1 represents +0.0 while d2 represents -0.0, or vice versa, the equal test has the value false, even though +0.0==-0.0 has the value true.

Overrides
equals in class Object


 Double.floatValue

Double.floatValue

Syntax
public float floatValue()
Returns
the double value represented by this object is converted to type float and the result of the conversion is returned.
Description
Returns the float value of this Double.

Overrides
floatValue in class Number


 Double.hashCode

Double.hashCode

Syntax
public int hashCode()
Returns
a hash code value for this object.
Description
Returns a hashcode for this Double.

Overrides
hashCode in class Object


 Double.intValue

Double.intValue

Syntax
public int intValue()
Returns
the double value represented by this object is converted to type int and the result of the conversion is returned.
Description
Returns the integer value of this Double (by casting to an int).

Overrides
intValue in class Number


 Double.isInfinite

Double.isInfinite

Syntax
public static boolean isInfinite( double v )
Parameters
v
the value to be tested.
Returns
true if the value of the argument is positive infinity or negative infinity; false otherwise.
Description
Returns true if the specified number is infinitely large in magnitude.


 Double.isInfinite

Double.isInfinite

Syntax
public boolean isInfinite()
Returns
true if the value represented by this object is positive infinity or negative infinity; false otherwise.
Description
Returns true if this Double value is infinitely large in magnitude.


 Double.isNaN

Double.isNaN

Syntax
public static boolean isNaN( double v )
Parameters
v
the value to be tested.
Returns
true if the value of the argument is NaN; false otherwise.
Description
Returns true if the specified number is the special Not-a-Number (NaN) value.


 Double.isNaN

Double.isNaN

Syntax
public boolean isNaN()
Returns
true if the value represented by this object is NaN; false otherwise.
Description
Returns true if this Double value is the special Not-a-Number (NaN) value.


 Double.longBitsToDouble

Double.longBitsToDouble

Syntax
public static native double longBitsToDouble( long bits )
Parameters
bits
any long integer.
Returns
the double floating-point value with the same bit pattern.
Description
Returns the double-float corresponding to a given bit represention. The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point "double precision" bit layout. That floating-point value is returned as the result.

If the argument is 0x7f80000000000000L, the result is positive infinity.

If the argument is 0xff80000000000000L, the result is negative infinity.

If the argument is any value in the range 0x7ff0000000000001L through 0x7fffffffffffffffL or in the range 0xfff0000000000001L through 0xffffffffffffffffL, the result is NaN. All IEEE 754 NaN values are, in effect, lumped together by the Java language into a single value.


 Double.longValue

Double.longValue

Syntax
public long longValue()
Returns
the double value represented by this object is converted to type long and the result of the conversion is returned.
Description
Returns the long value of this Double (by casting to a long).

Overrides
longValue in class Number


 Double.shortValue

Double.shortValue

Syntax
public short shortValue()
Description
Returns the value of this Double as a short (by casting to a short).

Overrides
shortValue in class Number


 Double.toString

Double.toString

Syntax
public static String toString( double d )
Parameters
d
the double to be converted.
Returns
a string representation of the argument.
Description
Creates a string representation of the double argument.

The values NaN, NEGATIVE_INFINITY, POSITIVE_INFINITY, -0.0, and +0.0 are represented by the strings "NaN", "-Infinity", "Infinity", "-0.0", and "0.0", respectively.

If d is in the range 10-3 <= |d| <=107, then it is converted to a string in the style [-]ddd.ddd. Otherwise, it is converted to a string in the style [-]m.ddddE±xx.

There is always a minimum of one digit after the decimal point. The number of digits is the minimum needed to uniquely distinguish the argument value from adjacent values of type double.


 Double.toString

Double.toString

Syntax
public String toString()
Returns
a String representation of this object.
Description
Returns a String representation of this Double object. The primitive double value represented by this object is converted to a string exactly as if by the method toString of one argument.

Overrides
toString in class Object
See Also
toString


 Double.valueOf

Double.valueOf

Syntax
public static Double valueOf( String s ) throws NumberFormatException
Parameters
s
the string to be parsed.
Returns
a newly constructed Double initialized to the value represented by the string argument.
Description
Returns a new Double value initialized to the value represented by the specified String.

Exceptions
NumberFormatException if the string does not contain a parsable number.


 Class Error

Class java.lang.Error

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error

public class Error
extends Throwable

An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions. The ThreadDeath error, though a "normal" condition, is also a subclass of Error because most applications should not try to catch it.

A method is not required to declare in its throws clause any subclasses of Error that might be thrown during the execution of the method but not caught, since these errors are abnormal conditions that should never occur.

See Also:
ThreadDeath


 Error Members

Error Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Error() | Constructs an Error with no specified detail message.
Error(String) | Constructs an Error with the specified detail message.


 Error.Error

Error.Error

Syntax 1
public Error()
Description
Constructs an Error with no specified detail message.

Syntax 2
public Error( String s )
Parameters
s
the detail message.
Description
Constructs an Error with the specified detail message.


 Class Exception

Class java.lang.Exception

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception

public class Exception
extends Throwable

The class Exception and its subclasses are a form of Throwable that indicates conditions that a reasonable application might want to catch.

See Also:
Error


 Exception Members

Exception Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Exception() | Constructs an Exception with no specified detail message.
Exception(String) | Constructs an Exception with the specified detail message.


 Exception.Exception

Exception.Exception

Syntax 1
public Exception()
Description
Constructs an Exception with no specified detail message.

Syntax 2
public Exception( String s )
Parameters
s
the detail message.
Description
Constructs an Exception with the specified detail message.


 Class ExceptionInInitializerError

Class java.lang.ExceptionInInitializerError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.LinkageError
                           |
                           +----java.lang.ExceptionInInitializerError

public class ExceptionInInitializerError
extends LinkageError

Signals that an unexpected exception has occurred in a static initializer.


 ExceptionInInitializerError Members

ExceptionInInitializerError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ExceptionInInitializerError() | Constructs an ExceptionInInitializerError with no detail message.
ExceptionInInitializerError(String) | Constructs a ExceptionInInitializerError with the specified detail message.
ExceptionInInitializerError(Throwable) | Constructs a new ExceptionInInitializerError class initialized to the specific throwable

Methods
Name | Description
getException() | Returns the exception that occurred during a static initialization that caused this Error to be created.


 ExceptionInInitializerError.ExceptionInInitializerError

ExceptionInInitializerError.ExceptionInInitializerError

Syntax 1
public ExceptionInInitializerError()
Description
Constructs an ExceptionInInitializerError with no detail message. A detail message is a String that describes this particular exception.

Syntax 2
public ExceptionInInitializerError( Throwable thrown )
Parameters
thrown
The exception thrown
Description
Constructs a new ExceptionInInitializerError class initialized to the specific throwable

Syntax 3
public ExceptionInInitializerError( String s )
Parameters
s
the detail message
Description
Constructs a ExceptionInInitializerError with the specified detail message. A detail message is a String that describes this particular exception.


 ExceptionInInitializerError.getException

ExceptionInInitializerError.getException

Syntax
public Throwable getException()
Description
Returns the exception that occurred during a static initialization that caused this Error to be created.


 Class Float

Class java.lang.Float

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Number
           |
           +----java.lang.Float

public final class Float
extends Number

The Float class wraps a value of primitive type float in an object. An object of type Float contains a single field whose type is float.

In addition, this class provides several methods for converting a float to a String and a String to a float, as well as other constants and methods useful when dealing with a float.


 Float Members

Float Members

Class Overview | This Package | All Packages

Fields
Name | Description
MAX_VALUE | The largest positive value of type float.
MIN_VALUE | The smallest positive value of type float.
NaN | The NaN value of type float.
NEGATIVE_INFINITY | The negative infinity of type float.
POSITIVE_INFINITY | The positive infinity of type float.
TYPE | The Class object representing the primitive type float.

Constructors
Name | Description
Float(double) | Constructs a newly allocated Floatobject that represents the argument converted to type float.
Float(float) | Constructs a newly allocated Float object that represents the primitive float argument.
Float(String) | Constructs a newly allocated Float object that represents the floating- point value of type float represented by the string.

Methods
Name | Description
byteValue() | Returns the value of this Float as a byte (by casting to a byte).
doubleValue() | Returns the double value of this Float.
equals(Object) | Compares this object against some other object.
floatToIntBits(float) | Returns the bit represention of a single-float value.
floatValue() | Returns the float value of this Float object.
hashCode() | Returns a hashcode for this Float.
intBitsToFloat(int) | Returns the single-float corresponding to a given bit represention.
intValue() | Returns the integer value of this Float (by casting to an int).
isInfinite() | Returns true if this Float value is infinitely large in magnitude.
isInfinite(float) | Returns true if the specified number is infinitely large in magnitude.
isNaN() | Returns true if this Float value is Not-a-Number (NaN).
isNaN(float) | Returns true if the specified number is the special Not-a-Number (NaN) value.
longValue() | Returns the long value of this Float (by casting to a long).
shortValue() | Returns the value of this Float as a short (by casting to a short).
toString() | Returns a String representation of this Float object.
toString(float) | Returns a String representation for the specified float value.
valueOf(String) | Returns the floating point value represented by the specified String.


 Float.MAX_VALUE

Float.MAX_VALUE

Syntax
public static final float MAX_VALUE
Description
The largest positive value of type float.


 Float.MIN_VALUE

Float.MIN_VALUE

Syntax
public static final float MIN_VALUE
Description
The smallest positive value of type float.


 Float.NaN

Float.NaN

Syntax
public static final float NaN
Description
The NaN value of type float.


 Float.NEGATIVE_INFINITY

Float.NEGATIVE_INFINITY

Syntax
public static final float NEGATIVE_INFINITY
Description
The negative infinity of type float.


 Float.POSITIVE_INFINITY

Float.POSITIVE_INFINITY

Syntax
public static final float POSITIVE_INFINITY
Description
The positive infinity of type float.


 Float.TYPE

Float.TYPE

Syntax
public static final Class TYPE
Description
The Class object representing the primitive type float.


 Float.Float

Float.Float

Syntax 1
public Float( float value )
Parameters
value
the value to be represented by the Float.
Description
Constructs a newly allocated Float object that represents the primitive float argument.

Syntax 2
public Float( double value )
Parameters
value
the value to be represented by the Float.
Description
Constructs a newly allocated Floatobject that represents the argument converted to type float.

Syntax 3
public Float( String s ) throws NumberFormatException
Parameters
s
a string to be converted to a Float.
Description
Constructs a newly allocated Float object that represents the floating- point value of type float represented by the string. The string is converted to a float value as if by the valueOf method.

Exceptions
NumberFormatException if the string does not contain a parsable number.
See Also
valueOf


 Float.byteValue

Float.byteValue

Syntax
public byte byteValue()
Description
Returns the value of this Float as a byte (by casting to a byte).

Overrides
byteValue in class Number


 Float.doubleValue

Float.doubleValue

Syntax
public double doubleValue()
Description
Returns the double value of this Float.

Overrides
doubleValue in class Number


 Float.equals

Float.equals

Syntax
public boolean equals( Object obj )
Returns
true if the objects are the same; false otherwise.
Description
Compares this object against some other object. The result is true if and only if the argument is not null and is a Float object that represents a float that has the identical bit pattern to the bit pattern of the float represented by this object.

Note that in most cases, for two instances of class Float, f1 and f2, the value of f1.equals(f2) is true if and only if

    f1.floatValue() == f2.floatValue()

also has the value true. However, there are two exceptions:

  • If f1 and f2 both represent Float.NaN, then the equals method returns true, even though Float.NaN==Float.NaN has the value false.
  • If f1 represents +0.0f while f2 represents -0.0f, or vice versa, the equal test has the value false, even though 0.0f==-0.0f has the value true.

Overrides
equals in class Object
See Also
floatToIntBits


 Float.floatToIntBits

Float.floatToIntBits

Syntax
public static native int floatToIntBits( float value )
Parameters
value
a floating-point number.
Returns
the bits that represent the floating-point number.
Description
Returns the bit represention of a single-float value. The result is a representation of the floating-point argument according to the IEEE 754 floating-point "single precision" bit layout.

Bit 31 represents the sign of the floating-point number. Bits 30-23 represent the exponent. Bits 22-0 represent the significand (sometimes called the mantissa) of the floating-point number.

If the argument is positive infinity, the result is 0x7f800000.

If the argument is negative infinity, the result is 0xff800000.

If the argument is NaN, the result is 0x7fc00000.


 Float.floatValue

Float.floatValue

Syntax
public float floatValue()
Returns
the float value represented by this object.
Description
Returns the float value of this Float object.

Overrides
floatValue in class Number


 Float.hashCode

Float.hashCode

Syntax
public int hashCode()
Returns
a hash code value for this object.
Description
Returns a hashcode for this Float.

Overrides
hashCode in class Object


 Float.intBitsToFloat

Float.intBitsToFloat

Syntax
public static native float intBitsToFloat( int bits )
Parameters
bits
an integer.
Returns
the single-format floating-point value with the same bit pattern.
Description
Returns the single-float corresponding to a given bit represention. The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point "single precision" bit layout.

If the argument is 0x7f800000, the result is positive infinity.

If the argument is 0xff800000, the result is negative infinity.

If the argument is any value in the range 0x7f800001 through 0x7f8fffff or in the range 0xff800001 through 0xff8fffff, the result is NaN. All IEEE 754 NaN values are, in effect, lumped together by the Java language into a single value.


 Float.intValue

Float.intValue

Syntax
public int intValue()
Returns
the float value represented by this object converted to type int and the result of the conversion is returned.
Description
Returns the integer value of this Float (by casting to an int).

Overrides
intValue in class Number


 Float.isInfinite

Float.isInfinite

Syntax
public static boolean isInfinite( float v )
Parameters
v
the value to be tested.
Returns
true if the argument is positive infinity or negative infinity; false otherwise.
Description
Returns true if the specified number is infinitely large in magnitude.


 Float.isInfinite

Float.isInfinite

Syntax
public boolean isInfinite()
Returns
true if the value represented by this object is positive infinity or negative infinity; false otherwise.
Description
Returns true if this Float value is infinitely large in magnitude.


 Float.isNaN

Float.isNaN

Syntax
public static boolean isNaN( float v )
Parameters
v
the value to be tested.
Returns
true if the argument is NaN; false otherwise.
Description
Returns true if the specified number is the special Not-a-Number (NaN) value.


 Float.isNaN

Float.isNaN

Syntax
public boolean isNaN()
Returns
true if the value represented by this object is NaN; false otherwise.
Description
Returns true if this Float value is Not-a-Number (NaN).


 Float.longValue

Float.longValue

Syntax
public long longValue()
Returns
the float value represented by this object is converted to type long and the result of the conversion is returned.
Description
Returns the long value of this Float (by casting to a long).

Overrides
longValue in class Number


 Float.shortValue

Float.shortValue

Syntax
public short shortValue()
Description
Returns the value of this Float as a short (by casting to a short).

Overrides
shortValue in class Number


 Float.toString

Float.toString

Syntax
public static String toString( float f )
Parameters
d
the float to be converted.
Returns
a string representation of the argument.
Description
Returns a String representation for the specified float value.

The values NaN, NEGATIVE_INFINITY, POSITIVE_INFINITY, -0.0, and +0.0 are represented by the strings "NaN", "-Infinity", "Infinity", "-0.0", and "0.0", respectively.

If d is in the range 10-3 <= |d| <= 107, then it is converted to a String in the style [-]ddd.ddd. Otherwise, it is converted to a string in the style [-]m.ddddE±xx.

There is always a minimum of 1 digit after the decimal point. The number of digits is the minimum needed to uniquely distinguish the argument value from adjacent values of type float.


 Float.toString

Float.toString

Syntax
public String toString()
Returns
a String representation of this object.
Description
Returns a String representation of this Float object. The primitive float value represented by this object is converted to a String exactly as if by the method toString of one argument.

Overrides
toString in class Object
See Also
toString


 Float.valueOf

Float.valueOf

Syntax
public static Float valueOf( String s ) throws NumberFormatException
Parameters
s
the string to be parsed.
Returns
a newly constructed Float initialized to the value represented by the String argument.
Description
Returns the floating point value represented by the specified String.

Exceptions
NumberFormatException if the string does not contain a parsable number.


 Class IllegalAccessError

Class java.lang.IllegalAccessError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.LinkageError
                           |
                           +----java.lang.IncompatibleClassChangeError
                                   |
                                   +----java.lang.IllegalAccessError

public class IllegalAccessError
extends IncompatibleClassChangeError

Thrown if an application attempts to access or modify a field, or to call a method that it does not have access to.

Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed.


 IllegalAccessError Members

IllegalAccessError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
IllegalAccessError() | Constructs an IllegalAccessError with no detail message.
IllegalAccessError(String) | Constructs an IllegalAccessError with the specified detail message.


 IllegalAccessError.IllegalAccessError

IllegalAccessError.IllegalAccessError

Syntax 1
public IllegalAccessError()
Description
Constructs an IllegalAccessError with no detail message.

Syntax 2
public IllegalAccessError( String s )
Parameters
s
the detail message.
Description
Constructs an IllegalAccessError with the specified detail message.


 Class IllegalAccessException

Class java.lang.IllegalAccessException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.IllegalAccessException

public class IllegalAccessException
extends Exception

Thrown when an application tries to load in a class through its string name using:

  • The forName method in class Class.
  • The findSystemClass method in class ClassLoader.
  • The loadClass method in class ClassLoader.

but the currently executing method does not have access to the definition of the specified class, because the class is not public and in another package.

An instance of this class can also be thrown when an application tries to create an instance of a class using the newInstance method in class Class, but the current method does not have access to the appropriate zero-argument constructor.

See Also:
forName, newInstance, findSystemClass, loadClass


 IllegalAccessException Members

IllegalAccessException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
IllegalAccessException() | Constructs an IllegalAccessException without a detail message.
IllegalAccessException(String) | Constructs an IllegalAccessException with a detail message.


 IllegalAccessException.IllegalAccessException

IllegalAccessException.IllegalAccessException

Syntax 1
public IllegalAccessException()
Description
Constructs an IllegalAccessException without a detail message.

Syntax 2
public IllegalAccessException( String s )
Parameters
s
the detail message.
Description
Constructs an IllegalAccessException with a detail message.


 Class IllegalArgumentException

Class java.lang.IllegalArgumentException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.lang.IllegalArgumentException

public class IllegalArgumentException
extends RuntimeException

Thrown to indicate that a method has been passed an illegal or inappropriate argument.

See Also:
setPriority


 IllegalArgumentException Members

IllegalArgumentException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
IllegalArgumentException() | Constructs an IllegalArgumentException with no detail message.
IllegalArgumentException(String) | Constructs an IllegalArgumentException with the specified detail message.


 IllegalArgumentException.IllegalArgumentException

IllegalArgumentException.IllegalArgumentException

Syntax 1
public IllegalArgumentException()
Description
Constructs an IllegalArgumentException with no detail message.

Syntax 2
public IllegalArgumentException( String s )
Parameters
s
the detail message.
Description
Constructs an IllegalArgumentException with the specified detail message.


 Class IllegalMonitorStateException

Class java.lang.IllegalMonitorStateException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.lang.IllegalMonitorStateException

public class IllegalMonitorStateException
extends RuntimeException

Thrown to indicate that a thread has attempted to wait on an object's monitor or to notify other threads waiting on an object's monitor without owning the specified monitor.

See Also:
notify, notifyAll, wait, wait, wait


 IllegalMonitorStateException Members

IllegalMonitorStateException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
IllegalMonitorStateException() | Constructs an IllegalMonitorStateException with no detail message.
IllegalMonitorStateException(String) | Constructs an IllegalMonitorStateException with the specified detail message.


 IllegalMonitorStateException.IllegalMonitorStateException

IllegalMonitorStateException.IllegalMonitorStateException

Syntax 1
public IllegalMonitorStateException()
Description
Constructs an IllegalMonitorStateException with no detail message.

Syntax 2
public IllegalMonitorStateException( String s )
Parameters
s
the detail message.
Description
Constructs an IllegalMonitorStateException with the specified detail message.


 Class IllegalStateException

Class java.lang.IllegalStateException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.lang.IllegalStateException

public class IllegalStateException
extends RuntimeException

Signals that a method has been invoked at an illegal or inappropriate time. In other words, the Java environment or Java application is not in an appropriate state for the requested operation.


 IllegalStateException Members

IllegalStateException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
IllegalStateException() | Constructs an IllegalStateException with no detail message.
IllegalStateException(String) | Constructs an IllegalStateException with the specified detail message.


 IllegalStateException.IllegalStateException

IllegalStateException.IllegalStateException

Syntax 1
public IllegalStateException()
Description
Constructs an IllegalStateException with no detail message. A detail message is a String that describes this particular exception.

Syntax 2
public IllegalStateException( String s )
Parameters
s
the String that contains a detailed message
Description
Constructs an IllegalStateException with the specified detail message. A detail message is a String that describes this particular exception.


 Class IllegalThreadStateException

Class java.lang.IllegalThreadStateException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.lang.IllegalArgumentException
                                   |
                                   +----java.lang.IllegalThreadStateException

public class IllegalThreadStateException
extends IllegalArgumentException

Thrown to indicate that a thread is not in an appropriate state for the requested operation. See, for example, the suspend and resume methods in class Thread.

See Also:
resume, suspend


 IllegalThreadStateException Members

IllegalThreadStateException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
IllegalThreadStateException() | Constructs an IllegalThreadStateException with no detail message.
IllegalThreadStateException(String) | Constructs an IllegalThreadStateException with the specified detail message.


 IllegalThreadStateException.IllegalThreadStateException

IllegalThreadStateException.IllegalThreadStateException

Syntax 1
public IllegalThreadStateException()
Description
Constructs an IllegalThreadStateException with no detail message.

Syntax 2
public IllegalThreadStateException( String s )
Parameters
s
the detail message.
Description
Constructs an IllegalThreadStateException with the specified detail message.


 Class IncompatibleClassChangeError

Class java.lang.IncompatibleClassChangeError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.LinkageError
                           |
                           +----java.lang.IncompatibleClassChangeError

public class IncompatibleClassChangeError
extends LinkageError

Thrown when an incompatible class change has occurred to some class definition. The definition of some class, on which the currently executing method depends, has since changed.


 IncompatibleClassChangeError Members

IncompatibleClassChangeError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
IncompatibleClassChangeError() | Constructs an IncompatibleClassChangeError with no detail message.
IncompatibleClassChangeError(String) | Constructs an IncompatibleClassChangeError with the specified detail message.


 IncompatibleClassChangeError.IncompatibleClassChangeError

IncompatibleClassChangeError.IncompatibleClassChangeError

Syntax 1
public IncompatibleClassChangeError()
Description
Constructs an IncompatibleClassChangeError with no detail message.

Syntax 2
public IncompatibleClassChangeError( String s )
Parameters
s
the detail message.
Description
Constructs an IncompatibleClassChangeError with the specified detail message.


 Class IndexOutOfBoundsException

Class java.lang.IndexOutOfBoundsException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.lang.IndexOutOfBoundsException

public class IndexOutOfBoundsException
extends RuntimeException

Thrown to indicate that an index of some sort (such as to an array, to a string, or to a vector) is out of range.

Applications can subclass this class to indicate similar exceptions.


 IndexOutOfBoundsException Members

IndexOutOfBoundsException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
IndexOutOfBoundsException() | Constructs an IndexOutOfBoundsException with no detail message.
IndexOutOfBoundsException(String) | Constructs an IndexOutOfBoundsException with the specified detail message.


 IndexOutOfBoundsException.IndexOutOfBoundsException

IndexOutOfBoundsException.IndexOutOfBoundsException

Syntax 1
public IndexOutOfBoundsException()
Description
Constructs an IndexOutOfBoundsException with no detail message.

Syntax 2
public IndexOutOfBoundsException( String s )
Parameters
s
the detail message.
Description
Constructs an IndexOutOfBoundsException with the specified detail message.


 Class InstantiationError

Class java.lang.InstantiationError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.LinkageError
                           |
                           +----java.lang.IncompatibleClassChangeError
                                   |
                                   +----java.lang.InstantiationError

public class InstantiationError
extends IncompatibleClassChangeError

Thrown when an application tries to use the Java new construct to instantiate an abstract class or an interface.

Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed.


 InstantiationError Members

InstantiationError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
InstantiationError() | Constructs an InstantiationError with no detail message.
InstantiationError(String) | Constructs an InstantiationError with the specified detail message.


 InstantiationError.InstantiationError

InstantiationError.InstantiationError

Syntax 1
public InstantiationError()
Description
Constructs an InstantiationError with no detail message.

Syntax 2
public InstantiationError( String s )
Parameters
s
the detail message.
Description
Constructs an InstantiationError with the specified detail message.


 Class InstantiationException

Class java.lang.InstantiationException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.InstantiationException

public class InstantiationException
extends Exception

Thrown when an application tries to create an instance of a class using the newInstance method in class Class, but the specified class object cannot be instantiated because it is an interface or is an abstract class.

See Also:
newInstance


 InstantiationException Members

InstantiationException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
InstantiationException() | Constructs an InstantiationException with no detail message.
InstantiationException(String) | Constructs an InstantiationException with the specified detail message.


 InstantiationException.InstantiationException

InstantiationException.InstantiationException

Syntax 1
public InstantiationException()
Description
Constructs an InstantiationException with no detail message.

Syntax 2
public InstantiationException( String s )
Parameters
s
the detail message.
Description
Constructs an InstantiationException with the specified detail message.


 Class Integer

Class java.lang.Integer

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Number
           |
           +----java.lang.Integer

public final class Integer
extends Number

The Integer class wraps a value of the primitive type int in an object. An object of type Integer contains a single field whose type is int.

In addition, this class provides several methods for converting an int to a String and a String to an int, as well as other constants and methods useful when dealing with an int.


 Integer Members

Integer Members

Class Overview | This Package | All Packages

Fields
Name | Description
MAX_VALUE | The largest value of type int.
MIN_VALUE | The smallest value of type int.
TYPE | The Class object representing the primitive type int.

Constructors
Name | Description
Integer(int) | Constructs a newly allocated Integer object that represents the primitive int argument.
Integer(String) | Constructs a newly allocated Integer object that represents the value represented by the string.

Methods
Name | Description
byteValue() | Returns the value of this Integer as a byte.
decode(String) | Decodes a string into an Integer.
doubleValue() | Returns the value of this Integer as a double.
equals(Object) | Compares this object to the specified object.
floatValue() | Returns the value of this Integer as a float.
getInteger(String) | Determines the integer value of the system property with the specified name.
getInteger(String, int) | Determines the integer value of the system property with the specified name.
getInteger(String, Integer) | Determines the integer value of the system property with the specified name.
hashCode() | Returns a hashcode for this Integer.
intValue() | Returns the value of this Integer as an int.
longValue() | Returns the value of this Integer as a long.
parseInt(String) | Parses the string argument as a signed decimal integer.
parseInt(String, int) | Parses the string argument as a signed integer in the radix specified by the second argument.
shortValue() | Returns the value of this Integer as a short.
toBinaryString(int) | Creates a string representation of the integer argument as an unsigned integer in base 2.
toHexString(int) | Creates a string representation of the integer argument as an unsigned integer in base 16.
toOctalString(int) | Creates a string representation of the integer argument as an unsigned integer in base 8.
toString() | Returns a String object representing this Integer's value.
toString(int) | Returns a new String object representing the specified integer.
toString(int, int) | Creates a string representation of the first argument in the radix specified by the second argument.
valueOf(String) | Returns a new Integer object initialized to the value of the specified String.
valueOf(String, int) | Returns a new Integer object initialized to the value of the specified String.


 Integer.MAX_VALUE

Integer.MAX_VALUE

Syntax
public static final int MAX_VALUE
Description
The largest value of type int.


 Integer.MIN_VALUE

Integer.MIN_VALUE

Syntax
public static final int MIN_VALUE
Description
The smallest value of type int.


 Integer.TYPE

Integer.TYPE

Syntax
public static final Class TYPE
Description
The Class object representing the primitive type int.


 Integer.Integer

Integer.Integer

Syntax 1
public Integer( int value )
Parameters
value
the value to be represented by the Integer.
Description
Constructs a newly allocated Integer object that represents the primitive int argument.

Syntax 2
public Integer( String s ) throws NumberFormatException
Parameters
s
the String to be converted to an Integer.
Description
Constructs a newly allocated Integer object that represents the value represented by the string. The string is converted to an int value as if by the valueOf method.

Exceptions
NumberFormatException if the String does not contain a parsable integer.
See Also
valueOf


 Integer.byteValue

Integer.byteValue

Syntax
public byte byteValue()
Description
Returns the value of this Integer as a byte.

Overrides
byteValue in class Number


 Integer.decode

Integer.decode

Syntax
public static Integer decode( String nm ) throws NumberFormatException
Parameters
nm
the string to decode
Description
Decodes a string into an Integer. Deals with decimal, hexadecimal, and octal numbers.


 Integer.doubleValue

Integer.doubleValue

Syntax
public double doubleValue()
Returns
the int value represented by this object is converted to type double and the result of the conversion is returned.
Description
Returns the value of this Integer as a double.

Overrides
doubleValue in class Number


 Integer.equals

Integer.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the object to compare with.
Returns
true if the objects are the same; false otherwise.
Description
Compares this object to the specified object. The result is true if and only if the argument is not null and is an Integer object that contains the same int value as this object.

Overrides
equals in class Object


 Integer.floatValue

Integer.floatValue

Syntax
public float floatValue()
Returns
the int value represented by this object is converted to type float and the result of the conversion is returned.
Description
Returns the value of this Integer as a float.

Overrides
floatValue in class Number


 Integer.getInteger

Integer.getInteger

Syntax 1
public static Integer getInteger( String nm )
Parameters
nm
property name.
Returns
the Integer value of the property.
Description
Determines the integer value of the system property with the specified name.

The first argument is treated as the name of a system property. System properties are accessible through getProperty and , a method defined by the System class. The string value of this property is then interpreted as an integer value and an Integer object representing this value is returned. Details of possible numeric formats can be found with the definition of getProperty.

If there is no property with the specified name, or if the property does not have the correct numeric format, then null is returned.

See Also
getProperty, getProperty

Syntax 2
public static Integer getInteger( String nm, int val )
Parameters
nm
property name.
val
default value.
Returns
the Integer value of the property.
Description
Determines the integer value of the system property with the specified name.

The first argument is treated as the name of a system property. System properties are accessible through getProperty and , a method defined by the System class. The string value of this property is then interpreted as an integer value and an Integer object representing this value is returned. Details of possible numeric formats can be found with the definition of getProperty.

If there is no property with the specified name, or if the property does not have the correct numeric format, then an Integer object that represents the value of the second argument is returned.

See Also
getProperty, getProperty

Syntax 3
public static Integer getInteger( String nm, Integer val )
Parameters
nm
property name.
val
default value.
Returns
the Integer value of the property.
Description
Determines the integer value of the system property with the specified name.

The first argument is treated as the name of a system property. System properties are accessible through getProperty and , a method defined by the System class. The string value of this property is then interpreted as an integer value and an Integer object representing this value is returned.

If the property value begins with "0x" or "#", not followed by a minus sign, the rest of it is parsed as a hexadecimal integer exactly as for the method Integer.valueOf with radix 16.

If the property value begins with "0" then it is parsed as an octal integer exactly as for the method Integer.valueOf with radix 8.

Otherwise the property value is parsed as a decimal integer exactly as for the method Integer.valueOf with radix 10.

The second argument is the default value. If there is no property of the specified name, or if the property does not have the correct numeric format, then the second argument is returned.

See Also
getProperty, getProperty


 Integer.hashCode

Integer.hashCode

Syntax
public int hashCode()
Returns
a hash code value for this object.
Description
Returns a hashcode for this Integer.

Overrides
hashCode in class Object


 Integer.intValue

Integer.intValue

Syntax
public int intValue()
Returns
the int value represented by this object.
Description
Returns the value of this Integer as an int.

Overrides
intValue in class Number


 Integer.longValue

Integer.longValue

Syntax
public long longValue()
Returns
the int value represented by this object that is converted to type long and the result of the conversion is returned.
Description
Returns the value of this Integer as a long.

Overrides
longValue in class Number


 Integer.parseInt

Integer.parseInt

Syntax 1
public static int parseInt( String s, int radix ) throws NumberFormatException
Parameters
s
the String containing the integer.
radix
the radix to be used.
Returns
the integer represented by the string argument in the specified radix.
Description
Parses the string argument as a signed integer in the radix specified by the second argument. The characters in the string must all be digits of the specified radix (as determined by whether Character.digit returns a nonnegative value), except that the first character may be an ASCII minus sign '-' to indicate a negative value. The resulting integer value is returned.

Exceptions
NumberFormatException if the string does not contain a parsable integer.

Syntax 2
public static int parseInt( String s ) throws NumberFormatException
Parameters
s
a string.
Returns
the integer represented by the argument in decimal.
Description
Parses the string argument as a signed decimal integer. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' to indicate a negative value.

Exceptions
NumberFormatException if the string does not contain a parsable integer.


 Integer.shortValue

Integer.shortValue

Syntax
public short shortValue()
Description
Returns the value of this Integer as a short.

Overrides
shortValue in class Number


 Integer.toBinaryString

Integer.toBinaryString

Syntax
public static String toBinaryString( int i )
Parameters
i
an integer.
Returns
the string representation of the unsigned integer value represented by the argument in binary (base 2).
Description
Creates a string representation of the integer argument as an unsigned integer in base 2.

The unsigned integer value is the argument plus 232if the argument is negative; otherwise it is equal to the argument. This value is converted to a string of ASCII digits in binary (base 2) with no extra leading 0s.


 Integer.toHexString

Integer.toHexString

Syntax
public static String toHexString( int i )
Parameters
i
an integer.
Returns
the string representation of the unsigned integer value represented by the argument in hexadecimal (base 16).
Description
Creates a string representation of the integer argument as an unsigned integer in base 16.

The unsigned integer value is the argument plus 232 if the argument is negative; otherwise, it is equal to the argument. This value is converted to a string of ASCII digits in hexadecimal (base 16) with no extra leading 0s.


 Integer.toOctalString

Integer.toOctalString

Syntax
public static String toOctalString( int i )
Parameters
i
an integer
Returns
the string representation of the unsigned integer value represented by the argument in octal (base&mnsp;8).
Description
Creates a string representation of the integer argument as an unsigned integer in base 8.

The unsigned integer value is the argument plus 232 if the argument is negative; otherwise, it is equal to the argument. This value is converted to a string of ASCII digits in octal (base 8) with no extra leading 0s.


 Integer.toString

Integer.toString

Syntax
public static String toString( int i, int radix )
Parameters
i
an integer.
radix
the radix.
Returns
a string representation of the argument in the specified radix.
Description
Creates a string representation of the first argument in the radix specified by the second argument.

If the radix is smaller than Character.MIN_RADIX or larger than Character.MAX_RADIX, then the radix 10 is used instead.

If the first argument is negative, the first element of the result is the ASCII minus character '-'. If the first argument is not negative, no sign character appears in the result. The following ASCII characters are used as digits:

    0123456789abcdefghijklmnopqrstuvwxyz

See Also
MAX_RADIX, MIN_RADIX


 Integer.toString

Integer.toString

Syntax
public static String toString( int i )
Parameters
i
an integer to be converted.
Returns
a string representation of the argument in base 10.
Description
Returns a new String object representing the specified integer. The radix is assumed to be 10.


 Integer.toString

Integer.toString

Syntax
public String toString()
Returns
a string representation of the value of this object in base 10.
Description
Returns a String object representing this Integer's value.

Overrides
toString in class Object


 Integer.valueOf

Integer.valueOf

Syntax 1
public static Integer valueOf( String s, int radix ) throws NumberFormatException
Parameters
s
the string to be parsed.
Returns
a newly constructed Integer initialized to the value represented by the string argument in the specified radix.
Description
Returns a new Integer object initialized to the value of the specified String. Throws an exception if the String cannot be parsed as an int.

Exceptions
NumberFormatException if the String does not contain a parsable integer.

Syntax 2
public static Integer valueOf( String s ) throws NumberFormatException
Parameters
s
the string to be parsed.
Returns
a newly constructed Integer initialized to the value represented by the string argument.
Description
Returns a new Integer object initialized to the value of the specified String. Throws an exception if the String cannot be parsed as an int. The radix is assumed to be 10.

Exceptions
NumberFormatException if the string does not contain a parsable integer.


 Class InternalError

Class java.lang.InternalError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.VirtualMachineError
                           |
                           +----java.lang.InternalError

public class InternalError
extends VirtualMachineError

Thrown to indicate some unexpected internal error has occurred in the Java Virtual Machine.


 InternalError Members

InternalError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
InternalError() | Constructs an InternalError with no detail message.
InternalError(String) | Constructs an InternalError with the specified detail message.


 InternalError.InternalError

InternalError.InternalError

Syntax 1
public InternalError()
Description
Constructs an InternalError with no detail message.

Syntax 2
public InternalError( String s )
Parameters
s
the detail message.
Description
Constructs an InternalError with the specified detail message.


 Class InterruptedException

Class java.lang.InterruptedException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.InterruptedException

public class InterruptedException
extends Exception

Thrown when a thread is waiting, sleeping, or otherwise paused for a long time and another thread interrupts it using the interrupt method in class Thread.

See Also:
wait, wait, wait, sleep, interrupt, interrupted


 InterruptedException Members

InterruptedException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
InterruptedException() | Constructs an InterruptedException with no detail message.
InterruptedException(String) | Constructs an InterruptedException with the specified detail message.


 InterruptedException.InterruptedException

InterruptedException.InterruptedException

Syntax 1
public InterruptedException()
Description
Constructs an InterruptedException with no detail message.

Syntax 2
public InterruptedException( String s )
Parameters
s
the detail message.
Description
Constructs an InterruptedException with the specified detail message.


 Class LinkageError

Class java.lang.LinkageError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.LinkageError

public class LinkageError
extends Error

Subclasses of LinkageError indicate that a class has some dependency on another class; however, the latter class has incompatibly changed after the compilation of the former class.


 LinkageError Members

LinkageError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
LinkageError() | Constructs a LinkageError with no detail message.
LinkageError(String) | Constructs a LinkageError with the specified detail message.


 LinkageError.LinkageError

LinkageError.LinkageError

Syntax 1
public LinkageError()
Description
Constructs a LinkageError with no detail message.

Syntax 2
public LinkageError( String s )
Parameters
s
the detail message.
Description
Constructs a LinkageError with the specified detail message.


 Class Long

Class java.lang.Long

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Number
           |
           +----java.lang.Long

public final class Long
extends Number

The Long class wraps a value of the primitive type long in an object. An object of type Long contains a single field whose type is long.

In addition, this class provides several methods for converting a long to a String and a String to a long, as well as other constants and methods useful when dealing with a long.


 Long Members

Long Members

Class Overview | This Package | All Packages

Fields
Name | Description
MAX_VALUE | The largest value of type long.
MIN_VALUE | The smallest value of type long.
TYPE | The Class object representing the primitive type long.

Constructors
Name | Description
Long(long) | Constructs a newly allocated Long object that represents the primitive long argument.
Long(String) | Constructs a newly allocated Long object that represents the value represented by the string.

Methods
Name | Description
byteValue() | Returns the value of this Long as a byte.
doubleValue() | Returns the value of this Long as a double.
equals(Object) | Compares this object against the specified object.
floatValue() | Returns the value of this Long as a float.
getLong(String) | Determines the long value of the system property with the specified name.
getLong(String, Long) | Determines the long value of the system property with the specified name.
getLong(String, long) | Determines the long value of the system property with the specified name.
hashCode() | Computes a hashcode for this Long.
intValue() | Returns the value of this Long as an int.
longValue() | Returns the value of this Long as a long.
parseLong(String) | Parses the string argument as a signed decimal long.
parseLong(String, int) | Parses the string argument as a signed long in the radix specified by the second argument.
shortValue() | Returns the value of this Long as a short.
toBinaryString(long) | Creates a string representation of the long argument as an unsigned integer in base 2.
toHexString(long) | Creates a string representation of the long argument as an unsigned integer in base 16.
toOctalString(long) | Creates a string representation of the long argument as an unsigned integer in base 8.
toString() | Returns a String object representing this Long's value.
toString(long) | Returns a new String object representing the specified integer.
toString(long, int) | Creates a string representation of the first argument in the radix specified by the second argument.
valueOf(String) | Returns a new long object initialized to the value of the specified String.
valueOf(String, int) | Returns a new long object initialized to the value of the specified String.


 Long.MAX_VALUE

Long.MAX_VALUE

Syntax
public static final long MAX_VALUE
Description
The largest value of type long.


 Long.MIN_VALUE

Long.MIN_VALUE

Syntax
public static final long MIN_VALUE
Description
The smallest value of type long.


 Long.TYPE

Long.TYPE

Syntax
public static final Class TYPE
Description
The Class object representing the primitive type long.


 Long.Long

Long.Long

Syntax 1
public Long( long value )
Parameters
value
the value to be represented by the Long.
Description
Constructs a newly allocated Long object that represents the primitive long argument.

Syntax 2
public Long( String s ) throws NumberFormatException
Parameters
s
the string to be converted to a Long.
Description
Constructs a newly allocated Long object that represents the value represented by the string. The string is converted to an long value as if by the valueOf method.

Exceptions
NumberFormatException if the String does not contain a parsable long integer.
See Also
valueOf


 Long.byteValue

Long.byteValue

Syntax
public byte byteValue()
Description
Returns the value of this Long as a byte.

Overrides
byteValue in class Number


 Long.doubleValue

Long.doubleValue

Syntax
public double doubleValue()
Returns
the long value represented by this object that is converted to type double and the result of the conversion is returned.
Description
Returns the value of this Long as a double.

Overrides
doubleValue in class Number


 Long.equals

Long.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the object to compare with.
Returns
true if the objects are the same; false otherwise.
Description
Compares this object against the specified object. The result is true if and only if the argument is not null and is a Long object that contains the same long value as this object.

Overrides
equals in class Object


 Long.floatValue

Long.floatValue

Syntax
public float floatValue()
Returns
the long value represented by this object is converted to type float and the result of the conversion is returned.
Description
Returns the value of this Long as a float.

Overrides
floatValue in class Number


 Long.getLong

Long.getLong

Syntax 1
public static Long getLong( String nm )
Parameters
nm
property name.
Returns
the Long value of the property.
Description
Determines the long value of the system property with the specified name.

The first argument is treated as the name of a system property. System properties are accessible through getProperty and , a method defined by the System class. The string value of this property is then interpreted as a long value and a Long object representing this value is returned. Details of possible numeric formats can be found with the definition of getProperty.

If there is no property with the specified name, or if the property does not have the correct numeric format, then null is returned.

See Also
getProperty, getProperty

Syntax 2
public static Long getLong( String nm, long val )
Parameters
nm
property name.
val
default value.
Returns
the Long value of the property.
Description
Determines the long value of the system property with the specified name.

The first argument is treated as the name of a system property. System properties are accessible through getProperty and , a method defined by the System class. The string value of this property is then interpreted as a long value and a Long object representing this value is returned. Details of possible numeric formats can be found with the definition of getProperty.

If there is no property with the specified name, or if the property does not have the correct numeric format, then a Long object that represents the value of the second argument is returned.

See Also
getProperty, getProperty

Syntax 3
public static Long getLong( String nm, Long val )
Parameters
nm
the property name.
val
the default Long value.
Returns
the long value of the property.
Description
Determines the long value of the system property with the specified name.

The first argument is treated as the name of a system property. System properties are accessible through getProperty and , a method defined by the System class. The string value of this property is then interpreted as a long value and a Long object representing this value is returned.

If the property value begins with "0x" or "#", not followed by a minus sign, the rest of it is parsed as a hexadecimal integer exactly as for the method Long.valueOf with radix 16.

If the property value begins with "0", then it is parsed as an octal integer exactly as for the method Long.valueOf with radix 8.

Otherwise the property value is parsed as a decimal integer exactly as for the method Long.valueOf with radix 10.

Note that, in every case, neither L nor l is permitted to appear at the end of the string.

The second argument is the default value. If there is no property of the specified name, or if the property does not have the correct numeric format, then the second argument is returned.

See Also
valueOf, getProperty, getProperty


 Long.hashCode

Long.hashCode

Syntax
public int hashCode()
Returns
a hash code value for this object.
Description
Computes a hashcode for this Long.

Overrides
hashCode in class Object


 Long.intValue

Long.intValue

Syntax
public int intValue()
Returns
the long value represented by this object is converted to type int and the result of the conversion is returned.
Description
Returns the value of this Long as an int.

Overrides
intValue in class Number


 Long.longValue

Long.longValue

Syntax
public long longValue()
Returns
the long value represented by this object.
Description
Returns the value of this Long as a long.

Overrides
longValue in class Number


 Long.parseLong

Long.parseLong

Syntax 1
public static long parseLong( String s, int radix ) throws NumberFormatException
Parameters
s
the String containing the long.
radix
the radix to be used.
Returns
the long represented by the string argument in the specified radix.
Description
Parses the string argument as a signed long in the radix specified by the second argument. The characters in the string must all be digits of the specified radix (as determined by whether Character.digit returns a nonnegative value), except that the first character may be an ASCII minus sign '-' to indicate a negative value. The resulting long value is returned.

Exceptions
NumberFormatException if the string does not contain a parsable integer.

Syntax 2
public static long parseLong( String s ) throws NumberFormatException
Parameters
s
a string.
Returns
the long represented by the argument in decimal.
Description
Parses the string argument as a signed decimal long. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' to indicate a negative value.

Exceptions
NumberFormatException if the string does not contain a parsable long.


 Long.shortValue

Long.shortValue

Syntax
public short shortValue()
Description
Returns the value of this Long as a short.

Overrides
shortValue in class Number


 Long.toBinaryString

Long.toBinaryString

Syntax
public static String toBinaryString( long i )
Parameters
i
a long.
Returns
the string representation of the unsigned long value represented by the argument in binary (base 2).
Description
Creates a string representation of the long argument as an unsigned integer in base 2.

The unsigned long value is the argument plus 264 if the argument is negative; otherwise, it is equal to the argument. This value is converted to a string of ASCII digits in binary (base 2) with no extra leading 0s.


 Long.toHexString

Long.toHexString

Syntax
public static String toHexString( long i )
Parameters
i
a long.
Returns
the string representation of the unsigned long value represented by the argument in hexadecimal (base 16).
Description
Creates a string representation of the long argument as an unsigned integer in base 16.

The unsigned long value is the argument plus 264 if the argument is negative; otherwise, it is equal to the argument. This value is converted to a string of ASCII digits in hexadecimal (base 16) with no extra leading 0s.


 Long.toOctalString

Long.toOctalString

Syntax
public static String toOctalString( long i )
Parameters
i
a long.
Returns
the string representation of the unsigned long value represented by the argument in octal (base 8).
Description
Creates a string representation of the long argument as an unsigned integer in base 8.

The unsigned long value is the argument plus 264 if the argument is negative; otherwise, it is equal to the argument. This value is converted to a string of ASCII digits in octal (base 8) with no extra leading 0s.


 Long.toString

Long.toString

Syntax
public static String toString( long i, int radix )
Parameters
i
a long.
radix
the radix.
Returns
a string representation of the argument in the specified radix.
Description
Creates a string representation of the first argument in the radix specified by the second argument.

If the radix is smaller than Character.MIN_RADIX or larger than Character.MAX_RADIX, then the radix 10 is used instead.

If the first argument is negative, the first element of the result is the ASCII minus sign '-'. If the first argument is not negative, no sign character appears in the result. The following ASCII characters are used as digits:

    0123456789abcdefghijklmnopqrstuvwxyz

See Also
MAX_RADIX, MIN_RADIX


 Long.toString

Long.toString

Syntax
public static String toString( long i )
Parameters
i
a long to be converted.
Returns
a string representation of the argument in base 10.
Description
Returns a new String object representing the specified integer. The radix is assumed to be 10.


 Long.toString

Long.toString

Syntax
public String toString()
Returns
a string representation of this object in base 10.
Description
Returns a String object representing this Long's value.

Overrides
toString in class Object


 Long.valueOf

Long.valueOf

Syntax 1
public static Long valueOf( String s, int radix ) throws NumberFormatException
Parameters
s
the String containing the long.
radix
the radix to be used.
Returns
a newly constructed Long initialized to the value represented by the string argument in the specified radix.
Description
Returns a new long object initialized to the value of the specified String. Throws an exception if the String cannot be parsed as a long.

Exceptions
NumberFormatException If the String does not contain a parsable long.

Syntax 2
public static Long valueOf( String s ) throws NumberFormatException
Parameters
s
the string to be parsed.
Returns
a newly constructed Long initialized to the value represented by the string argument.
Description
Returns a new long object initialized to the value of the specified String. Throws an exception if the String cannot be parsed as a long. The radix is assumed to be 10.

Exceptions
NumberFormatException If the String does not contain a parsable long.


 Class Math

Class java.lang.Math

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Math

public final class Math
extends Object

The class Math contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions.

To help ensure portability of Java programs, the definitions of many of the numeric functions in this package require that they produce the same results as certain published algorithms. These algorithms are available from the well-known network library netlib as the package "Freely Distributable Math Library" (fdlibm). These algorithms, which are written in the C programming language, are then to be understood as executed with all floating-point operations following the rules of Java floating-point arithmetic.

The network library may be found on the World Wide Web at

    http://netlib.att.com/

then perform a keyword search for "fdlibm".

The Java math library is defined with respect to the version of fdlibm dated January 4, 1995. Where fdlibm provides more than one definition for a function (such as acos), use the "IEEE 754 core function" version (residing in a file whose name begins with the letter e).


 Math Members

Math Members

Class Overview | This Package | All Packages

Fields
Name | Description
E | The double value that is closer than any other to e, the base of the natural logarithms.
PI | The double value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter.

Methods
Name | Description
abs(double) | Returns the absolute value of a double value.
abs(float) | Returns the absolute value of a float value.
abs(int) | Returns the absolute value of an int value.
abs(long) | Returns the absolute value of a long value.
acos(double) | Returns the arc cosine of an angle, in the range of 0.0 through pi.
asin(double) | Returns the arc sine of an angle, in the range of -pi/2 through pi/2.
atan(double) | Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.
atan2(double, double) | Converts rectangular coordinates (b, a) to polar (r, theta).
ceil(double) | Returns the smallest (closest to negative infinity) double value that is not less than the argument and is equal to a mathematical integer.
cos(double) | Returns the trigonometric cosine of an angle.
exp(double) | Returns the exponential number e (i.e., 2.718...) raised to the power of a double value.
floor(double) | Returns the largest (closest to positive infinity) double value that is not greater than the argument and is equal to a mathematical integer.
IEEEremainder(double, double) | Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard.
log(double) | Returns the natural logarithm (base e) of a double value.
max(double, double) | Returns the greater of two double values.
max(float, float) | Returns the greater of two float values.
max(int, int) | Returns the greater of two int values.
max(long, long) | Returns the greater of two long values.
min(double, double) | Returns the smaller of two double values.
min(float, float) | Returns the smaller of two float values.
min(int, int) | Returns the smaller of two int values.
min(long, long) | Returns the smaller of two long values.
pow(double, double) | Returns of value of the first argument raised to the power of the second argument.
random() | Returns a random number between 0.0 and 1.0.
rint(double) | returns the closest integer to the argument.
round(double) | Returns the closest long to the argument.
round(float) | Returns the closest int to the argument.
sin(double) | Returns the trigonometric sine of an angle.
sqrt(double) | Returns the square root of a double value.
tan(double) | Returns the trigonometric tangent of an angle.


 Math.E

Math.E

Syntax
public static final double E
Description
The double value that is closer than any other to e, the base of the natural logarithms.


 Math.PI

Math.PI

Syntax
public static final double PI
Description
The double value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter.


 Math.abs

Math.abs

Syntax 1
public static int abs( int a )
Parameters
a
an int value.
Returns
the absolute value of the argument.
Description
Returns the absolute value of an int value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.

Note that if the argument is equal to the value of Integer.MIN_VALUE, the most negative representable int value, the result is that same value, which is negative.

See Also
MIN_VALUE

Syntax 2
public static long abs( long a )
Parameters
a
a long value.
Returns
the absolute value of the argument.
Description
Returns the absolute value of a long value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.

Note that if the argument is equal to the value of Long.MIN_VALUE, the most negative representable long value, the result is that same value, which is negative.

See Also
MIN_VALUE

Syntax 3
public static float abs( float a )
Parameters
a
a float value.
Returns
the absolute value of the argument.
Description
Returns the absolute value of a float value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.

Syntax 4
public static double abs( double a )
Parameters
a
a double value.
Returns
the absolute value of the argument.
Description
Returns the absolute value of a double value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.


 Math.acos

Math.acos

Syntax
public static native double acos( double a )
Parameters
a
an angle, in radians.
Returns
the arc cosine of the argument.
Description
Returns the arc cosine of an angle, in the range of 0.0 through pi.


 Math.asin

Math.asin

Syntax
public static native double asin( double a )
Parameters
a
an angle, in radians.
Returns
the arc sine of the argument.
Description
Returns the arc sine of an angle, in the range of -pi/2 through pi/2.


 Math.atan

Math.atan

Syntax
public static native double atan( double a )
Parameters
a
an angle, in radians.
Returns
the arc tangent of the argument.
Description
Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.


 Math.atan2

Math.atan2

Syntax
public static native double atan2( double a, double b )
Parameters
a
a double value.
b
a double value.
Returns
the theta component of the point (r, theta) in polar coordinates that corresponds to the point (b, a) in Cartesian coordinates.
Description
Converts rectangular coordinates (b, a) to polar (r, theta). This method computes the phase theta by computing an arc tangent of b/a in the range of -pi to pi.


 Math.ceil

Math.ceil

Syntax
public static native double ceil( double a )
Parameters
a
a double value.
Returns
the smallest (closest to negative infinity) double value that is not less than the argument and is equal to a mathematical integer.
Description
Returns the smallest (closest to negative infinity) double value that is not less than the argument and is equal to a mathematical integer.


 Math.cos

Math.cos

Syntax
public static native double cos( double a )
Parameters
a
an angle, in radians.
Returns
the cosine of the argument.
Description
Returns the trigonometric cosine of an angle.


 Math.exp

Math.exp

Syntax
public static native double exp( double a )
Parameters
a
a double value.
Returns
the value ea, where e is the base of the natural logarithms.
Description
Returns the exponential number e (i.e., 2.718...) raised to the power of a double value.


 Math.floor

Math.floor

Syntax
public static native double floor( double a )
Parameters
a
a double value.
a
an assigned value.
Returns
the largest (closest to positive infinity) double value that is not greater than the argument and is equal to a mathematical integer.
Description
Returns the largest (closest to positive infinity) double value that is not greater than the argument and is equal to a mathematical integer.


 Math.IEEEremainder

Math.IEEEremainder

Syntax
public static native double IEEEremainder( double f1, double f2 )
Parameters
f1
the dividend.
f2
the divisor.
Returns
the remainder when f1 is divided by f2.
Description
Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard. The remainder value is mathematically equal to f1 - f2 × n, where n is the mathematical integer closest to the exact mathematical value of the quotient f1/f2, and if two mathematical integers are equally close to f1/f2, then n is the integer that is even. If the remainder is zero, its sign is the same as the sign of the first argument.


 Math.log

Math.log

Syntax
public static native double log( double a )
Parameters
a
a number greater than 0.0.
Returns
the value ln a, the natural logarithm of a.
Description
Returns the natural logarithm (base e) of a double value.


 Math.max

Math.max

Syntax 1
public static int max( int a, int b )
Parameters
a
an int value.
b
an int value.
Returns
the larger of a and b.
Description
Returns the greater of two int values.

Syntax 2
public static long max( long a, long b )
Parameters
a
a long value.
b
a long value.
Returns
the larger of a and b.
Description
Returns the greater of two long values.

Syntax 3
public static float max( float a, float b )
Parameters
a
a float value.
b
a float value.
Returns
the larger of a and b.
Description
Returns the greater of two float values. If either value is NaN, then the result is NaN. Unlike the the numerical comparison operators, this method considers negative zero to be strictly smaller than positive zero.

Syntax 4
public static double max( double a, double b )
Parameters
a
a double value.
b
a double value.
Returns
the larger of a and b.
Description
Returns the greater of two double values. If either value is NaN, then the result is NaN. Unlike the the numerical comparison operators, this method considers negative zero to be strictly smaller than positive zero.


 Math.min

Math.min

Syntax 1
public static int min( int a, int b )
Parameters
a
an int value.
b
an int value.
Returns
the smaller of a and b.
Description
Returns the smaller of two int values.

Syntax 2
public static long min( long a, long b )
Parameters
a
a long value.
b
a long value.
Returns
the smaller of a and b.
Description
Returns the smaller of two long values.

Syntax 3
public static float min( float a, float b )
Parameters
a
a float value.
b
a float value.
Returns
the smaller of a and b.
Description
Returns the smaller of two float values. If either value is NaN, then the result is NaN. Unlike the the numerical comparison operators, this method considers negative zero to be strictly smaller than positive zero.

Syntax 4
public static double min( double a, double b )
Parameters
a
a double value.
b
a double value.
Returns
the smaller of a and b.
Description
Returns the smaller of two double values. If either value is NaN, then the result is NaN. Unlike the the numerical comparison operators, this method considers negative zero to be strictly smaller than positive zero.


 Math.pow

Math.pow

Syntax
public static native double pow( double a, double b )
Parameters
a
a double value.
b
a double value.
Returns
the value ab.
Description
Returns of value of the first argument raised to the power of the second argument.

If (a == 0.0), then b must be greater than 0.0; otherwise an exception is thrown. An exception also will occur if (a <= 0.0) and b is not equal to a whole number.

Exceptions
ArithmeticException if (a == 0.0) and (b <= 0.0), or if (a <= 0.0) and b is not equal to a whole number.


 Math.random

Math.random

Syntax
public static synchronized double random()
Returns
a pseudorandom double between 0.0 and 1.0.
Description
Returns a random number between 0.0 and 1.0. Random number generators are often referred to as pseudorandom number generators because the numbers produced tend to repeat themselves after a period of time.

See Also
nextDouble


 Math.rint

Math.rint

Syntax
public static native double rint( double a )
Parameters
a
a double value.
Returns
the closest double value to a that is equal to a mathematical integer. If two double values that are mathematical integers are equally close to the value of the argument, the result is the integer value that is even.
Description
returns the closest integer to the argument.


 Math.round

Math.round

Syntax 1
public static int round( float a )
Parameters
a
a float value.
Returns
the value of the argument rounded to the nearest int value.
Description
Returns the closest int to the argument.

If the argument is negative infinity or any value less than or equal to the value of Integer.MIN_VALUE, the result is equal to the value of Integer.MIN_VALUE.

If the argument is positive infinity or any value greater than or equal to the value of Integer.MAX_VALUE, the result is equal to the value of Integer.MAX_VALUE.

See Also
MAX_VALUE, MIN_VALUE

Syntax 2
public static long round( double a )
Parameters
a
a double value.
Returns
the value of the argument rounded to the nearest long value.
Description
Returns the closest long to the argument.

If the argument is negative infinity or any value less than or equal to the value of Long.MIN_VALUE, the result is equal to the value of Long.MIN_VALUE.

If the argument is positive infinity or any value greater than or equal to the value of Long.MAX_VALUE, the result is equal to the value of Long.MAX_VALUE.

See Also
MAX_VALUE, MIN_VALUE


 Math.sin

Math.sin

Syntax
public static native double sin( double a )
Parameters
a
an angle, in radians.
Returns
the sine of the argument.
Description
Returns the trigonometric sine of an angle.


 Math.sqrt

Math.sqrt

Syntax
public static native double sqrt( double a )
Parameters
a
a double value.
Returns
the square root of a. If the argument is NaN or less than zero, the result is NaN.
Description
Returns the square root of a double value.


 Math.tan

Math.tan

Syntax
public static native double tan( double a )
Parameters
a
an angle, in radians.
Returns
the tangent of the argument.
Description
Returns the trigonometric tangent of an angle.


 Class NegativeArraySizeException

Class java.lang.NegativeArraySizeException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.lang.NegativeArraySizeException

public class NegativeArraySizeException
extends RuntimeException

Thrown if an application tries to create an array with negative size.


 NegativeArraySizeException Members

NegativeArraySizeException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
NegativeArraySizeException() | Constructs a NegativeArraySizeException with no detail message.
NegativeArraySizeException(String) | Constructs a NegativeArraySizeException with the specified detail message.


 NegativeArraySizeException.NegativeArraySizeException

NegativeArraySizeException.NegativeArraySizeException

Syntax 1
public NegativeArraySizeException()
Description
Constructs a NegativeArraySizeException with no detail message.

Syntax 2
public NegativeArraySizeException( String s )
Parameters
s
the detail message.
Description
Constructs a NegativeArraySizeException with the specified detail message.


 Class NoClassDefFoundError

Class java.lang.NoClassDefFoundError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.LinkageError
                           |
                           +----java.lang.NoClassDefFoundError

public class NoClassDefFoundError
extends LinkageError

Thrown if the Java Virtual Machine or a classloader tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.

The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.


 NoClassDefFoundError Members

NoClassDefFoundError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
NoClassDefFoundError() | Constructs a NoClassDefFoundError with no detail message.
NoClassDefFoundError(String) | Constructs a NoClassDefFoundError with the specified detail message.


 NoClassDefFoundError.NoClassDefFoundError

NoClassDefFoundError.NoClassDefFoundError

Syntax 1
public NoClassDefFoundError()
Description
Constructs a NoClassDefFoundError with no detail message.

Syntax 2
public NoClassDefFoundError( String s )
Parameters
s
the detail message.
Description
Constructs a NoClassDefFoundError with the specified detail message.


 Class NoSuchFieldError

Class java.lang.NoSuchFieldError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.LinkageError
                           |
                           +----java.lang.IncompatibleClassChangeError
                                   |
                                   +----java.lang.NoSuchFieldError

public class NoSuchFieldError
extends IncompatibleClassChangeError

Thrown if an application tries to access or modify a specified field of an object, and that object no longer has that field.

Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed.


 NoSuchFieldError Members

NoSuchFieldError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
NoSuchFieldError() | Constructs a NoSuchFieldException with no detail message.
NoSuchFieldError(String) | Constructs a NoSuchFieldException with the specified detail message.


 NoSuchFieldError.NoSuchFieldError

NoSuchFieldError.NoSuchFieldError

Syntax 1
public NoSuchFieldError()
Description
Constructs a NoSuchFieldException with no detail message.

Syntax 2
public NoSuchFieldError( String s )
Parameters
s
the detail message.
Description
Constructs a NoSuchFieldException with the specified detail message.


 Class NoSuchFieldException

Class java.lang.NoSuchFieldException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.NoSuchFieldException

public class NoSuchFieldException
extends Exception

Signals that the class doesn't have a field of a specified name.


 NoSuchFieldException Members

NoSuchFieldException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
NoSuchFieldException() | Constructor.
NoSuchFieldException(String) | Constructor with a detail message.


 NoSuchFieldException.NoSuchFieldException

NoSuchFieldException.NoSuchFieldException

Syntax 1
public NoSuchFieldException()
Description
Constructor.

Syntax 2
public NoSuchFieldException( String s )
Description
Constructor with a detail message.


 Class NoSuchMethodError

Class java.lang.NoSuchMethodError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.LinkageError
                           |
                           +----java.lang.IncompatibleClassChangeError
                                   |
                                   +----java.lang.NoSuchMethodError

public class NoSuchMethodError
extends IncompatibleClassChangeError

Thrown if an application tries to call a specified method of a class (either static or instance), and that class no longer has a definition of that method.

Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed.


 NoSuchMethodError Members

NoSuchMethodError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
NoSuchMethodError() |
NoSuchMethodError(String) | Constructs a NoSuchMethodException with the specified detail message.


 NoSuchMethodError.NoSuchMethodError

NoSuchMethodError.NoSuchMethodError

Syntax 1
public NoSuchMethodError()

Syntax 2
public NoSuchMethodError( String s )
Parameters
s
the detail message.
Description
Constructs a NoSuchMethodException with the specified detail message.


 Class NoSuchMethodException

Class java.lang.NoSuchMethodException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.NoSuchMethodException

public class NoSuchMethodException
extends Exception

Thrown when a particular method cannot be found.


 NoSuchMethodException Members

NoSuchMethodException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
NoSuchMethodException() | Constructs a NoSuchMethodException without a detail message.
NoSuchMethodException(String) | Constructs a NoSuchMethodException with a detail message.


 NoSuchMethodException.NoSuchMethodException

NoSuchMethodException.NoSuchMethodException

Syntax 1
public NoSuchMethodException()
Description
Constructs a NoSuchMethodException without a detail message.

Syntax 2
public NoSuchMethodException( String s )
Parameters
s
the detail message.
Description
Constructs a NoSuchMethodException with a detail message.


 Class NullPointerException

Class java.lang.NullPointerException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.lang.NullPointerException

public class NullPointerException
extends RuntimeException

Thrown when an application attempts to use null in a case where an object is required. These include:

  • Calling the instance method of a null object.
  • Accessing or modifying the field of a null object.
  • Taking the length of null as if it were an array.
  • Accessing or modifying the slots of null as if it were an array.
  • Throwing null as if it were a Throwable value.

Applications should throw instances of this class to indicate other illegal uses of the null object.


 NullPointerException Members

NullPointerException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
NullPointerException() | Constructs a NullPointerException with no detail message.
NullPointerException(String) | Constructs a NullPointerException with the specified detail message.


 NullPointerException.NullPointerException

NullPointerException.NullPointerException

Syntax 1
public NullPointerException()
Description
Constructs a NullPointerException with no detail message.

Syntax 2
public NullPointerException( String s )
Parameters
s
the detail message.
Description
Constructs a NullPointerException with the specified detail message.


 Class Number

Class java.lang.Number

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Number

public abstract class Number
extends Object
implements Serializable

The abstract class Number is the superclass of classes Byte, Double, Float, Integer, Long, and Short.

Subclasses of Number must provide methods to convert the represented numeric value to byte, double, float, int, long, and short.

See Also:
Byte, Double, Float, Integer, Long, Short


 Number Members

Number Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Number() |

Methods
Name | Description
byteValue() | Returns the value of the specified number as a byte.
doubleValue() | Returns the value of the specified number as a double.
floatValue() | Returns the value of the specified number as a float.
intValue() | Returns the value of the specified number as an int.
longValue() | Returns the value of the specified number as a long.
shortValue() | Returns the value of the specified number as a short.


 Number.Number

Number.Number

Syntax
public Number()


 Number.byteValue

Number.byteValue

Syntax
public byte byteValue()
Returns
the numeric value represented by this object after conversion to type byte.
Description
Returns the value of the specified number as a byte. This may involve rounding or truncation.


 Number.doubleValue

Number.doubleValue

Syntax
public abstract double doubleValue()
Returns
the numeric value represented by this object after conversion to type double.
Description
Returns the value of the specified number as a double. This may involve rounding.


 Number.floatValue

Number.floatValue

Syntax
public abstract float floatValue()
Returns
the numeric value represented by this object after conversion to type float.
Description
Returns the value of the specified number as a float. This may involve rounding.


 Number.intValue

Number.intValue

Syntax
public abstract int intValue()
Returns
the numeric value represented by this object after conversion to type int.
Description
Returns the value of the specified number as an int. This may involve rounding.


 Number.longValue

Number.longValue

Syntax
public abstract long longValue()
Returns
the numeric value represented by this object after conversion to type long.
Description
Returns the value of the specified number as a long. This may involve rounding.


 Number.shortValue

Number.shortValue

Syntax
public short shortValue()
Returns
the numeric value represented by this object after conversion to type short.
Description
Returns the value of the specified number as a short. This may involve rounding or truncation.


 Class NumberFormatException

Class java.lang.NumberFormatException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.lang.IllegalArgumentException
                                   |
                                   +----java.lang.NumberFormatException

public class NumberFormatException
extends IllegalArgumentException

Thrown to indicate that the application has attempted to convert a string to one of the numeric types, but that the string does not have the appropriate format.

See Also:
toString


 NumberFormatException Members

NumberFormatException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
NumberFormatException() | Constructs a NumberFormatException with no detail message.
NumberFormatException(String) | Constructs a NumberFormatException with the specified detail message.


 NumberFormatException.NumberFormatException

NumberFormatException.NumberFormatException

Syntax 1
public NumberFormatException()
Description
Constructs a NumberFormatException with no detail message.

Syntax 2
public NumberFormatException( String s )
Parameters
s
the detail message.
Description
Constructs a NumberFormatException with the specified detail message.


 Class Object

Class java.lang.Object

Class Members | This Package | All Packages
java.lang.Object

public class Object

Class Object is the root of the class hierarchy. Every class has Object as a superclass. All objects, including arrays, implement the methods of this class.

See Also:
Class


 Object Members

Object Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Object() |

Methods
Name | Description
clone() | Creates a new object of the same class as this object.
equals(Object) | Compares two Objects for equality.
finalize() | Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
getClass() | Returns the runtime class of an object.
hashCode() | Returns a hash code value for the object.
notify() | Wakes up a single thread that is waiting on this object's monitor.
notifyAll() | Wakes up all threads that are waiting on this object's monitor.
toString() | Returns a string representation of the object.
wait() | Waits to be notified by another thread of a change in this object.
wait(long) | Waits to be notified by another thread of a change in this object.
wait(long, int) | Waits to be notified by another thread of a change in this object.


 Object.Object

Object.Object

Syntax
public Object()


 Object.clone

Object.clone

Syntax
protected native Object clone() throws CloneNotSupportedException
Returns
a clone of this instance.
Description
Creates a new object of the same class as this object. It then initializes each of the new object's fields by assigning it the same value as the corresponding field in this object. No constructor is called.

The clone method of class Object will only clone an object whose class indicates that it is willing for its instances to be cloned. A class indicates that its instances can be cloned by declaring that it implements the Cloneable interface.

Exceptions
CloneNotSupportedException if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.
Exceptions
OutOfMemoryError if there is not enough memory.
See Also
Cloneable


 Object.equals

Object.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the reference object with which to compare.
Returns
true if this object is the same as the obj argument; false otherwise.
Description
Compares two Objects for equality.

The equals method implements an equivalence relation:

  • It is reflexive: for any reference value x, x.equals(x) should return true.
  • It is symmetric: for any reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any reference values x,
     y, and z, if x.equals(y)
     returns  true and y.equals(z) returns
     true, then x.equals(z) should return
     true.
  • It is consistent: for any reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false.
  • For any reference value x, x.equals(null) should return false.

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values x and y, this method returns true if and only if x and y refer to the same object (x==y has the value true).

See Also
hashCode, Hashtable


 Object.finalize

Object.finalize

Syntax
protected void finalize() throws Throwable
Description
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the finalize method to dispose of system resources or to perform other cleanup.

Any exception thrown by the finalize method causes the finalization of this object to be halted, but is otherwise ignored.

The finalize method in Object does nothing.

Exceptions
Throwable [Need description!]


 Object.getClass

Object.getClass

Syntax
public final native Class getClass()
Returns
the object of type Class that represents the runtime class of the object.
Description
Returns the runtime class of an object.


 Object.hashCode

Object.hashCode

Syntax
public native int hashCode()
Returns
a hash code value for this object.
Description
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.

See Also
equals, Hashtable


 Object.notify

Object.notify

Syntax
public final native void notify()
Description
Wakes up a single thread that is waiting on this object's monitor. A thread waits on an object's monitor by calling one of the wait methods.

This method should only be called by a thread that is the owner of this object's monitor. A thread becomes the owner of the object's monitor in one of three ways:

  • By executing a synchronized instance method of that object.
  • By executing the body of a synchronized statement that synchronizes on the object.
  • For objects of type Class, by executing a synchronized static method of that class.

Only one thread at a time can own an object's monitor.

Exceptions
IllegalMonitorStateException if the current thread is not the owner of this object's monitor.
See Also
notifyAll, wait


 Object.notifyAll

Object.notifyAll

Syntax
public final native void notifyAll()
Description
Wakes up all threads that are waiting on this object's monitor. A thread waits on an object's monitor by calling one of the wait methods.

This method should only be called by a thread that is the owner of this object's monitor. See the notify method for a description of the ways in which a thread can become the owner of a monitor.

Exceptions
IllegalMonitorStateException if the current thread is not the owner of this object's monitor.
See Also
notify, wait


 Object.toString

Object.toString

Syntax
public String toString()
Returns
a string representation of the object.
Description
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommendedthat all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object.


 Object.wait

Object.wait

Syntax 1
public final native void wait( long timeout ) throws InterruptedException
Parameters
timeout
the maximum time to wait in milliseconds.
Description
Waits to be notified by another thread of a change in this object.

The current thread must own this object's monitor. The thread releases ownership of this monitor and waits until either of the following two conditions has occurred:

  • Another thread notifies threads waiting on this object's monitor to wake up either through a call to the notify method or the notifyAll method.
  • The timeout period, specified by the timeout argument in milliseconds, has elapsed.

The thread then waits until it can re-obtain ownership of the monitor and resumes execution.

This method should only be called by a thread that is the owner of this object's monitor. See the notify method for a description of the ways in which a thread can become the owner of a monitor.

Exceptions
IllegalArgumentException if the value of timeout is negative.
Exceptions
IllegalMonitorStateException if the current thread is not the owner of the object's monitor.
Exceptions
InterruptedException if another thread has interrupted this thread.
See Also
notify, notifyAll

Syntax 2
public final void wait( long timeout, int nanos ) throws InterruptedException
Parameters
timeout
the maximum time to wait in milliseconds.
nano
additional time, in nanoseconds range 0-999999.
Description
Waits to be notified by another thread of a change in this object.

This method is similar to the wait method of one argument, but it allows finer control over the amount of time to wait for a notification before giving up.

The current thread must own this object's monitor. The thread releases ownership of this monitor and waits until either of the following two conditions has occurred:

  • Another thread notifies threads waiting on this object's monitor to wake up either through a call to the notify method or the notifyAll method.
  • The timeout period, specified by timeout milliseconds plus nanos nanoseconds arguments, has elapsed.

The thread then waits until it can re-obtain ownership of the monitor and resumes execution

This method should only be called by a thread that is the owner of this object's monitor. See the notify method for a description of the ways in which a thread can become the owner of a monitor.

Exceptions
IllegalArgumentException if the value of timeout is negative or the value of nanos is not in the range 0-999999.
Exceptions
IllegalMonitorStateException if the current thread is not the owner of this object's monitor.
Exceptions
InterruptedException if another thread has interrupted this thread.

Syntax 3
public final void wait() throws InterruptedException
Description
Waits to be notified by another thread of a change in this object.

The current thread must own this object's monitor. The thread releases ownership of this monitor and waits until another thread notifies threads waiting on this object's monitor to wake up either through a call to the notify method or the notifyAll method. The thread then waits until it can re-obtain ownership of the monitor and resumes execution.

This method should only be called by a thread that is the owner of this object's monitor. See the notify method for a description of the ways in which a thread can become the owner of a monitor.

Exceptions
IllegalMonitorStateException if the current thread is not the owner of the object's monitor.
Exceptions
InterruptedException if another thread has interrupted this thread.
See Also
notify, notifyAll


 Class OutOfMemoryError

Class java.lang.OutOfMemoryError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.VirtualMachineError
                           |
                           +----java.lang.OutOfMemoryError

public class OutOfMemoryError
extends VirtualMachineError

Thrown when the Java Virtual Machine cannot allocate an object because it is out of memory, and no more memory could be made available by the garbage collector.


 OutOfMemoryError Members

OutOfMemoryError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
OutOfMemoryError() | Constructs an OutOfMemoryError with no detail message.
OutOfMemoryError(String) | Constructs an OutOfMemoryError with the specified detail message.


 OutOfMemoryError.OutOfMemoryError

OutOfMemoryError.OutOfMemoryError

Syntax 1
public OutOfMemoryError()
Description
Constructs an OutOfMemoryError with no detail message.

Syntax 2
public OutOfMemoryError( String s )
Parameters
s
the detail message.
Description
Constructs an OutOfMemoryError with the specified detail message.


 Class Process

Class java.lang.Process

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Process

public abstract class Process
extends Object

The exec methods return an instance of a subclass of Process that can be used to control the process and obtain information about it.

The subprocess is not killed when there are no more references to the Process object, but rather the subprocess continues executing asynchronously.

See Also:
exec, exec, exec, exec


 Process Members

Process Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Process() |

Methods
Name | Description
destroy() | Kills the subprocess.
exitValue() | Returns the exit value for the subprocess.
getErrorStream() | Gets the error stream of the subprocess.
getInputStream() | Gets the input stream of the subprocess.
getOutputStream() | Gets the output stream of the subprocess.
waitFor() | Waits for the subprocess to complete.


 Process.Process

Process.Process

Syntax
public Process()


 Process.destroy

Process.destroy

Syntax
public abstract void destroy()
Description
Kills the subprocess.


 Process.exitValue

Process.exitValue

Syntax
public abstract int exitValue()
Returns
the exit value of the subprocess.
Description
Returns the exit value for the subprocess.

Exceptions
IllegalThreadStateException if the subprocess has not yet terminated.


 Process.getErrorStream

Process.getErrorStream

Syntax
public abstract InputStream getErrorStream()
Returns
the input stream connected to the error stream of the subprocess.
Description
Gets the error stream of the subprocess. This stream is usually unbuffered.


 Process.getInputStream

Process.getInputStream

Syntax
public abstract InputStream getInputStream()
Returns
the input stream connected to the normal output of the subprocess.
Description
Gets the input stream of the subprocess. This stream is usually buffered.


 Process.getOutputStream

Process.getOutputStream

Syntax
public abstract OutputStream getOutputStream()
Returns
the output stream connected to the normal input of the subprocess.
Description
Gets the output stream of the subprocess. This stream is usually buffered.


 Process.waitFor

Process.waitFor

Syntax
public abstract int waitFor() throws InterruptedException
Returns
the exit value of the process.
Description
Waits for the subprocess to complete. This method returns immediately if the subprocess has already terminated. If the subprocess has not yet terminated, the calling thread will be blocked until the subprocess exits.

Exceptions
InterruptedException if the waitFor was interrupted.


 Interface Runnable

Interface java.lang.Runnable

Interface Members | This Package | All Packages

public interface Runnable

The Runnable interface should be implemented by any class whose instances are intended to be executed by a thread. The class must define a method of no arguments called run.

This interface is designed to provide a common protocol for objects that wish to execute code while they are active. For example, Runnable is implemented by class Thread. Being active simply means that a thread has been started and has not yet been stopped.

In addition, Runnable provides the means for a class to be active while not subclassing Thread. A class that implements Runnable can run without subclassing Thread by instantiating a ,code>Thread instance and passing itself in as the target. In most cases, the Runnable interface should be used if you are only planning to override the run() method and no other Thread methods. This is important because classes should not be subclassed unless the programmer intends on modifying or enhancing the fundamental behavior of the class.

See Also:
Thread


 Runnable Members

Runnable Members

Interface Overview | This Package | All Packages

Methods
Name | Description
run() | When an object implementing interface Runnable is used to create a thread, starting the thread causes the object's run method to be called in that separately executing thread.


 Runnable.run

Runnable.run

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void run()
Description
When an object implementing interface Runnable is used to create a thread, starting the thread causes the object's run method to be called in that separately executing thread.

See Also
run


 Class Runtime

Class java.lang.Runtime

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Runtime

public class Runtime
extends Object


 Runtime Members

Runtime Members

Class Overview | This Package | All Packages

Methods
Name | Description
exec(String) | Executes the specified string command in a separate process.
exec(String, String[]) | Executes the specified string command in a separate process with the specified environment.
exec(String[]) | Executes the specified command and arguments in a separate process.
exec(String[], String[]) | Executes the specified command and arguments in a separate process with the specified environment.
exit(int) | Terminates the currently running Java Virtual Machine.
freeMemory() | Returns the amount of free memory in the system.
gc() | Runs the garbage collector.
getLocalizedInputStream(InputStream) | Creates a localized version of an input stream. Deprecated.
getLocalizedOutputStream(OutputStream) | Creates a localized version of an output stream. Deprecated.
getRuntime() | Returns the runtime object associated with the current Java application.
load(String) | Loads the specified filename as a dynamic library.
loadLibrary(String) | Loads the dynamic library with the specified library name.
runFinalization() | Runs the finalization methods of any objects pending finalization.
runFinalizersOnExit(boolean) | Enable or disable finalization on exit; doing so specifies that the finalizers of all objects that have finalizers that have not yet been automatically invoked are to be run before the Java runtime exits.
totalMemory() | Returns the total amount of memory in the Java Virtual Machine.
traceInstructions(boolean) | Enables/Disables tracing of instructions.
traceMethodCalls(boolean) | Enables/Disables tracing of method calls.


 Runtime.exec

Runtime.exec

Syntax 1
public Process exec( String command ) throws IOException
Parameters
command
a specified system command.
Returns
a Process object for managing the subprocess.
Description
Executes the specified string command in a separate process.

The command argument is parsed into tokens and then executed as a command in a separate process. This method has exactly the same effect as exec(command, null).

Exceptions
SecurityException if the current thread cannot create a subprocess.
See Also
exec

Syntax 2
public Process exec( String command, String envp[] ) throws IOException
Parameters
command
a specified system command.
envp
array containing environment in format name=value
Returns
a Process object for managing the subprocess.
Description
Executes the specified string command in a separate process with the specified environment.

This method breaks the command string into tokens and creates a new array cmdarray containing the tokens; it then performs the call exec(cmdarray, envp).

Exceptions
SecurityException if the current thread cannot create a subprocess.
See Also
exec

Syntax 3
public Process exec( String cmdarray[] ) throws IOException
Parameters
cmdarray
array containing the command to call and its arguments.
Returns
a Process object for managing the subprocess.
Description
Executes the specified command and arguments in a separate process.

The command specified by the tokens in cmdarray is executed as a command in a separate process. This has exactly the same effect as exec(cmdarray, null).

Exceptions
SecurityException if the current thread cannot create a subprocess.
See Also
exec

Syntax 4
public Process exec( String cmdarray[], String envp[] ) throws IOException
Parameters
cmdarray
array containing the command to call and its arguments.
envp
array containing environment in format name=value.
Returns
a Process object for managing the subprocess.
Description
Executes the specified command and arguments in a separate process with the specified environment.

If there is a security manager, its checkExec method is called with the first component of the array cmdarray as its argument. This may result in a security exception.

Given an array of strings cmdarray, representing the tokens of a command line, and an array of strings envp, representing an "environment" that defines system properties, this method creates a new process in which to execute the specified command.

Exceptions
SecurityException if the current thread cannot create a subprocess.
See Also
SecurityException, checkExec


 Runtime.exit

Runtime.exit

Syntax
public void exit( int status )
Parameters
status
exit status.
Description
Terminates the currently running Java Virtual Machine. This method never returns normally.

If there is a security manager, its checkExit method is called with the status as its argument. This may result in a security exception.

The argument serves as a status code; by convention, a nonzero status code indicates abnormal termination.

Exceptions
SecurityException if the current thread cannot exit with the specified status.
See Also
SecurityException, checkExit


 Runtime.freeMemory

Runtime.freeMemory

Syntax
public native long freeMemory()
Returns
an approximation to the total amount of memory currently available for future allocated objects, measured in bytes.
Description
Returns the amount of free memory in the system. The value returned by this method is always less than the value returned by the totalMemory method. Calling the gc method may result in increasing the value returned by freeMemory.


 Runtime.gc

Runtime.gc

Syntax
public native void gc()
Description
Runs the garbage collector. Calling this method suggests that the Java Virtual Machine expend effort toward recycling unused objects in order to make the memory they currently occupy available for quick reuse. When control returns from the method call, the Java Virtual Machine has made its best effort to recycle all unused objects.

The name gc stands for "garbage collector". The Java Virtual Machine performs this recycling process automatically as needed even if the gc method is not invoked explicitly.


 Runtime.getLocalizedInputStream

Runtime.getLocalizedInputStream

Syntax
public InputStream getLocalizedInputStream( InputStream in )
Returns
a localized input stream.
Description
Note: getLocalizedInputStream() is deprecated. As of JDK 1.1, the preferred way translate a byte stream in the local encoding into a character stream in Unicode is via the InputStreamReader and BufferedReader classes.

Creates a localized version of an input stream. This method takes an InputStream and returns an InputStream equivalent to the argument in all respects except that it is localized: as characters in the local character set are read from the stream, they are automatically converted from the local character set to Unicode.

If the argument is already a localized stream, it may be returned as the result.

See Also
InputStream, BufferedReader, InputStreamReader


 Runtime.getLocalizedOutputStream

Runtime.getLocalizedOutputStream

Syntax
public OutputStream getLocalizedOutputStream( OutputStream out )
Returns
a localized output stream.
Description
Note: getLocalizedOutputStream() is deprecated. As of JDK 1.1, the preferred way to translate a Unicode character stream into a byte stream in the local encoding is via the OutputStreamWriter, BufferedWriter, and PrintWriter classes.

Creates a localized version of an output stream. This method takes an OutputStream and returns an OutputStream equivalent to the argument in all respects except that it is localized: as Unicode characters are written to the stream, they are automatically converted to the local character set.

If the argument is already a localized stream, it may be returned as the result.

See Also
OutputStream, BufferedWriter, OutputStreamWriter, PrintWriter


 Runtime.getRuntime

Runtime.getRuntime

Syntax
public static Runtime getRuntime()
Returns
the Runtime object associated with the current Java application.
Description
Returns the runtime object associated with the current Java application.


 Runtime.load

Runtime.load

Syntax
public synchronized void load( String filename )
Parameters
filename
the file to load.
Description
Loads the specified filename as a dynamic library. The filename argument must be a complete pathname. From java_g it will automagically insert "_g" before the ".so" (for example Runtime.getRuntime().load("/home/avh/lib/libX11.so");).

If there is a security manager, its checkLink method is called with the filename as its argument. This may result in a security exception.

Exceptions
SecurityException if the current thread cannot load the specified dynamic library.
Exceptions
UnsatisfiedLinkError if the file does not exist.
See Also
getRuntime, SecurityException, checkLink


 Runtime.loadLibrary

Runtime.loadLibrary

Syntax
public synchronized void loadLibrary( String libname )
Parameters
libname
the name of the library.
Description
Loads the dynamic library with the specified library name. The mapping from a library name to a specific filename is done in a system-specific manner.

First, if there is a security manager, its checkLink method is called with the filename as its argument. This may result in a security exception.

If this method is called more than once with the same library name, the second and subsequent calls are ignored.

Exceptions
SecurityException if the current thread cannot load the specified dynamic library.
Exceptions
UnsatisfiedLinkError if the library does not exist.
See Also
SecurityException, checkLink


 Runtime.runFinalization

Runtime.runFinalization

Syntax
public native void runFinalization()
Description
Runs the finalization methods of any objects pending finalization. Calling this method suggests that the Java Virtual Machine expend effort toward running the finalize methods of objects that have been found to be discarded but whose finalize methods have not yet been run. When control returns from the method call, the Java Virtual Machine has made a best effort to complete all outstanding finalizations.

The Java Virtual Machine performs the finalization process automatically as needed if the runFinalization method is not invoked explicitly.

See Also
finalize


 Runtime.runFinalizersOnExit

Runtime.runFinalizersOnExit

Syntax
public static void runFinalizersOnExit( boolean value )
Description
Enable or disable finalization on exit; doing so specifies that the finalizers of all objects that have finalizers that have not yet been automatically invoked are to be run before the Java runtime exits. By default, finalization on exit is disabled. An invocation of the runFinalizersOnExit method is permitted only if the caller is allowed to exit, and is otherwise rejected by the security manager.

See Also
gc, exit


 Runtime.totalMemory

Runtime.totalMemory

Syntax
public native long totalMemory()
Returns
the total amount of memory currently available for allocating objects, measured in bytes.
Description
Returns the total amount of memory in the Java Virtual Machine.


 Runtime.traceInstructions

Runtime.traceInstructions

Syntax
public native void traceInstructions( boolean on )
Parameters
on
true to enable instruction tracing; false to disable this feature.
Description
Enables/Disables tracing of instructions. If the boolean argument is true, this method asks the Java Virtual Machine to print out a detailed trace of each instruction in the Java Virtual Machine as it is executed. The virtual machine may ignore this request if it does not support this feature. The destination of the trace output is system dependent.

If the boolean argument is false, this method causes the Java Virtual Machine to stop performing the detailed instruction trace it is performing.


 Runtime.traceMethodCalls

Runtime.traceMethodCalls

Syntax
public native void traceMethodCalls( boolean on )
Parameters
on
true to enable instruction tracing; false to disable this feature.
Description
Enables/Disables tracing of method calls. If the boolean argument is true, this method asks the Java Virtual Machine to print out a detailed trace of each method in the Java Virtual Machine as it is called. The virtual machine may ignore this request if it does not support this feature. The destination of the trace output is system dependent.

If the boolean argument is false, this method causes the Java Virtual Machine to stop performing the detailed method trace it is performing.


 Class RuntimeException

Class java.lang.RuntimeException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException

public class RuntimeException
extends Exception

RuntimeException is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtual Machine.

A method is not required to declare in its throws clause any subclasses of RuntimeException that might be thrown during the execution of the method but not caught.


 RuntimeException Members

RuntimeException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
RuntimeException() | Constructs a RuntimeException with no detail message.
RuntimeException(String) | Constructs a RuntimeException with the specified detail message.


 RuntimeException.RuntimeException

RuntimeException.RuntimeException

Syntax 1
public RuntimeException()
Description
Constructs a RuntimeException with no detail message.

Syntax 2
public RuntimeException( String s )
Parameters
s
the detail message.
Description
Constructs a RuntimeException with the specified detail message.


 Class SecurityException

Class java.lang.SecurityException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.lang.SecurityException

public class SecurityException
extends RuntimeException

Thrown by the security manager to indicate a security violation.

See Also:
SecurityManager


 SecurityException Members

SecurityException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
SecurityException() | Constructs a SecurityException with no detail message.
SecurityException(String) | Constructs a SecurityException with the specified detail message.


 SecurityException.SecurityException

SecurityException.SecurityException

Syntax 1
public SecurityException()
Description
Constructs a SecurityException with no detail message.

Syntax 2
public SecurityException( String s )
Parameters
s
the detail message.
Description
Constructs a SecurityException with the specified detail message.


 Class SecurityManager

Class java.lang.SecurityManager

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.SecurityManager

public abstract class SecurityManager
extends Object

The security manager is an abstract class that allows applications to implement a security policy. It allows an application to determine, before performing a possibly unsafe or sensitive operation, what the operation is and whether the operation is being performed by a class created via a class loader rather than installed locally. Classes loaded via a class loader (especially if they have been downloaded over a network) may be less trustworthy than classes from files installed locally. The application can allow or disallow the operation.

The SecurityManager class contains many methods with names that begin with the word check. These methods are called by various methods in the Java libraries before those methods perform certain potentially sensitive operations. The invocation of such a check method typically looks like this:

     SecurityManager security = System.getSecurityManager();
     if (security != null) {
         security.checkXXX(argument,  . . . );
     }

The security manager is thereby given an opportunity to prevent completion of the operation by throwing an exception. A security manager routine simply returns if the operation is permitted, but throws a SecurityException if the operation is not permitted. The only exception to this convention is checkTopLevelWindow, which returns a boolean value.

The current security manager is set by the setSecurityManager method in class System. The current security manager is obtained by the getSecurityManager method.

The default implementation of each of the check XXX methods is to assume that the caller does not have permission to perform the requested operation.

See Also:
ClassLoader, SecurityException, checkTopLevelWindow, getSecurityManager, setSecurityManager


 SecurityManager Members

SecurityManager Members

Class Overview | This Package | All Packages

Fields
Name | Description
inCheck | This field is true if there is a security check in progress; false otherwise.

Constructors
Name | Description
SecurityManager() | Constructs a new SecurityManager.

Methods
Name | Description
checkAccept(String, int) | Throws a SecurityException if the calling thread is not permitted to accept a socket connection from the specified host and port number.
checkAccess(Thread) | Throws a SecurityException if the calling thread is not allowed to modify the thread argument.
checkAccess(ThreadGroup) | Throws a SecurityException if the calling thread is not allowed to modify the thread group argument.
checkAwtEventQueueAccess() | Tests if a client can get access to the AWT event queue.
checkConnect(String, int) | Throws a SecurityException if the calling thread is not allowed to open a socket connection to the specified host and port number.
checkConnect(String, int, Object) | Throws a SecurityException if the specified security context is not allowed to open a socket connection to the specified host and port number.
checkCreateClassLoader() | Throws a SecurityException if the calling thread is not allowed to create a new class loader.
checkDelete(String) | Throws a SecurityException if the calling thread is not allowed to delete the specified file.
checkExec(String) | Throws a SecurityException if the calling thread is not allowed to create a subprocss.
checkExit(int) | Throws a SecurityException if the calling thread is not allowed to cause the Java Virtual Machine to halt with the specified status code.
checkLink(String) | Throws a SecurityException if the calling thread is not allowed to dynamic link the library code specified by the string argument file.
checkListen(int) | Throws a SecurityException if the calling thread is not allowed to wait for a connection request on the specified local port number.
checkMemberAccess(Class, int) | Tests if a client is allowed to access members.
checkMulticast(InetAddress) | Tests if current execution context is allowed to use (join/leave/send/receive) IP multicast.
checkMulticast(InetAddress, byte) | Tests to see if current execution context is allowed to use (join/leave/send/receive) IP multicast.
checkPackageAccess(String) | Throws a SecurityException if the calling thread is not allowed to access the package specified by the argument.
checkPackageDefinition(String) | Throws a SecurityException if the calling thread is not allowed to define classes in the package specified by the argument.
checkPrintJobAccess() | Tests if a client can initiate a print job request.
checkPropertiesAccess() | Throws a SecurityException if the calling thread is not allowed to access or modify the system properties.
checkPropertyAccess(String) | Throws a SecurityException if the calling thread is not allowed to access the system property with the specified key name.
checkRead(FileDescriptor) | Throws a SecurityException if the calling thread is not allowed to read from the specified file descriptor.
checkRead(String) | Throws a SecurityException if the calling thread is not allowed to read the file specified by the string argument.
checkRead(String, Object) | Throws a SecurityException if the specified security context is not allowed to read the file specified by the string argument.
checkSecurityAccess(String) | Tests access to certain operations for a security API action.
checkSetFactory() | Throws a SecurityException if the calling thread is not allowed to set the socket factory used by ServerSocket or Socket, or the stream handler factory used by URL.
checkSystemClipboardAccess() | Tests if a client can get access to the system clipboard.
checkTopLevelWindow(Object) | Returns false if the calling thread is not trusted to bring up the top-level window indicated by the window argument.
checkWrite(FileDescriptor) | Throws a SecurityException if the calling thread is not allowed to write to the specified file descriptor.
checkWrite(String) | Throws a SecurityException if the calling thread is not allowed to write to the file specified by the string argument.
classDepth(String) | Returns the stack depth of the specified class.
classLoaderDepth() | Returns the stack depth of the most recently executing method from a class defined using a class loader.
currentClassLoader() | Returns an object describing the most recent class loader executing on the stack.
currentLoadedClass() | Returns the current Class with a ClassLoader on the execution stack.
getClassContext() | Returns the current execution stack as an array of classes.
getInCheck() | Tests if there is a security check in progress.
getSecurityContext() | Creates an object that encapsulates the current execution environment.
getThreadGroup() | Returns the thread group into which to instantiate any new thread being created at the time this is being called.
inClass(String) | Tests if the specified String is in this Class.
inClassLoader() | Tests if the current ClassLoader is equal to null.


 SecurityManager.inCheck

SecurityManager.inCheck

Syntax
protected boolean inCheck
Description
This field is true if there is a security check in progress; false otherwise.


 SecurityManager.SecurityManager

SecurityManager.SecurityManager

Syntax
protected SecurityManager()
Description
Constructs a new SecurityManager. An application is not allowed to create a new security manager if there is already a current security manager.

Exceptions
SecurityException if a security manager already exists.
See Also
getSecurityManager


 SecurityManager.checkAccept

SecurityManager.checkAccept

Syntax
public void checkAccept( String host, int port )
Parameters
host
the host name of the socket connection.
port
the port number of the socket connection.
Description
Throws a SecurityException if the calling thread is not permitted to accept a socket connection from the specified host and port number.

This method is invoked for the current security manager by the accept method of class ServerSocket.

The checkAccept method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to accept the connection.
See Also
getSecurityManager, accept


 SecurityManager.checkAccess

SecurityManager.checkAccess

Syntax 1
public void checkAccess( Thread g )
Parameters
g
the thread to be checked.
Description
Throws a SecurityException if the calling thread is not allowed to modify the thread argument.

This method is invoked for the current security manager by the stop, suspend, resume, setPriority, setName, and setDaemon methods of class Thread.

The checkAccess method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to modify the thread.
See Also
getSecurityManager, resume, setDaemon, setName, setPriority, stop, suspend

Syntax 2
public void checkAccess( ThreadGroup g )
Parameters
g
the thread group to be checked.
Description
Throws a SecurityException if the calling thread is not allowed to modify the thread group argument.

This method is invoked for the current security manager when a new child thread or child thread group is created, and by the setDaemon, setMaxPriority, stop, suspend, resume, and destroy methods of class ThreadGroup.

The checkAccess method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to modify the thread group.
See Also
getSecurityManager, destroy, resume, setDaemon, setMaxPriority, stop, suspend


 SecurityManager.checkAwtEventQueueAccess

SecurityManager.checkAwtEventQueueAccess

Syntax
public void checkAwtEventQueueAccess()
Description
Tests if a client can get access to the AWT event queue.


 SecurityManager.checkConnect

SecurityManager.checkConnect

Syntax 1
public void checkConnect( String host, int port )
Parameters
host
the host name port to connect to.
port
the protocol port to connect to.
Description
Throws a SecurityException if the calling thread is not allowed to open a socket connection to the specified host and port number.

A port number of -1 indicates that the calling method is attempting to determine the IP address of the specified host name.

The checkConnect method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to open a socket connection to the specified host and port.

Syntax 2
public void checkConnect( String host, int port, Object context )
Parameters
host
the host name port to connect to.
port
the protocol port to connect to.
context
a system-dependent security context.
Description
Throws a SecurityException if the specified security context is not allowed to open a socket connection to the specified host and port number.

A port number of -1 indicates that the calling method is attempting to determine the IP address of the specified host name.

The checkConnect method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the specified security context does not have permission to open a socket connection to the specified host and port.
See Also
getSecurityContext


 SecurityManager.checkCreateClassLoader

SecurityManager.checkCreateClassLoader

Syntax
public void checkCreateClassLoader()
Description
Throws a SecurityException if the calling thread is not allowed to create a new class loader.

The checkCreateClassLoader method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to create a new class loader.
See Also
ClassLoader


 SecurityManager.checkDelete

SecurityManager.checkDelete

Syntax
public void checkDelete( String file )
Parameters
file
the system-dependent filename.
Description
Throws a SecurityException if the calling thread is not allowed to delete the specified file.

This method is invoked for the current security manager by the delete method of class File.

The checkDelete method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to delete the file.
See Also
delete, getSecurityManager


 SecurityManager.checkExec

SecurityManager.checkExec

Syntax
public void checkExec( String cmd )
Parameters
cmd
the specified system command.
Description
Throws a SecurityException if the calling thread is not allowed to create a subprocss.

This method is invoked for the current security manager by the exec methods of class Runtime.

The checkExec method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to create a subprocess.
See Also
exec, exec, exec, exec, getSecurityManager


 SecurityManager.checkExit

SecurityManager.checkExit

Syntax
public void checkExit( int status )
Parameters
status
the exit status.
Description
Throws a SecurityException if the calling thread is not allowed to cause the Java Virtual Machine to halt with the specified status code.

This method is invoked for the current security manager by the exit method of class Runtime. A status of 0 indicates success; other values indicate various errors.

The checkExit method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to halt the Java Virtual Machine with the specified status.
See Also
exit, getSecurityManager


 SecurityManager.checkLink

SecurityManager.checkLink

Syntax
public void checkLink( String lib )
Parameters
lib
the name of the library.
Description
Throws a SecurityException if the calling thread is not allowed to dynamic link the library code specified by the string argument file. The argument is either a simple library name or a complete filename.

This method is invoked for the current security manager by methods load and loadLibrary of class Runtime.

The checkLink method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to dynamically link the library.
See Also
load, loadLibrary, getSecurityManager


 SecurityManager.checkListen

SecurityManager.checkListen

Syntax
public void checkListen( int port )
Parameters
port
the local port.
Description
Throws a SecurityException if the calling thread is not allowed to wait for a connection request on the specified local port number.

The checkListen method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to listen on the specified port.


 SecurityManager.checkMemberAccess

SecurityManager.checkMemberAccess

Syntax
public void checkMemberAccess( Class clazz, int which )
Description
Tests if a client is allowed to access members. If access is denied, throw a SecurityException. The default policy is to deny all accesses.


 SecurityManager.checkMulticast

SecurityManager.checkMulticast

Syntax 1
public void checkMulticast( InetAddress maddr )
Parameters
multicast
Internet group address to be used.
Description
Tests if current execution context is allowed to use (join/leave/send/receive) IP multicast.

Exceptions
SecurityException if a security error has occurred.

Syntax 2
public void checkMulticast( InetAddress maddr, byte ttl )
Parameters
multicast
Internet group address to be used.
ttl
value in use, if it is multicast send.
Description
Tests to see if current execution context is allowed to use (join/leave/send/receive) IP multicast.

Exceptions
SecurityException if a security error has occurred.


 SecurityManager.checkPackageAccess

SecurityManager.checkPackageAccess

Syntax
public void checkPackageAccess( String pkg )
Parameters
pkg
the package name.
Description
Throws a SecurityException if the calling thread is not allowed to access the package specified by the argument.

This method is used by the loadClass method of class loaders.

The checkPackageAccess method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to access the specified package.
See Also
loadClass


 SecurityManager.checkPackageDefinition

SecurityManager.checkPackageDefinition

Syntax
public void checkPackageDefinition( String pkg )
Parameters
pkg
the package name.
Description
Throws a SecurityException if the calling thread is not allowed to define classes in the package specified by the argument.

This method is used by the loadClass method of some class loaders.

The checkPackageDefinition method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to define classes in the specified package.
See Also
loadClass


 SecurityManager.checkPrintJobAccess

SecurityManager.checkPrintJobAccess

Syntax
public void checkPrintJobAccess()
Description
Tests if a client can initiate a print job request.


 SecurityManager.checkPropertiesAccess

SecurityManager.checkPropertiesAccess

Syntax
public void checkPropertiesAccess()
Description
Throws a SecurityException if the calling thread is not allowed to access or modify the system properties.

This method is used by the getProperties and setProperties methods of class System.

The checkPropertiesAccess method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to access or modify the system properties.
See Also
getProperties, setProperties


 SecurityManager.checkPropertyAccess

SecurityManager.checkPropertyAccess

Syntax
public void checkPropertyAccess( String key )
Parameters
key
a system property key.
Description
Throws a SecurityException if the calling thread is not allowed to access the system property with the specified key name.

This method is used by the getProperty method of class System.

The checkPropertiesAccess method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to access the specified system property.
See Also
getProperty


 SecurityManager.checkRead

SecurityManager.checkRead

Syntax 1
public void checkRead( FileDescriptor fd )
Parameters
fd
the system-dependent file descriptor.
Description
Throws a SecurityException if the calling thread is not allowed to read from the specified file descriptor.

The checkRead method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to access the specified file descriptor.
See Also
FileDescriptor

Syntax 2
public void checkRead( String file )
Parameters
file
the system-dependent file name.
Description
Throws a SecurityException if the calling thread is not allowed to read the file specified by the string argument.

The checkRead method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to access the specified file.

Syntax 3
public void checkRead( String file, Object context )
Parameters
file
the system-dependent filename.
context
a system-dependent security context.
Description
Throws a SecurityException if the specified security context is not allowed to read the file specified by the string argument. The context must be a security context returned by a previous call to getSecurityContext.

The checkRead method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the specified security context does not have permission to read the specified file.
See Also
getSecurityContext


 SecurityManager.checkSecurityAccess

SecurityManager.checkSecurityAccess

Syntax
public void checkSecurityAccess( String action )
Description
Tests access to certain operations for a security API action.


 SecurityManager.checkSetFactory

SecurityManager.checkSetFactory

Syntax
public void checkSetFactory()
Description
Throws a SecurityException if the calling thread is not allowed to set the socket factory used by ServerSocket or Socket, or the stream handler factory used by URL.

The checkSetFactory method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to specify a socket factory or a stream handler factory.
See Also
setSocketFactory, setSocketImplFactory, setURLStreamHandlerFactory


 SecurityManager.checkSystemClipboardAccess

SecurityManager.checkSystemClipboardAccess

Syntax
public void checkSystemClipboardAccess()
Description
Tests if a client can get access to the system clipboard.


 SecurityManager.checkTopLevelWindow

SecurityManager.checkTopLevelWindow

Syntax
public boolean checkTopLevelWindow( Object window )
Parameters
window
the new window that is being created.
Returns
true if the caller is trusted to put up top-level windows; false otherwise.
Description
Returns false if the calling thread is not trusted to bring up the top-level window indicated by the window argument. In this case, the caller can still decide to show the window, but the window should include some sort of visual warning. If the method returns true, then the window can be shown without any special restrictions.

See class Window for more information on trusted and untrusted windows.

The checkSetFactory method for class SecurityManager always returns false.

Exceptions
SecurityException if creation is disallowed entirely.
See Also
Window


 SecurityManager.checkWrite

SecurityManager.checkWrite

Syntax 1
public void checkWrite( FileDescriptor fd )
Parameters
fd
the system-dependent file descriptor.
Description
Throws a SecurityException if the calling thread is not allowed to write to the specified file descriptor.

The checkWrite method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to access the specified file descriptor.
See Also
FileDescriptor

Syntax 2
public void checkWrite( String file )
Parameters
file
the system-dependent filename.
Description
Throws a SecurityException if the calling thread is not allowed to write to the file specified by the string argument.

The checkWrite method for class SecurityManager always throws a SecurityException.

Exceptions
SecurityException if the caller does not have permission to access the specified file.


 SecurityManager.classDepth

SecurityManager.classDepth

Syntax
protected native int classDepth( String name )
Parameters
name
the fully qualified name of the class to search for.
Returns
the depth on the stack frame of the first occurrence of a method from a class with the specified name; -1 if such a frame cannot be found.
Description
Returns the stack depth of the specified class.


 SecurityManager.classLoaderDepth

SecurityManager.classLoaderDepth

Syntax
protected native int classLoaderDepth()
Returns
the depth on the stack frame of the most recent occurrence of a method from a class defined using a class loader; returns -1 if there is no occurrence of a method from a class defined using a class loader.
Description
Returns the stack depth of the most recently executing method from a class defined using a class loader.


 SecurityManager.currentClassLoader

SecurityManager.currentClassLoader

Syntax
protected native ClassLoader currentClassLoader()
Returns
the class loader of the most recent occurrence on the stack of a method from a class defined using a class loader; returns null if there is no occurrence on the stack of a method from a class defined using a class loader.
Description
Returns an object describing the most recent class loader executing on the stack.


 SecurityManager.currentLoadedClass

SecurityManager.currentLoadedClass

Syntax
protected Class currentLoadedClass()
Description
Returns the current Class with a ClassLoader on the execution stack.


 SecurityManager.getClassContext

SecurityManager.getClassContext

Syntax
protected native Class[] getClassContext()
Returns
the execution stack.
Description
Returns the current execution stack as an array of classes.

The length of the array is the number of methods on the execution stack. The element at index 0 is the class of the currently executing method, the element at index 1 is the class of that method's caller, and so on.


 SecurityManager.getInCheck

SecurityManager.getInCheck

Syntax
public boolean getInCheck()
Returns
the value of the inCheck field. This field should contain true if a security check is in progress; false otherwise.
Description
Tests if there is a security check in progress.

See Also
inCheck


 SecurityManager.getSecurityContext

SecurityManager.getSecurityContext

Syntax
public Object getSecurityContext()
Returns
an implementation-dependent object that encapsulates sufficient information about the current execution environment to perform some security checks later.
Description
Creates an object that encapsulates the current execution environment. The result of this method is used by the three-argument checkConnect method and by the two-argument checkRead method.

These methods are needed because a trusted method may be called on to read a file or open a socket on behalf of another method. The trusted method needs to determine if the other (possibly untrusted) method would be allowed to perform the operation on its own.

See Also
checkConnect, checkRead


 SecurityManager.getThreadGroup

SecurityManager.getThreadGroup

Syntax
public ThreadGroup getThreadGroup()
Description
Returns the thread group into which to instantiate any new thread being created at the time this is being called. By default, it returns the thread group of the current thread. This should be overriden by specific security manager to return the appropriate thread group.


 SecurityManager.inClass

SecurityManager.inClass

Syntax
protected boolean inClass( String name )
Parameters
name
the fully qualified name of the class.
Returns
true if a method from a class with the specified name is on the execution stack; false otherwise.
Description
Tests if the specified String is in this Class.


 SecurityManager.inClassLoader

SecurityManager.inClassLoader

Syntax
protected boolean inClassLoader()
Returns
true if a method from a class defined using a class loader is on the execution stack.
Description
Tests if the current ClassLoader is equal to null.


 Class Short

Class java.lang.Short

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Number
           |
           +----java.lang.Short

public final class Short
extends Number

The Short class is the standard wrapper for short values.

See Also:
Number


 Short Members

Short Members

Class Overview | This Package | All Packages

Fields
Name | Description
MAX_VALUE | The maximum value a Short can have.
MIN_VALUE | The minimum value a Short can have.
TYPE | The Class object representing the primitive type short.

Constructors
Name | Description
Short(short) | Constructs a Short object initialized to the specified short value.
Short(String) | Constructs a Short object initialized to the value specified by the String parameter.

Methods
Name | Description
byteValue() | Returns the value of this Short as a byte.
decode(String) | Decodes a String into a Short.
doubleValue() | Returns the value of this Short as a double.
equals(Object) | Compares this object to the specified object.
floatValue() | Returns the value of this Short as a float.
hashCode() | Returns a hashcode for this Short.
intValue() | Returns the value of this Short as an int.
longValue() | Returns the value of this Short as a long.
parseShort(String) | Assuming the specified String represents a short, returns that short's value.
parseShort(String, int) | Assuming the specified String represents a short, returns that short's value.
shortValue() | Returns the value of this Short as a short.
toString() | Returns a String object representing this Short's value.
toString(short) | Returns a new String object representing the specified Short.
valueOf(String) | Assuming the specified String represents a short, returns a new Short object initialized to that value.
valueOf(String, int) | Assuming the specified String represents a short, returns a new Short object initialized to that value.


 Short.MAX_VALUE

Short.MAX_VALUE

Syntax
public static final short MAX_VALUE
Description
The maximum value a Short can have.


 Short.MIN_VALUE

Short.MIN_VALUE

Syntax
public static final short MIN_VALUE
Description
The minimum value a Short can have.


 Short.TYPE

Short.TYPE

Syntax
public static final Class TYPE
Description
The Class object representing the primitive type short.


 Short.Short

Short.Short

Syntax 1
public Short( short value )
Parameters
value
the initial value of the Short
Description
Constructs a Short object initialized to the specified short value.

Syntax 2
public Short( String s ) throws NumberFormatException
Parameters
s
the String to be converted to a Short
Description
Constructs a Short object initialized to the value specified by the String parameter. The radix is assumed to be 10.

Exceptions
NumberFormatException If the String does not contain a parsable short.


 Short.byteValue

Short.byteValue

Syntax
public byte byteValue()
Description
Returns the value of this Short as a byte.

Overrides
byteValue in class Number


 Short.decode

Short.decode

Syntax
public static Short decode( String nm ) throws NumberFormatException
Parameters
nm
the string to decode
Description
Decodes a String into a Short. The String may represent decimal, hexadecimal, and octal numbers.


 Short.doubleValue

Short.doubleValue

Syntax
public double doubleValue()
Description
Returns the value of this Short as a double.

Overrides
doubleValue in class Number


 Short.equals

Short.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the object to compare with
Returns
true if the objects are the same; false otherwise.
Description
Compares this object to the specified object.

Overrides
equals in class Object


 Short.floatValue

Short.floatValue

Syntax
public float floatValue()
Description
Returns the value of this Short as a float.

Overrides
floatValue in class Number


 Short.hashCode

Short.hashCode

Syntax
public int hashCode()
Description
Returns a hashcode for this Short.

Overrides
hashCode in class Object


 Short.intValue

Short.intValue

Syntax
public int intValue()
Description
Returns the value of this Short as an int.

Overrides
intValue in class Number


 Short.longValue

Short.longValue

Syntax
public long longValue()
Description
Returns the value of this Short as a long.

Overrides
longValue in class Number


 Short.parseShort

Short.parseShort

Syntax 1
public static short parseShort( String s ) throws NumberFormatException
Parameters
s
the String containing the short
Description
Assuming the specified String represents a short, returns that short's value. Throws an exception if the String cannot be parsed as a short. The radix is assumed to be 10.

Exceptions
NumberFormatException If the string does not contain a parsable short.

Syntax 2
public static short parseShort( String s, int radix ) throws NumberFormatException
Parameters
s
the String containing the short
radix
the radix to be used
Description
Assuming the specified String represents a short, returns that short's value. Throws an exception if the String cannot be parsed as a short.

Exceptions
NumberFormatException If the String does not contain a parsable short.


 Short.shortValue

Short.shortValue

Syntax
public short shortValue()
Description
Returns the value of this Short as a short.

Overrides
shortValue in class Number


 Short.toString

Short.toString

Syntax
public static String toString( short s )
Parameters
s
the short to be converted
Description
Returns a new String object representing the specified Short. The radix is assumed to be 10.


 Short.toString

Short.toString

Syntax
public String toString()
Description
Returns a String object representing this Short's value.

Overrides
toString in class Object


 Short.valueOf

Short.valueOf

Syntax 1
public static Short valueOf( String s, int radix ) throws NumberFormatException
Parameters
s
the String containing the integer
radix
the radix to be used
Description
Assuming the specified String represents a short, returns a new Short object initialized to that value. Throws an exception if the String cannot be parsed as a short.

Exceptions
NumberFormatException If the String does not contain a parsable short.

Syntax 2
public static Short valueOf( String s ) throws NumberFormatException
Parameters
s
the String containing the integer
Description
Assuming the specified String represents a short, returns a new Short object initialized to that value. Throws an exception if the String cannot be parsed as a short.

Exceptions
NumberFormatException If the String does not contain a parsable short.


 Class StackOverflowError

Class java.lang.StackOverflowError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.VirtualMachineError
                           |
                           +----java.lang.StackOverflowError

public class StackOverflowError
extends VirtualMachineError

Thrown when a stack overflow occurs because an application recurses too deeply.


 StackOverflowError Members

StackOverflowError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
StackOverflowError() | Constructs a StackOverflowError with no detail message.
StackOverflowError(String) | Constructs a StackOverflowError with the specified detail message.


 StackOverflowError.StackOverflowError

StackOverflowError.StackOverflowError

Syntax 1
public StackOverflowError()
Description
Constructs a StackOverflowError with no detail message.

Syntax 2
public StackOverflowError( String s )
Parameters
s
the detail message.
Description
Constructs a StackOverflowError with the specified detail message.


 Class String

Class java.lang.String

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.String

public final class String
extends Object
implements Serializable

The String class represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class.

Strings are constant; their values cannot be changed after they are created. String buffers support mutable strings. Because String objects are immutable they can be shared. For example:

     String str = "abc";

is equivalent to:

     char data[] = {'a', 'b', 'c'};
     String str = new String(data);

Here are some more examples of how strings can be used:

     System.out.println("abc");
     String cde = "cde";
     System.out.println("abc" + cde);
     String c = "abc".substring(2,3);
     String d = cde.substring(1, 2);

The class String includes methods for examining individual characters of the sequence, for comparing strings, for searching strings, for extracting substrings, and for creating a copy of a string with all characters translated to uppercase or to lowercase.

The Java language provides special support for the string concatentation operator ( + ), and for conversion of other objects to strings. String concatenation is implemented through the StringBuffer class and its append method. String conversions are implemented through the method toString, defined by Object and inherited by all classes in Java. For additional information on string concatenation and conversion, see Gosling, Joy, and Steele, The Java Language Specification.

See Also:
toString, StringBuffer, append, append, append, append, append, append, append, append, append, append


 String Members

String Members

Class Overview | This Package | All Packages

Constructors
Name | Description
String() | Allocates a new String containing no characters.
String(byte[]) | Construct a new String by converting the specified array of bytes using the platform's default character encoding.
String(byte[], int) | Allocates a new String containing characters constructed from an array of 8-bit integer values. Deprecated.
String(byte[], int, int) | Construct a new String by converting the specified subarray of bytes using the platform's default character encoding.
String(byte[], int, int, int) | Allocates a new String constructed from a subarray of an array of 8-bit integer values. Deprecated.
String(byte[], int, int, String) | Construct a new String by converting the specified subarray of bytes using the specified character encoding.
String(byte[], String) | Construct a new String by converting the specified array of bytes using the specified character encoding.
String(char[]) | Allocates a new String so that it represents the sequence of characters currently contained in the character array argument.
String(char[], int, int) | Allocates a new String that contains characters from a subarray of the character array argument.
String(String) | Allocates a new string that contains the same sequence of characters as the string argument.
String(StringBuffer) | Allocates a new string that contains the sequence of characters currently contained in the string buffer argument.

Methods
Name | Description
charAt(int) | Returns the character at the specified index.
compareTo(String) | Compares two strings lexicographically.
concat(String) | Concatenates the specified string to the end of this string.
copyValueOf(char[]) | Returns a String that is equivalent to the specified character array.
copyValueOf(char[], int, int) | Returns a String that is equivalent to the specified character array.
endsWith(String) | Tests if this string ends with the specified suffix.
equals(Object) | Compares this string to the specified object.
equalsIgnoreCase(String) | Compares this String to another object.
getBytes() | Convert this String into bytes according to the platform's default character encoding, storing the result into a new byte array.
getBytes(int, int, byte[], int) | Copies characters from this string into the destination byte array. Deprecated.
getBytes(String) | Convert this String into bytes according to the specified character encoding, storing the result into a new byte array.
getChars(int, int, char[], int) | Copies characters from this string into the destination character array.
hashCode() | Returns a hashcode for this string.
indexOf(int) | Returns the index within this string of the first occurrence of the specified character.
indexOf(int, int) | Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.
indexOf(String) | Returns the index within this string of the first occurrence of the specified substring.
indexOf(String, int) | Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
intern() | Returns a canonical representation for the string object.
lastIndexOf(int) | Returns the index within this string of the last occurrence of the specified character.
lastIndexOf(int, int) | Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index.
lastIndexOf(String) | Returns the index within this string of the rightmost occurrence of the specified substring.
lastIndexOf(String, int) | Returns the index within this string of the last occurrence of the specified substring.
length() | Returns the length of this string.
regionMatches(boolean, int, String, int, int) | Tests if two string regions are equal.
regionMatches(int, String, int, int) | Tests if two string regions are equal.
replace(char, char) | Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar.
startsWith(String) | Tests if this string starts with the specified prefix.
startsWith(String, int) | Tests if this string starts with the specified prefix.
substring(int) | Returns a new string that is a substring of this string.
substring(int, int) | Returns a new string that is a substring of this string.
toCharArray() | Converts this string to a new character array.
toLowerCase() | Converts this String to lowercase.
toLowerCase(Locale) | Converts all of the characters in this String to lower case using the rules of the given locale.
toString() | This object (which is already a string!) is itself returned.
toUpperCase() | Converts this string to uppercase.
toUpperCase(Locale) | Converts all of the characters in this String to upper case using the rules of the given locale.
trim() | Removes white space from both ends of this string.
valueOf(boolean) | Returns the string representation of the boolean argument.
valueOf(char) | Returns the string representation of the char * argument.
valueOf(char[]) | Returns the string representation of the char array argument.
valueOf(char[], int, int) | Returns the string representation of a specific subarray of the char array argument.
valueOf(double) | Returns the string representation of the double argument.
valueOf(float) | Returns the string representation of the float argument.
valueOf(int) | Returns the string representation of the int argument.
valueOf(long) | Returns the string representation of the long argument.
valueOf(Object) | Returns the string representation of the Object argument.


 String.String

String.String

Syntax 1
public String()
Description
Allocates a new String containing no characters.

Syntax 2
public String( String value )
Parameters
value
a String.
Description
Allocates a new string that contains the same sequence of characters as the string argument.

Syntax 3
public String( char value[] )
Parameters
value
the initial value of the string.
Description
Allocates a new String so that it represents the sequence of characters currently contained in the character array argument.

Syntax 4
public String( char value[], int offset, int count )
Parameters
value
array that is the source of characters.
offset
the initial offset.
count
the length.
Description
Allocates a new String that contains characters from a subarray of the character array argument. The offset argument is the index of the first character of the subarray and the count argument specifies the length of the subarray.

Exceptions
StringIndexOutOfBoundsException if the offset and count arguments index characters outside the bounds of the value array.

Syntax 5
public String( byte ascii[], int hibyte, int offset, int count )
Parameters
ascii
the bytes to be converted to characters.
hibyte
the top 8 bits of each 16-bit Unicode character.
offset
the initial offset.
count
the length.
Description
Note: String() is deprecated. This method does not properly convert bytes into characters. As of JDK 1.1, the preferred way to do this is via the String constructors that take a character-encoding name or that use the platform's default encoding.

Allocates a new String constructed from a subarray of an array of 8-bit integer values.

The offset argument is the index of the first byte of the subarray, and the count argument specifies the length of the subarray.

Each byte in the subarray is converted to a char as specified in the method above.

Exceptions
StringIndexOutOfBoundsException if the offset or count argument is invalid.
See Also
String, String, String, String, String

Syntax 6
public String( byte ascii[], int hibyte )
Parameters
ascii
the bytes to be converted to characters.
hibyte
the top 8 bits of each 16-bit Unicode character.
Description
Note: String() is deprecated. This method does not properly convert bytes into characters. As of JDK 1.1, the preferred way to do this is via the String constructors that take a character-encoding name or that use the platform's default encoding.

Allocates a new String containing characters constructed from an array of 8-bit integer values. Each character cin the resulting string is constructed from the corresponding component b in the byte array such that:

     c == (char)(((hibyte & 0xff) << 8)
                         | (b & 0xff))

See Also
String, String, String, String

Syntax 7
public String( byte bytes[], int offset, int length, String enc ) throws UnsupportedEncodingException
Parameters
bytes
The bytes to be converted into characters
offset
Index of the first byte to convert
length
Number of bytes to convert
enc
The name of a character encoding
Description
Construct a new String by converting the specified subarray of bytes using the specified character encoding. The length of the new String is a function of the encoding, and hence may not be equal to the length of the subarray.

Exceptions
UnsupportedEncodingException If the named encoding is not supported

Syntax 8
public String( byte bytes[], String enc ) throws UnsupportedEncodingException
Parameters
bytes
The bytes to be converted into characters
enc
A character-encoding name
Description
Construct a new String by converting the specified array of bytes using the specified character encoding. The length of the new String is a function of the encoding, and hence may not be equal to the length of the byte array.

Exceptions
UnsupportedEncodingException If the named encoding is not supported

Syntax 9
public String( byte bytes[], int offset, int length )
Parameters
bytes
The bytes to be converted into characters
offset
Index of the first byte to convert
length
Number of bytes to convert
Description
Construct a new String by converting the specified subarray of bytes using the platform's default character encoding. The length of the new String is a function of the encoding, and hence may not be equal to the length of the subarray.

Syntax 10
public String( byte bytes[] )
Parameters
bytes
The bytes to be converted into characters
Description
Construct a new String by converting the specified array of bytes using the platform's default character encoding. The length of the new String is a function of the encoding, and hence may not be equal to the length of the byte array.

Syntax 11
public String( StringBuffer buffer )
Parameters
buffer
a StringBuffer.
Description
Allocates a new string that contains the sequence of characters currently contained in the string buffer argument.


 String.charAt

String.charAt

Syntax
public char charAt( int index )
Parameters
index
the index of the character.
Returns
the character at the specified index of this string. The first character is at index 0.
Description
Returns the character at the specified index. An index ranges from 0 to length() - 1.

Exceptions
StringIndexOutOfBoundsException if the index is out of range.


 String.compareTo

String.compareTo

Syntax
public int compareTo( String anotherString )
Parameters
anotherString
the String to be compared.
Returns
the value 0 if the argument string is equal to this string; a value less than 0 if this string is lexicographically less than the string argument; and a value greater than 0 if this string is lexicographically greater than the string argument.
Description
Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings.


 String.concat

String.concat

Syntax
public String concat( String str )
Parameters
str
the String that is concatenated to the end of this String.
Returns
a string that represents the concatenation of this object's characters followed by the string argument's characters.
Description
Concatenates the specified string to the end of this string.

If the length of the argument string is 0, then this object is returned.


 String.copyValueOf

String.copyValueOf

Syntax 1
public static String copyValueOf( char data[], int offset, int count )
Parameters
data
the character array.
offset
initial offset of the subarray.
count
length of the subarray.
Returns
a String that contains the characters of the specified subarray of the character array.
Description
Returns a String that is equivalent to the specified character array. It creates a new array and copies the characters into it.

Syntax 2
public static String copyValueOf( char data[] )
Parameters
data
the character array.
Returns
a String that contains the characters of the character array.
Description
Returns a String that is equivalent to the specified character array. It creates a new array and copies the characters into it.


 String.endsWith

String.endsWith

Syntax
public boolean endsWith( String suffix )
Parameters
suffix
the suffix.
Returns
true if the character sequence represented by the argument is a suffix of the character sequence represented by this object; false otherwise.
Description
Tests if this string ends with the specified suffix.


 String.equals

String.equals

Syntax
public boolean equals( Object anObject )
Parameters
anObject
the object to compare this String against.
Returns
true if the String are equal; false otherwise.
Description
Compares this string to the specified object. The result is true if and only if the argument is not null and is a String object that represents the same sequence of characters as this object.

Overrides
equals in class Object
See Also
compareTo, equalsIgnoreCase


 String.equalsIgnoreCase

String.equalsIgnoreCase

Syntax
public boolean equalsIgnoreCase( String anotherString )
Parameters
anotherString
the String to compare this String against.
Returns
true if the Strings are equal, ignoring case; false otherwise.
Description
Compares this String to another object. The result is true if and only if the argument is not null and is a String object that represents the same sequence of characters as this object, where case is ignored.

Two characters are considered the same, ignoring case, if at least one of the following is true:

  • The two characters are the same (as compared by the == operator).
  • Applying the method Character.toUppercase to each character produces the same result.
  • Applying the method Character.toLowercase to each character produces the same result.

Two sequences of characters are the same, ignoring case, if the sequences have the same length and corresponding characters are the same, ignoring case.

See Also
toLowerCase, toUpperCase


 String.getBytes

String.getBytes

Syntax 1
public void getBytes( int srcBegin, int srcEnd, byte dst[], int dstBegin )
Parameters
srcBegin
index of the first character in the string to copy.
srcEnd
index after the last character in the string to copy.
dst
the destination array.
dstBegin
the start offset in the destination array.
Description
Note: getBytes() is deprecated. This method does not properly convert characters into bytes. As of JDK 1.1, the preferred way to do this is via the getBytes(String enc) method, which takes a character-encoding name, or the getBytes() method, which uses the platform's default encoding.

Copies characters from this string into the destination byte array. Each byte receives the 8 low-order bits of the corresponding character.

The first character to be copied is at index srcBegin; the last character to be copied is at index srcEnd-1. The total number of characters to be copied is srcEnd-srcBegin. The characters, converted to bytes, are copied into the subarray of dst starting at index dstBegin and ending at index:

     dstbegin + (srcEnd-srcBegin) - 1

Exceptions
StringIndexOutOfBoundsException if srcBegin or srcEnd is out of range, or if srcBegin is greater than srcEnd.

Syntax 2
public byte[] getBytes( String enc ) throws UnsupportedEncodingException
Parameters
enc
A character-encoding name
Returns
The resultant byte array
Description
Convert this String into bytes according to the specified character encoding, storing the result into a new byte array.

Exceptions
UnsupportedEncodingException If the named encoding is not supported

Syntax 3
public byte[] getBytes()
Returns
the resultant byte array.
Description
Convert this String into bytes according to the platform's default character encoding, storing the result into a new byte array.


 String.getChars

String.getChars

Syntax
public void getChars( int srcBegin, int srcEnd, char dst[], int dstBegin )
Parameters
srcBegin
index of the first character in the string to copy.
srcEnd
index after the last character in the string to copy.
dst
the destination array.
dstBegin
the start offset in the destination array.
Description
Copies characters from this string into the destination character array.

The first character to be copied is at index srcBegin; the last character to be copied is at index srcEnd-1 (thus the total number of characters to be copied is srcEnd-srcBegin). The characters are copied into the subarray of dst starting at index dstBegin and ending at index:

     dstbegin + (srcEnd-srcBegin) - 1

Exceptions
StringIndexOutOfBoundsException If srcBegin or srcEnd is out of range, or if srcBegin is greater than the srcEnd.


 String.hashCode

String.hashCode

Syntax
public int hashCode()
Returns
a hash code value for this object.
Description
Returns a hashcode for this string.

Overrides
hashCode in class Object


 String.indexOf

String.indexOf

Syntax 1
public int indexOf( int ch )
Parameters
ch
a character.
Returns
the index of the first occurrence of the character in the character sequence represented by this object, or -1 if the character does not occur.
Description
Returns the index within this string of the first occurrence of the specified character.

Syntax 2
public int indexOf( int ch, int fromIndex )
Parameters
ch
a character.
fromIndex
the index to start the search from.
Returns
the index of the first occurrence of the character in the character sequence represented by this object that is greater than or equal to fromIndex, or -1 if the character does not occur.
Description
Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.


 String.indexOf

String.indexOf

Syntax 1
public int indexOf( String str )
Parameters
str
any string.
Returns
if the string argument occurs as a substring within this object, then the index of the first character of the first such substring is returned; if it does not occur as a substring, -1 is returned.
Description
Returns the index within this string of the first occurrence of the specified substring.

Syntax 2
public int indexOf( String str, int fromIndex )
Parameters
str
the substring to search for.
fromIndex
the index to start the search from.
Returns
If the string argument occurs as a substring within this object at a starting index no smaller than fromIndex, then the index of the first character of the first such substring is returned. If it does not occur as a substring starting at fromIndex or beyond, -1 is returned.
Description
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.


 String.intern

String.intern

Syntax
public native String intern()
Returns
a string that has the same contents as this string, but is guaranteed to be from a pool of unique strings.
Description
Returns a canonical representation for the string object.

If s and t are strings such that s.equals(t), it is guaranteed that
s.intern() == t.intern().


 String.lastIndexOf

String.lastIndexOf

Syntax 1
public int lastIndexOf( int ch )
Parameters
ch
a character.
Returns
the index of the last occurrence of the character in the character sequence represented by this object, or -1 if the character does not occur.
Description
Returns the index within this string of the last occurrence of the specified character. The String is searched backwards starting at the last character.

Syntax 2
public int lastIndexOf( int ch, int fromIndex )
Parameters
ch
a character.
fromIndex
the index to start the search from.
Returns
the index of the last occurrence of the character in the character sequence represented by this object that is less than or equal to fromIndex, or -1 if the character does not occur before that point.
Description
Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index.


 String.lastIndexOf

String.lastIndexOf

Syntax 1
public int lastIndexOf( String str )
Parameters
str
the substring to search for.
Returns
if the string argument occurs one or more times as a substring within this object, then the index of the first character of the last such substring is returned. If it does not occur as a substring, -1 is returned.
Description
Returns the index within this string of the rightmost occurrence of the specified substring. The rightmost empty string "" is considered to occur at the index value this.length().

Syntax 2
public int lastIndexOf( String str, int fromIndex )
Parameters
str
the substring to search for.
fromIndex
the index to start the search from.
Returns
If the string argument occurs one or more times as a substring within this object at a starting index no greater than fromIndex, then the index of the first character of the last such substring is returned. If it does not occur as a substring starting at fromIndex or earlier, -1 is returned.
Description
Returns the index within this string of the last occurrence of the specified substring. The returned index indicates the start of the substring, and it must be equal to or less than fromIndex.


 String.length

String.length

Syntax
public int length()
Returns
the length of the sequence of characters represented by this object.
Description
Returns the length of this string. The length is equal to the number of 16-bit Unicode characters in the string.


 String.regionMatches

String.regionMatches

Syntax 1
public boolean regionMatches( int toffset, String other, int ooffset, int len )
Parameters
toffset
the starting offset of the subregion in this string.
other
the string argument.
ooffset
the starting offset of the subregion in the string argument.
len
the number of characters to compare.
Returns
true if the specified subregion of this string exactly matches the specified subregion of the string argument; false otherwise.
Description
Tests if two string regions are equal.

If toffset or ooffset is negative, or if toffset+length is greater than the length of this string, or if ooffset+length is greater than the length of the string argument, then this method returns false.

Syntax 2
public boolean regionMatches( boolean ignoreCase, int toffset, String other, int ooffset, int len )
Parameters
ignoreCase
if true, ignore case when comparing characters.
toffset
the starting offset of the subregion in this string.
other
the string argument.
ooffset
the starting offset of the subregion in the string argument.
len
the number of characters to compare.
Returns
true if the specified subregion of this string matches the specified subregion of the string argument; false otherwise. Whether the matching is exact or case insensitive depends on the ignoreCase argument.
Description
Tests if two string regions are equal.

If toffset or ooffset is negative, or if toffset+length is greater than the length of this string, or if ooffset+length is greater than the length of the string argument, then this method returns false.


 String.replace

String.replace

Syntax
public String replace( char oldChar, char newChar )
Parameters
oldChar
the old character.
newChar
the new character.
Returns
a string derived from this string by replacing every occurrence of oldChar with newChar.
Description
Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar.

If the character oldChar does not occur in the character sequence represented by this object, then this string is returned.


 String.startsWith

String.startsWith

Syntax 1
public boolean startsWith( String prefix, int toffset )
Parameters
prefix
the prefix.
toffset
where to begin looking in the string.
Returns
true if the character sequence represented by the argument is a prefix of the substring of this object starting at index toffset; false otherwise.
Description
Tests if this string starts with the specified prefix.

Syntax 2
public boolean startsWith( String prefix )
Parameters
prefix
the prefix.
Returns
true if the character sequence represented by the argument is a prefix of the character sequence represented by this string; false otherwise.
Description
Tests if this string starts with the specified prefix.


 String.substring

String.substring

Syntax 1
public String substring( int beginIndex )
Parameters
beginIndex
the beginning index, inclusive.
Returns
the specified substring.
Description
Returns a new string that is a substring of this string. The substring begins at the specified index and extends to the end of this string.

Exceptions
StringIndexOutOfBoundsException if the beginIndex is out of range.

Syntax 2
public String substring( int beginIndex, int endIndex )
Parameters
beginIndex
the beginning index, inclusive.
endIndex
the ending index, exclusive.
Returns
the specified substring.
Description
Returns a new string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1.

Exceptions
StringIndexOutOfBoundsException if the beginIndex or the endIndex is out of range.


 String.toCharArray

String.toCharArray

Syntax
public char[] toCharArray()
Returns
a newly allocated character array whose length is the length of this string and whose contents are initialized to contain the character sequence represented by this string.
Description
Converts this string to a new character array.


 String.toLowerCase

String.toLowerCase

Syntax 1
public String toLowerCase( Locale locale )
Parameters
locale
use the case transformation rules for this locale
Returns
the String, converted to lowercase.
Description
Converts all of the characters in this String to lower case using the rules of the given locale.

See Also
toLowerCase, toUpperCase

Syntax 2
public String toLowerCase()
Returns
the string, converted to lowercase.
Description
Converts this String to lowercase.

If no character in the string has a different lowercase version, based on calling the toLowerCase method defined by Character, then the original string is returned.

Otherwise, a new string is allocated, whose length is identical to this string, and such that each character that has a different lowercase version is mapped to this lowercase equivalent.

See Also
toLowerCase, toUpperCase


 String.toString

String.toString

Syntax
public String toString()
Returns
the string itself.
Description
This object (which is already a string!) is itself returned.

Overrides
toString in class Object


 String.toUpperCase

String.toUpperCase

Syntax 1
public String toUpperCase( Locale locale )
Parameters
locale
use the case transformation rules for this locale
Returns
the String, converted to uppercase.
Description
Converts all of the characters in this String to upper case using the rules of the given locale.

See Also
toUpperCase, toLowerCase

Syntax 2
public String toUpperCase()
Returns
the string, converted to uppercase.
Description
Converts this string to uppercase.

If no character in this string has a different uppercase version, based on calling the toUpperCase method defined by Character, then the original string is returned.

Otherwise, a new string is allocated, whose length is identical to this string, and such that each character that has a different uppercase version is mapped to this uppercase equivalent.

See Also
toUpperCase, toLowerCase


 String.trim

String.trim

Syntax
public String trim()
Returns
this string, with white space removed from the front and end.
Description
Removes white space from both ends of this string.

All characters that have codes less than or equal to '\u0020' (the space character) are considered to be white space.


 String.valueOf

String.valueOf

Syntax 1
public static String valueOf( Object obj )
Parameters
obj
an Object.
Returns
if the argument is null, then a string equal to "null"; otherwise, the value of obj.toString() is returned.
Description
Returns the string representation of the Object argument.

See Also
toString

Syntax 2
public static String valueOf( char data[] )
Parameters
data
a char array.
Returns
a newly allocated string representing the same sequence of characters contained in the character array argument.
Description
Returns the string representation of the char array argument.

Syntax 3
public static String valueOf( char data[], int offset, int count )
Parameters
data
the character array.
offset
the initial offset into the value of the String.
count
the length of the value of the String.
Returns
a newly allocated string representing the sequence of characters contained in the subarray of the character array argument.
Description
Returns the string representation of a specific subarray of the char array argument.

The offset argument is the index of the first character of the subarray. The count argument specifies the length of the subarray.


 String.valueOf

String.valueOf

Syntax 1
public static String valueOf( boolean b )
Parameters
b
a boolean.
Returns
if the argument is true, a string equal to "true" is returned; otherwise, a string equal to "false" is returned.
Description
Returns the string representation of the boolean argument.

Syntax 2
public static String valueOf( char c )
Parameters
c
a char.
Returns
a newly allocated string of length 1 containing as its single character the argument c.
Description
Returns the string representation of the char * argument.

Syntax 3
public static String valueOf( int i )
Parameters
i
an int.
Returns
a newly allocated string containing a string representation of the int argument.
Description
Returns the string representation of the int argument.

The representation is exactly the one returned by the Integer.toString method of one argument.

See Also
toString

Syntax 4
public static String valueOf( long l )
Parameters
l
a long.
Returns
a newly allocated string containing a string representation of the long argument.
Description
Returns the string representation of the long argument.

The representation is exactly the one returned by the Long.toString method of one argument.

See Also
toString

Syntax 5
public static String valueOf( float f )
Parameters
f
a float.
Returns
a newly allocated string containing a string representation of the float argument.
Description
Returns the string representation of the float argument.

The representation is exactly the one returned by the Float.toString method of one argument.

See Also
toString

Syntax 6
public static String valueOf( double d )
Parameters
d
a double.
Returns
a newly allocated string containing a string representation of the double argument.
Description
Returns the string representation of the double argument.

The representation is exactly the one returned by the Double.toString method of one argument.

See Also
toString


 Class StringBuffer

Class java.lang.StringBuffer

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.StringBuffer

public final class StringBuffer
extends Object
implements Serializable

A string buffer implements a mutable sequence of characters.

String buffers are safe for use by multiple threads. The methods are synchronized where necessary so that all the operations on any particular instance behave as if they occur in some serial order.

String buffers are used by the compiler to implement the binary string concatenation operator +. For example, the code:

     x = "a" + 4 + "c"

is compiled to the equivalent of:

     x = new StringBuffer().append("a").append(4).append("c")
                           .toString()

The principal operations on a StringBuffer are the append and insert methods, which are overloaded so as to accept data of any type. Each effectively converts a given datum to a string and then appends or inserts the characters of that string to the string buffer. The append method always adds these characters at the end of the buffer; the insert method adds the characters at a specified point.

For example, if z refers to a string buffer object whose current contents are "start", then the method call z.append("le") would cause the string buffer to contain "startle", whereas z.insert(4, "le") would alter the string buffer to contain "starlet".

Every string buffer has a capacity. As long as the length of the character sequence contained in the string buffer does not exceed the capacity, it is not necessary to allocate a new internal buffer array. If the internal buffer overflows, it is automatically made larger.

See Also:
ByteArrayOutputStream, String


 StringBuffer Members

StringBuffer Members

Class Overview | This Package | All Packages

Constructors
Name | Description
StringBuffer() | Constructs a string buffer with no characters in it and an initial capacity of 16 characters.
StringBuffer(int) | Constructs a string buffer with no characters in it and an initial capacity specified by the length argument.
StringBuffer(String) | Constructs a string buffer so that it represents the same sequence of characters as the string argument.

Methods
Name | Description
append(boolean) | Appends the string representation of the boolean argument to the string buffer.
append(char) | Appends the string representation of the char argument to this string buffer.
append(char[]) | Appends the string representation of the char array argument to this string buffer.
append(char[], int, int) | Appends the string representation of a subarray of the char array argument to this string buffer.
append(double) | Appends the string representation of the double argument to this string buffer.
append(float) | Appends the string representation of the float argument to this string buffer.
append(int) | Appends the string representation of the int argument to this string buffer.
append(long) | Appends the string representation of the long argument to this string buffer.
append(Object) | Appends the string representation of the Object argument to this string buffer.
append(String) | Appends the string to this string buffer.
capacity() | Returns the current capacity of the String buffer.
charAt(int) | Returns the character at a specific index in this string buffer.
ensureCapacity(int) | Ensures that the capacity of the buffer is at least equal to the specified minimum.
getChars(int, int, char[], int) | Characters are copied from this string buffer into the destination character array dst.
insert(int, boolean) | Inserts the string representation of the boolean argument into this string buffer.
insert(int, char) | Inserts the string representation of the char argument into this string buffer.
insert(int, char[]) | Inserts the string representation of the char array argument into this string buffer.
insert(int, double) | Inserts the string representation of the double argument into this string buffer.
insert(int, float) | Inserts the string representation of the float argument into this string buffer.
insert(int, int) | Inserts the string representation of the second int argument into this string buffer.
insert(int, long) | Inserts the string representation of the long argument into this string buffer.
insert(int, Object) | Inserts the string representation of the Object argument into this string buffer.
insert(int, String) | Inserts the string into this string buffer.
length() | Returns the length (character count) of this string buffer.
reverse() | The character sequence contained in this string buffer is replaced by the reverse of the sequence.
setCharAt(int, char) | The character at the specified index of this string buffer is set to ch.
setLength(int) | Sets the length of this String buffer.
toString() | Converts to a string representing the data in this string buffer.


 StringBuffer.StringBuffer

StringBuffer.StringBuffer

Syntax 1
public StringBuffer()
Description
Constructs a string buffer with no characters in it and an initial capacity of 16 characters.

Syntax 2
public StringBuffer( int length )
Parameters
length
the initial capacity.
Description
Constructs a string buffer with no characters in it and an initial capacity specified by the length argument.

Exceptions
NegativeArraySizeException if the length argument is less than 0.

Syntax 3
public StringBuffer( String str )
Parameters
str
the initial contents of the buffer.
Description
Constructs a string buffer so that it represents the same sequence of characters as the string argument. The initial capacity of the string buffer is 16 plus the length of the string argument.


 StringBuffer.append

StringBuffer.append

Syntax 1
public synchronized StringBuffer append( Object obj )
Parameters
obj
an Object.
Returns
this string buffer.
Description
Appends the string representation of the Object argument to this string buffer.

The argument is converted to a string as if by the method String.valueOf, and the characters of that string are then appended to this string buffer.

See Also
valueOf, append

Syntax 2
public synchronized StringBuffer append( String str )
Parameters
str
a string.
Returns
this string buffer.
Description
Appends the string to this string buffer.

The characters of the String argument are appended, in order, to the contents of this string buffer, increasing the length of this string buffer by the length of the argument.

Syntax 3
public synchronized StringBuffer append( char str[] )
Parameters
str
the characters to be appended.
Returns
this string buffer.
Description
Appends the string representation of the char array argument to this string buffer.

The characters of the array argument are appended, in order, to the contents of this string buffer. The length of this string buffer increases by the length of the argument.

Syntax 4
public synchronized StringBuffer append( char str[], int offset, int len )
Parameters
str
the characters to be appended.
offset
the index of the first character to append.
len
the number of characters to append.
Returns
this string buffer.
Description
Appends the string representation of a subarray of the char array argument to this string buffer.

Characters of the character array str, starting at index offset, are appended, in order, to the contents of this string buffer. The length of this string buffer increases by the value of len.

Syntax 5
public StringBuffer append( boolean b )
Parameters
b
a boolean.
Returns
this string buffer.
Description
Appends the string representation of the boolean argument to the string buffer.

The argument is converted to a string as if by the method String.valueOf, and the characters of that string are then appended to this string buffer.

See Also
valueOf, append

Syntax 6
public synchronized StringBuffer append( char c )
Parameters
ch
a char.
Returns
this string buffer.
Description
Appends the string representation of the char argument to this string buffer.

The argument is appended to the contents of this string buffer. The length of this string buffer increases by 1.

Syntax 7
public StringBuffer append( int i )
Parameters
i
an int.
Returns
this string buffer.
Description
Appends the string representation of the int argument to this string buffer.

The argument is converted to a string as if by the method String.valueOf, and the characters of that string are then appended to this string buffer.

See Also
valueOf, append

Syntax 8
public StringBuffer append( long l )
Parameters
l
a long.
Returns
this string buffer.
Description
Appends the string representation of the long argument to this string buffer.

The argument is converted to a string as if by the method String.valueOf, and the characters of that string are then appended to this string buffer.

See Also
valueOf, append

Syntax 9
public StringBuffer append( float f )
Parameters
f
a float.
Returns
this string buffer.
Description
Appends the string representation of the float argument to this string buffer.

The argument is converted to a string as if by the method String.valueOf, and the characters of that string are then appended to this string buffer.

See Also
valueOf, append

Syntax 10
public StringBuffer append( double d )
Parameters
d
a double.
Returns
this string buffer.
Description
Appends the string representation of the double argument to this string buffer.

The argument is converted to a string as if by the method String.valueOf, and the characters of that string are then appended to this string buffer.

See Also
valueOf, append


 StringBuffer.capacity

StringBuffer.capacity

Syntax
public int capacity()
Returns
the current capacity of this string buffer.
Description
Returns the current capacity of the String buffer. The capacity is the amount of storage available for newly inserted characters; beyond which an allocation will occur.


 StringBuffer.charAt

StringBuffer.charAt

Syntax
public synchronized char charAt( int index )
Parameters
index
the index of the desired character.
Returns
the character at the specified index of this string buffer.
Description
Returns the character at a specific index in this string buffer.

The first character of a string buffer is at index 0, the next at index 1, and so on, for array indexing.

The index argument must be greater than or equal to 0, and less than the length of this string buffer.

Exceptions
StringIndexOutOfBoundsException if the index is invalid.
See Also
length


 StringBuffer.ensureCapacity

StringBuffer.ensureCapacity

Syntax
public synchronized void ensureCapacity( int minimumCapacity )
Parameters
minimumCapacity
the minimum desired capacity.
Description
Ensures that the capacity of the buffer is at least equal to the specified minimum. If the current capacity of this string buffer is less than the argument, then a new internal buffer is allocated with greater capacity. The new capacity is the larger of:
  • The minimumCapacity argument.
  • Twice the old capacity, plus 2.
If the minimumCapacity argument is nonpositive, this method takes no action and simply returns.


 StringBuffer.getChars

StringBuffer.getChars

Syntax
public synchronized void getChars( int srcBegin, int srcEnd, char dst[], int dstBegin )
Parameters
srcBegin
start copying at this offset in the string buffer.
srcEnd
stop copying at this offset in the string buffer.
dst
the array to copy the data into.
dstBegin
offset into dst.
Description
Characters are copied from this string buffer into the destination character array dst. The first character to be copied is at index srcBegin; the last character to be copied is at index srcEnd-1. The total number of characters to be copied is srcEnd-srcBegin. The characters are copied into the subarray of dst starting at index dstBegin and ending at index:

     dstbegin + (srcEnd-srcBegin) - 1

Exceptions
StringIndexOutOfBoundsException if there is an invalid index into the buffer.


 StringBuffer.insert

StringBuffer.insert

Syntax 1
public synchronized StringBuffer insert( int offset, Object obj )
Parameters
offset
the offset.
b
an Object.
Returns
this string buffer.
Description
Inserts the string representation of the Object argument into this string buffer.

The second argument is converted to a string as if by the method String.valueOf, and the characters of that string are then inserted into this string buffer at the indicated offset.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Exceptions
StringIndexOutOfBoundsException if the offset is invalid.
See Also
valueOf, insert, length

Syntax 2
public synchronized StringBuffer insert( int offset, String str )
Parameters
offset
the offset.
str
a string.
Returns
this string buffer.
Description
Inserts the string into this string buffer.

The characters of the String argument are inserted, in order, into this string buffer at the indicated offset. The length of this string buffer is increased by the length of the argument.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Exceptions
StringIndexOutOfBoundsException if the offset is invalid.
See Also
length

Syntax 3
public synchronized StringBuffer insert( int offset, char str[] )
Parameters
offset
the offset.
ch
a character array.
Returns
this string buffer.
Description
Inserts the string representation of the char array argument into this string buffer.

The characters of the array argument are inserted into the contents of this string buffer at the position indicated by offset. The length of this string buffer increases by the length of the argument.

Exceptions
StringIndexOutOfBoundsException if the offset is invalid.

Syntax 4
public StringBuffer insert( int offset, boolean b )
Parameters
offset
the offset.
b
a boolean.
Returns
this string buffer.
Description
Inserts the string representation of the boolean argument into this string buffer.

The second argument is converted to a string as if by the method String.valueOf, and the characters of that string are then inserted into this string buffer at the indicated offset.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Exceptions
StringIndexOutOfBoundsException if the offset is invalid.
See Also
valueOf, insert, length

Syntax 5
public synchronized StringBuffer insert( int offset, char c )
Parameters
offset
the offset.
ch
a char.
Returns
this string buffer.
Description
Inserts the string representation of the char argument into this string buffer.

The second argument is inserted into the contents of this string buffer at the position indicated by offset. The length of this string buffer increases by one.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Exceptions
StringIndexOutOfBoundsException if the offset is invalid.
See Also
length

Syntax 6
public StringBuffer insert( int offset, int i )
Parameters
offset
the offset.
b
an int.
Returns
this string buffer.
Description
Inserts the string representation of the second int argument into this string buffer.

The second argument is converted to a string as if by the method String.valueOf, and the characters of that string are then inserted into this string buffer at the indicated offset.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Exceptions
StringIndexOutOfBoundsException if the offset is invalid.
See Also
valueOf, insert, length

Syntax 7
public StringBuffer insert( int offset, long l )
Parameters
offset
the offset.
b
a long.
Returns
this string buffer.
Description
Inserts the string representation of the long argument into this string buffer.

The second argument is converted to a string as if by the method String.valueOf, and the characters of that string are then inserted into this string buffer at the indicated offset.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Exceptions
StringIndexOutOfBoundsException if the offset is invalid.
See Also
valueOf, insert, length

Syntax 8
public StringBuffer insert( int offset, float f )
Parameters
offset
the offset.
b
a float.
Returns
this string buffer.
Description
Inserts the string representation of the float argument into this string buffer.

The second argument is converted to a string as if by the method String.valueOf, and the characters of that string are then inserted into this string buffer at the indicated offset.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Exceptions
StringIndexOutOfBoundsException if the offset is invalid.
See Also
valueOf, insert, length

Syntax 9
public StringBuffer insert( int offset, double d )
Parameters
offset
the offset.
b
a double.
Returns
this string buffer.
Description
Inserts the string representation of the double argument into this string buffer.

The second argument is converted to a string as if by the method String.valueOf, and the characters of that string are then inserted into this string buffer at the indicated offset.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Exceptions
StringIndexOutOfBoundsException if the offset is invalid.
See Also
valueOf, insert, length


 StringBuffer.length

StringBuffer.length

Syntax
public int length()
Returns
the number of characters in this string buffer.
Description
Returns the length (character count) of this string buffer.


 StringBuffer.reverse

StringBuffer.reverse

Syntax
public synchronized StringBuffer reverse()
Returns
this string buffer.
Description
The character sequence contained in this string buffer is replaced by the reverse of the sequence.


 StringBuffer.setCharAt

StringBuffer.setCharAt

Syntax
public synchronized void setCharAt( int index, char ch )
Parameters
index
the index of the character to modify.
ch
the new character.
Description
The character at the specified index of this string buffer is set to ch.

The offset argument must be greater than or equal to 0, and less than the length of this string buffer.

Exceptions
StringIndexOutOfBoundsException if the index is invalid.
See Also
length


 StringBuffer.setLength

StringBuffer.setLength

Syntax
public synchronized void setLength( int newLength )
Parameters
newLength
the new length of the buffer.
Description
Sets the length of this String buffer. If the newLength argument is less than the current length of the string buffer, the string buffer is truncated to contain exactly the number of characters given by the newLength argument.

If the newLength argument is greater than or equal to the current length, sufficient null characters ('\u0000') are appended to the string buffer so that length becomes the newLength argument.

The newLength argument must be greater than or equal to 0.

Exceptions
StringIndexOutOfBoundsException if the newLength argument is invalid.
See Also
length


 StringBuffer.toString

StringBuffer.toString

Syntax
public String toString()
Returns
a string representation of the string buffer.
Description
Converts to a string representing the data in this string buffer. A new String object is allocated and initialized to contain the character sequence currently represented by this string buffer. This String is then returned. Subsequent changes to the string buffer do not affect the contents of the String.

Overrides
toString in class Object


 Class StringIndexOutOfBoundsException

Class java.lang.StringIndexOutOfBoundsException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.lang.IndexOutOfBoundsException
                                   |
                                   +----java.lang.StringIndexOutOfBoundsException

public class StringIndexOutOfBoundsException
extends IndexOutOfBoundsException

Thrown by the charAt method in class String and by other String methods to indicate that an index is either negative or greater than or equal to the size of the string.

See Also:
charAt


 StringIndexOutOfBoundsException Members

StringIndexOutOfBoundsException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
StringIndexOutOfBoundsException() | Constructs a StringIndexOutOfBoundsException with no detail message.
StringIndexOutOfBoundsException(int) | Constructs a new StringIndexOutOfBoundsException class with an argument indicating the illegal index.
StringIndexOutOfBoundsException(String) | Constructs a StringIndexOutOfBoundsException with the specified detail message.


 StringIndexOutOfBoundsException.StringIndexOutOfBoundsException

StringIndexOutOfBoundsException.StringIndexOutOfBoundsException

Class Overview | Class Members | This Package | All Packages

Syntax 1
public StringIndexOutOfBoundsException()
Description
Constructs a StringIndexOutOfBoundsException with no detail message.

Syntax 2
public StringIndexOutOfBoundsException( String s )
Parameters
s
the detail message.
Description
Constructs a StringIndexOutOfBoundsException with the specified detail message.

Syntax 3
public StringIndexOutOfBoundsException( int index )
Parameters
index
the illegal index.
Description
Constructs a new StringIndexOutOfBoundsException class with an argument indicating the illegal index.


 Class System

Class java.lang.System

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.System

public final class System
extends Object

The System class contains several useful class fields and methods. It cannot be instantiated.

Among the facilities provided by the System class are standard input, standard output, and error output streams; access to externally defined "properties"; a means of loading files and libraries; and a utility method for quickly copying a portion of an array.


 System Members

System Members

Class Overview | This Package | All Packages

Fields
Name | Description
err | The "standard" error output stream.
in | The "standard" input stream.
out | The "standard" output stream.

Methods
Name | Description
arraycopy(Object, int, Object, int, int) | Copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array.
currentTimeMillis() | Returns the current time in milliseconds.
exit(int) | Terminates the currently running Java Virtual Machine.
gc() | Runs the garbage collector.
getenv(String) | Gets an environment variable. Deprecated.
getProperties() | Determines the current system properties.
getProperty(String) | Gets the system property indicated by the specified key.
getProperty(String, String) | Gets the system property indicated by the specified key.
getSecurityManager() | Gets the system security interface.
identityHashCode(Object) | Returns the same hashcode for the given object as would be returned by the default method hashCode(), whether or not the given object's class overrides hashCode().
load(String) | Loads the specified filename as a dynamic library.
loadLibrary(String) | Loads the system library specified by the libname argument.
runFinalization() | Runs the finalization methods of any objects pending finalization.
runFinalizersOnExit(boolean) | Enable or disable finalization on exit; doing so specifies that the finalizers of all objects that have finalizers that have not yet been automatically invoked are to be run before the Java runtime exits.
setErr(PrintStream) | Reassigns the "standard" error output stream.
setIn(InputStream) | Reassigns the "standard" input stream.
setOut(PrintStream) | Reassigns the "standard" output stream.
setProperties(Properties) | Sets the system properties to the Properties argument.
setSecurityManager(SecurityManager) | Sets the System security.


 System.err

System.err

Syntax
public static final PrintStream err
Description
The "standard" error output stream. This stream is already open and ready to accept output data.

Typically this stream corresponds to display output or another output destination specified by the host environment or user. By convention, this output stream is used to display error messages or other information that should come to the immediate attention of a user even if the principal output stream, the value of the variable out, has been redirected to a file or other destination that is typically not continuously monitored.


 System.in

System.in

Syntax
public static final InputStream in
Description
The "standard" input stream. This stream is already open and ready to supply input data. Typically this stream corresponds to keyboard input or another input source specified by the host environment or user.


 System.out

System.out

Syntax
public static final PrintStream out
Description
The "standard" output stream. This stream is already open and ready to accept output data. Typically this stream corresponds to display output or another output destination specified by the host environment or user.

For simple stand-alone Java applications, a typical way to write a line of output data is:

    System.out.println(data)

See the println methods in class PrintStream.

See Also
println, println, println, println, println, println, println, println, println, println


 System.arraycopy

System.arraycopy

Syntax
public static native void arraycopy( Object src, int src_position, Object dst, int dst_position, int length )
Parameters
src:
the source array.
srcpos
start position in the source array.
dest
the destination array.
destpos
start position in the destination data.
length
the number of array elements to be copied.
Description
Copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array. A subsequence of array components are copied from the source array referenced by src to the destination array referenced by dst. The number of components copied is equal to the length argument. The components at positions srcOffset through srcOffset+length-1 in the source array are copied into positions dstOffset through dstOffset+length-1, respectively, of the destination array.

If the src and dst arguments refer to the same array object, then the copying is performed as if the components at positions srcOffset through srcOffset+length-1 were first copied to a temporary array with length components and then the contents of the temporary array were copied into positions dstOffset through dstOffset+length-1 of the argument array.

If any of the following is true, an ArrayStoreException is thrown and the destination is not modified:

  • The src argument refers to an object that is not an array.
  • The dst argument refers to an object that is not an array.
  • The src argument and dst argument refer to arrays whose component types are different primitive types.
  • The src argument refers to an array with a primitive component type and the dst argument refers to an array with a reference component type.
  • The src argument refers to an array with a reference component type and the dst argument refers to an array with a primitive component type.

Otherwise, if any of the following is true, an ArrayIndexOutOfBoundsException is thrown and the destination is not modified:

  • The srcOffset argument is negative.
  • The dstOffset argument is negative.
  • The length argument is negative.
  • srcOffset+length is greater than src.length, the length of the source array.
  • dstOffset+length is greater than dst.length, the length of the destination array.

Otherwise, if any actual component of the source array from position srcOffset through srcOffset+length-1 cannot be converted to the component type of the destination array by assignment conversion, an ArrayStoreException is thrown. In this case, let k be the smallest nonnegative integer less than length such that src[srcOffset+k] cannot be converted to the component type of the destination array; when the exception is thrown, source array components from positions srcOffset through srcOffset+k-1 will already have been copied to destination array positions dstOffset through dstOffset+k-1 and no other positions of the destination array will have been modified.

Exceptions
ArrayIndexOutOfBoundsException if copying would cause access of data outside array bounds.
Exceptions
ArrayStoreException if an element in the src array could not be stored into the dest array because of a type mismatch.


 System.currentTimeMillis

System.currentTimeMillis

Syntax
public static native long currentTimeMillis()
Returns
the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.
Description
Returns the current time in milliseconds.

See the description of the class Date for a discussion of slight discrepancies that may arise between "computer time" and coordinated universal time (UTC).

See Also
Date


 System.exit

System.exit

Syntax
public static void exit( int status )
Parameters
status
exit status.
Description
Terminates the currently running Java Virtual Machine. The argument serves as a status code; by convention, a nonzero status code indicates abnormal termination.

This method calls the exit method in class Runtime. This method never returns normally.

Exceptions
SecurityException if the current thread cannot exit with the specified status.
See Also
exit


 System.gc

System.gc

Syntax
public static void gc()
Description
Runs the garbage collector.

Calling the gc method suggests that the Java Virtual Machine expend effort toward recycling unused objects in order to make the memory they currently occupy available for quick reuse. When control returns from the method call, the Java Virtual Machine has made a best effort to reclaim space from all unused objects.

See Also
gc


 System.getenv

System.getenv

Syntax
public static String getenv( String name )
Parameters
the
name of the environment variable.
Returns
the value of the variable, or null if the variable is not defined.
Description
Note: getenv() is deprecated.

Gets an environment variable. An environment variable is a system dependent external variable that has a string value.


 System.getProperties

System.getProperties

Syntax
public static Properties getProperties()
Description
Determines the current system properties.

If there is a security manager, its checkPropertiesAccess method is called with no arguments. This may result in a security exception.

The current set of system properties is returned as a Properties object. If there is no current set of system properties, a set of system properties is first created and initialized.

This set of system properties always includes values for the following keys:

Key | Description of Associated Value
java.version | Java version number
java.vendor | Java vendor-specific string
java.vendor.url | Java vendor URL
java.home | Java installation directory
java.class.version | Java class format version number
java.class.path | Java class path
os.name | Operating system name
os.arch | Operating system architecture
os.version | Operating system version
file.separator | File separator ("/" on UNIX)
path.separator | Path separator (":" on UNIX)
line.separator | Line separator ("\n" on UNIX)
user.name | User's account name
user.home | User's home directory
user.dir | User's current working directory

Exceptions
SecurityException if the current thread cannot access the system properties.
See Also
SecurityException, checkPropertiesAccess, Properties


 System.getProperty

System.getProperty

Syntax 1
public static String getProperty( String key )
Parameters
key
the name of the system property.
Returns
the string value of the system property, or null if there is no property with that key.
Description
Gets the system property indicated by the specified key.

First, if there is a security manager, its checkPropertyAccess method is called with the key as its argument. This may result in a system exception.

If there is no current set of system properties, a set of system properties is first created and initialized in the same manner as for the getProperties method.

Exceptions
SecurityException if the current thread cannot access the system properties or the specified property.
See Also
SecurityException, checkPropertyAccess, getProperties

Syntax 2
public static String getProperty( String key, String def )
Parameters
key
the name of the system property.
def
a default value.
Returns
the string value of the system property, or the default value if there is no property with that key.
Description
Gets the system property indicated by the specified key.

First, if there is a security manager, its checkPropertyAccess method is called with the key as its argument.

If there is no current set of system properties, a set of system properties is first created and initialized in the same manner as for the getProperties method.

Exceptions
SecurityException if the current thread cannot access the system properties or the specified property.
See Also
checkPropertyAccess, getProperties


 System.getSecurityManager

System.getSecurityManager

Syntax
public static SecurityManager getSecurityManager()
Returns
if a security manager has already been established for the current application, then that security manager is returned; otherwise, null is returned.
Description
Gets the system security interface.


 System.identityHashCode

System.identityHashCode

Syntax
public static native int identityHashCode( Object x )
Description
Returns the same hashcode for the given object as would be returned by the default method hashCode(), whether or not the given object's class overrides hashCode(). The hashcode for the null reference is zero.


 System.load

System.load

Syntax
public static void load( String filename )
Parameters
filename
the file to load.
Description
Loads the specified filename as a dynamic library. The filename argument must be a complete pathname.

This method calls the load method in class Runtime.

Exceptions
SecurityException if the current thread cannot load the specified dynamic library.
Exceptions
UnsatisfiedLinkError if the file does not exist.
See Also
load


 System.loadLibrary

System.loadLibrary

Syntax
public static void loadLibrary( String libname )
Parameters
libname
the name of the library.
Description
Loads the system library specified by the libname argument. The manner in which a library name is mapped to the actual system library is system dependent.

Exceptions
SecurityException if the current thread cannot load the specified dynamic library.
Exceptions
UnsatisfiedLinkError if the library does not exist.
See Also
loadLibrary


 System.runFinalization

System.runFinalization

Syntax
public static void runFinalization()
Description
Runs the finalization methods of any objects pending finalization.

Calling this method suggests that the Java Virtual Machine expend effort toward running the finalize methods of objects that have been found to be discarded but whose finalize methods have not yet been run. When control returns from the method call, the Java Virtual Machine has made a best effort to complete all outstanding finalizations.

See Also
runFinalization


 System.runFinalizersOnExit

System.runFinalizersOnExit

Syntax
public static void runFinalizersOnExit( boolean value )
Description
Enable or disable finalization on exit; doing so specifies that the finalizers of all objects that have finalizers that have not yet been automatically invoked are to be run before the Java runtime exits. By default, finalization on exit is disabled.

See Also
exit, gc


 System.setErr

System.setErr

Syntax
public static void setErr( PrintStream err )
Description
Reassigns the "standard" error output stream.


 System.setIn

System.setIn

Syntax
public static void setIn( InputStream in )
Description
Reassigns the "standard" input stream.


 System.setOut

System.setOut

Syntax
public static void setOut( PrintStream out )
Description
Reassigns the "standard" output stream.


 System.setProperties

System.setProperties

Syntax
public static void setProperties( Properties props )
Parameters
props
the new system properties.
Description
Sets the system properties to the Properties argument.

First, if there is a security manager, its checkPropertiesAccess method is called with no arguments. This may result in a security exception.

The argument becomes the current set of system properties for use by the getProperty method. If the argument is null, then the current set of system properties is forgotten.

Exceptions
SecurityException if the current thread cannot set the system properties.
See Also
SecurityException, checkPropertiesAccess


 System.setSecurityManager

System.setSecurityManager

Syntax
public static void setSecurityManager( SecurityManager s )
Parameters
s
the security manager.
Description
Sets the System security. If a security manager has already been established for the currently running Java application, a SecurityException is thrown. Otherwise, the argument is established as the current security manager. If the argument is null and no security manager has been established, then no action is taken and the method simply returns.

Exceptions
SecurityException if the security manager has already been set.


 Class Thread

Class java.lang.Thread

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Thread

public class Thread
extends Object
implements Runnable

A thread is a thread of execution in a program. The Java Virtual Machine allows an application to have multiple threads of execution running concurrently.

Every thread has a priority. Threads with higher priority are executed in preference to threads with lower priority. Each thread may or may not also be marked as a daemon. When code running in some thread creates a new Thread object, the new thread has its priority initially set equal to the priority of the creating thread, and is a daemon thread if and only if the creating thread is a daemon.

When a Java Virtual Machine starts up, there is usually a single non-daemon thread (which typically calls the method named main of some designated class). The Java Virtual Machine continues to execute threads until either of the following occurs:

  • The exit method of class Runtime has been called and the security manager has permitted the exit operation to take place.
  • All threads that are not daemon threads have died, either by returning from the call to the run method or by performing the stop method.

There are two ways to create a new thread of execution. One is to declare a class to be a subclass of Thread. This subclass should override the run method of class Thread. An instance of the subclass can then be allocated and started. For example, a thread that computes primes larger than a stated value could be written as follows:

     class PrimeThread extends Thread {
         long minPrime;
         PrimeThread(long minPrime) {
             this.minPrime = minPrime;
         }
         public void run() {
             // compute primes larger than minPrime
              . . .
         }
     }

The following code would then create a thread and start it running:

     PrimeThread p = new PrimeThread(143);
     p.start();

The other way to create a thread is to declare a class that implements the Runnable interface. That class then implements the run method. An instance of the class can then be allocated, passed as an argument when creating Thread, and started. The same example in this other style looks like the following:

     class PrimeRun implements Runnable {
         long minPrime;
         PrimeRun(long minPrime) {
             this.minPrime = minPrime;
         }
         public void run() {
             // compute primes larger than minPrime
              . . .
         }
     }

The following code would then create a thread and start it running:

     PrimeRun p = new PrimeRun(143);
     new Thread(p).start();

Every thread has a name for identification purposes. More than one thread may have the same name. If a name is not specified when a thread is created, a new name is generated for it.

See Also:
Runnable, exit, run, stop


 Thread Members

Thread Members

Class Overview | This Package | All Packages

Fields
Name | Description
MAX_PRIORITY | The maximum priority that a thread can have.
MIN_PRIORITY | The minimum priority that a thread can have.
NORM_PRIORITY | The default priority that is assigned to a thread.

Constructors
Name | Description
Thread() | Allocates a new Thread object.
Thread(Runnable) | Allocates a new Thread object.
Thread(Runnable, String) | Allocates a new Thread object.
Thread(String) | Allocates a new Thread object.
Thread(ThreadGroup, Runnable) | Allocates a new Thread object.
Thread(ThreadGroup, Runnable, String) | Allocates a new Thread object so that it has target as its run object, has the specified name as its name, and belongs to the thread group referred to by group.
Thread(ThreadGroup, String) | Allocates a new Thread object.

Methods
Name | Description
activeCount() | Returns the current number of active threads in this thread group.
checkAccess() | Determines if the currently running thread has permission to modify this thread.
countStackFrames() | Counts the number of stack frames in this thread.
currentThread() | Returns a reference to the currently executing thread object.
destroy() | Destroys this thread, without any cleanup.
dumpStack() | Prints a stack trace of the current thread.
enumerate(Thread[]) | Copies into the specified array every active thread in this thread group and its subgroups.
getName() | Returns this thread's name.
getPriority() | Returns this thread's priority.
getThreadGroup() | Returns this thread's thread group.
interrupt() | Interrupts this thread.
interrupted() | Tests if the current thread has been interrupted.
isAlive() | Tests if this thread is alive.
isDaemon() | Tests if this thread is a daemon thread.
isInterrupted() | Tests if the current thread has been interrupted.
join() | Waits for this thread to die.
join(long) | Waits at most millis milliseconds for this thread to die.
join(long, int) | Waits at most millis milliseconds plus nanos nanoseconds for this thread to die.
resume() | Resumes a suspended thread.
run() | If this thread was constructed using a separate Runnable run object, then that Runnable object's run method is called; otherwise, this method does nothing and returns.
setDaemon(boolean) | Marks this thread as either a daemon thread or a user thread.
setName(String) | Changes the name of this thread to be equal to the argument name.
setPriority(int) | Changes the priority of this thread.
sleep(long) | Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds.
sleep(long, int) | Causes the currently executing thread to sleep (cease execution) for the specified number of milliseconds plus the specified number of nanoseconds.
start() | Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread.
stop() | Forces the thread to stop executing.
stop(Throwable) | Forces the thread to stop executing.
suspend() | Suspends this thread.
toString() | Returns a string representation of this thread, including the thread's name, priority, and thread group.
yield() | Causes the currently executing thread object to temporarily pause and allow other threads to execute.


 Thread.MAX_PRIORITY

Thread.MAX_PRIORITY

Syntax
public static final int MAX_PRIORITY
Description
The maximum priority that a thread can have.


 Thread.MIN_PRIORITY

Thread.MIN_PRIORITY

Syntax
public static final int MIN_PRIORITY
Description
The minimum priority that a thread can have.


 Thread.NORM_PRIORITY

Thread.NORM_PRIORITY

Syntax
public static final int NORM_PRIORITY
Description
The default priority that is assigned to a thread.


 Thread.Thread

Thread.Thread

Syntax 1
public Thread()
Description
Allocates a new Thread object. This constructor has the same effect as Thread(null, null, gname), where gname is a newly generated name. Automatically generated names are of the form "Thread-"+n, where n is an integer.

Threads created this way must have overridden their run() method to actually do anything. An example illustrating this method being used follows:

     import java.lang.*;
     class plain01 implements Runnable {
         String name;
         plain01() {
             name = null;
         }
         plain01(String s) {
             name = s;
         }
         public void run() {
             if (name == null)
                 System.out.println("A new thread created");
             else
                 System.out.println("A new thread with name " + name +
                                    " created");
         }
     }
     class threadtest01 {
         public static void main(String args[] ) {
             int failed = 0 ;
             Thread t1 = new Thread();
             if (t1 != null)
                 System.out.println("new Thread() succeed");
             else {
                 System.out.println("new Thread() failed");
                 failed++;
             }
         }
     }

See Also
Thread

Syntax 2
public Thread( Runnable target )
Parameters
target
the object whose run method is called.
Description
Allocates a new Thread object. This constructor has the same effect as Thread(null, target, gname), where gname is a newly generated name. Automatically generated names are of the form "Thread-"+n, where n is an integer.

See Also
Thread

Syntax 3
public Thread( ThreadGroup group, Runnable target )
Parameters
group
the thread group.
target
the object whose run method is called.
Description
Allocates a new Thread object. This constructor has the same effect as Thread(group, target, gname), where gname is a newly generated name. Automatically generated names are of the form "Thread-"+n, where n is an integer.

Exceptions
SecurityException if the current thread cannot create a thread in the specified thread group.
See Also
Thread

Syntax 4
public Thread( String name )
Parameters
name
the name of the new thread.
Description
Allocates a new Thread object. This constructor has the same effect as Thread(null, null, name).

See Also
Thread

Syntax 5
public Thread( ThreadGroup group, String name )
Parameters
group
the thread group.
name
the name of the new thread.
Description
Allocates a new Thread object. This constructor has the same effect as Thread(group, null, name)

Exceptions
SecurityException if the current thread cannot create a thread in the specified thread group.
See Also
Thread

Syntax 6
public Thread( Runnable target, String name )
Parameters
target
the object whose run method is called.
name
the name of the new thread.
Description
Allocates a new Thread object. This constructor has the same effect as Thread(null, target, name).

See Also
Thread

Syntax 7
public Thread( ThreadGroup group, Runnable target, String name )
Parameters
group
the thread group.
target
the object whose run method is called.
name
the name of the new thread.
Description
Allocates a new Thread object so that it has target as its run object, has the specified name as its name, and belongs to the thread group referred to by group.

If group is not null, the checkAccess method of that thread group is called with no arguments; this may result in throwing a SecurityException; if group is null, the new process belongs to the same group as the thread that is creating the new thread.

If the target argument is not null, the run method of the target is called when this thread is started. If the target argument is null, this thread's run method is called when this thread is started.

The priority of the newly created thread is set equal to the priority of the thread creating it, that is, the currently running thread. The method setPriority may be used to change the priority to a new value.

The newly created thread is initially marked as being a daemon thread if and only if the thread creating it is currently marked as a daemon thread. The method setDaemon may be used to change whether or not a thread is a daemon.

Exceptions
SecurityException if the current thread cannot create a thread in the specified thread group.
See Also
run, run, setDaemon, setPriority, checkAccess


 Thread.activeCount

Thread.activeCount

Syntax
public static int activeCount()
Returns
the current number of threads in this thread's thread group.
Description
Returns the current number of active threads in this thread group.


 Thread.checkAccess

Thread.checkAccess

Syntax
public void checkAccess()
Description
Determines if the currently running thread has permission to modify this thread.

If there is a security manager, its checkAccess method is called with this thread as its argument. This may result in throwing a SecurityException.

Exceptions
SecurityException if the current thread is not allowed to access this thread.
See Also
checkAccess


 Thread.countStackFrames

Thread.countStackFrames

Syntax
public native int countStackFrames()
Returns
the number of stack frames in this thread.
Description
Counts the number of stack frames in this thread. The thread must be suspended.

Exceptions
IllegalThreadStateException if this thread is not suspended.


 Thread.currentThread

Thread.currentThread

Syntax
public static native Thread currentThread()
Returns
the currently executing thread.
Description
Returns a reference to the currently executing thread object.


 Thread.destroy

Thread.destroy

Syntax
public void destroy()
Description
Destroys this thread, without any cleanup. Any monitors it has locked remain locked. (This method is not implemented in Java 1.0.2.)


 Thread.dumpStack

Thread.dumpStack

Syntax
public static void dumpStack()
Description
Prints a stack trace of the current thread. This method is used only for debugging.

See Also
printStackTrace


 Thread.enumerate

Thread.enumerate

Syntax
public static int enumerate( Thread tarray[] )
Returns
the number of threads put into the array.
Description
Copies into the specified array every active thread in this thread group and its subgroups. This method simply calls the enumerate method of this thread's thread group with the array argument.

See Also
enumerate


 Thread.getName

Thread.getName

Syntax
public final String getName()
Returns
this thread's name.
Description
Returns this thread's name.

See Also
setName


 Thread.getPriority

Thread.getPriority

Syntax
public final int getPriority()
Returns
this thread's name.
Description
Returns this thread's priority.

See Also
setPriority


 Thread.getThreadGroup

Thread.getThreadGroup

Syntax
public final ThreadGroup getThreadGroup()
Returns
this thread's thread group.
Description
Returns this thread's thread group.


 Thread.interrupt

Thread.interrupt

Syntax
public void interrupt()
Description
Interrupts this thread.


 Thread.interrupted

Thread.interrupted

Syntax
public static boolean interrupted()
Returns
true if the current thread has been interrupted; false otherwise.
Description
Tests if the current thread has been interrupted. Note that interrupted is a static method, while isInterrupted is called on the current Thread instance.

See Also
isInterrupted


 Thread.isAlive

Thread.isAlive

Syntax
public final native boolean isAlive()
Returns
true if this thread is alive; false otherwise.
Description
Tests if this thread is alive. A thread is alive if it has been started and has not yet died.


 Thread.isDaemon

Thread.isDaemon

Syntax
public final boolean isDaemon()
Returns
true if this thread is a daemon thread; false otherwise.
Description
Tests if this thread is a daemon thread.

See Also
setDaemon


 Thread.isInterrupted

Thread.isInterrupted

Syntax
public boolean isInterrupted()
Returns
true if this thread has been interrupted; false otherwise.
Description
Tests if the current thread has been interrupted. Note that isInterrupted is called on the current Thread instance; by contrast, interrupted is a static method.

See Also
interrupted


 Thread.join

Thread.join

Syntax 1
public final synchronized void join( long millis ) throws InterruptedException
Parameters
millis
the time to wait in milliseconds.
Description
Waits at most millis milliseconds for this thread to die. A timeout of 0 means to wait forever.

Exceptions
InterruptedException if another thread has interrupted the current thread.

Syntax 2
public final synchronized void join( long millis, int nanos ) throws InterruptedException
Parameters
millis
the time to wait in milliseconds.
nanos
0-999999 additional nanoseconds to wait.
Description
Waits at most millis milliseconds plus nanos nanoseconds for this thread to die.

Exceptions
IllegalArgumentException if the value of millis is negative the value of nanos is not in the range 0-999999.
Exceptions
InterruptedException if another thread has interrupted the current thread.

Syntax 3
public final void join() throws InterruptedException
Description
Waits for this thread to die.

Exceptions
InterruptedException if another thread has interrupted the current thread.


 Thread.resume

Thread.resume

Syntax
public final void resume()
Description
Resumes a suspended thread.

First, the checkAccess method of this thread is called with no arguments. This may result in throwing a SecurityException(in the current thread).

If the thread is alive but suspended, it is resumed and is permitted to make progress in its execution.

Exceptions
SecurityException if the current thread cannot modify this thread.
See Also
checkAccess, isAlive


 Thread.run

Thread.run

Syntax
public void run()
Description
If this thread was constructed using a separate Runnable run object, then that Runnable object's run method is called; otherwise, this method does nothing and returns.

Subclasses of Thread should override this method.

See Also
start, stop, Thread, run


 Thread.setDaemon

Thread.setDaemon

Syntax
public final void setDaemon( boolean on )
Parameters
on
if true, marks this thread as a daemon thread.
Description
Marks this thread as either a daemon thread or a user thread. The Java Virtual Machine exits when the only threads running are all daemon threads.

This method must be called before the thread is started.

Exceptions
IllegalThreadStateException if this thread is active.
See Also
isDaemon


 Thread.setName

Thread.setName

Syntax
public final void setName( String name )
Parameters
name
the new name for this thread.
Description
Changes the name of this thread to be equal to the argument name.

First the checkAccess method of this thread is called with no arguments. This may result in throwing a SecurityException.

Exceptions
SecurityException if the current thread cannot modify this thread.
See Also
checkAccess, getName


 Thread.setPriority

Thread.setPriority

Syntax
public final void setPriority( int newPriority )
Description
Changes the priority of this thread.

First the checkAccess method of this thread is called with no arguments. This may result in throwing a SecurityException.

Otherwise, the priority of this thread is set to the smaller of the specified newPriority and the maximum permitted priority of the thread's thread group.

Exceptions
IllegalArgumentException If the priority is not in the range MIN_PRIORITY to MAX_PRIORITY.
Exceptions
SecurityException if the current thread cannot modify this thread.
See Also
checkAccess, getPriority, getThreadGroup, MAX_PRIORITY, MIN_PRIORITY, getMaxPriority


 Thread.sleep

Thread.sleep

Syntax 1
public static native void sleep( long millis ) throws InterruptedException
Parameters
millis
the length of time to sleep in milliseconds.
Description
Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds. The thread does not lose ownership of any monitors.

Exceptions
InterruptedException if another thread has interrupted this thread.
See Also
notify

Syntax 2
public static void sleep( long millis, int nanos ) throws InterruptedException
Parameters
millis
the length of time to sleep in milliseconds.
nanos
0-999999 additional nanoseconds to sleep.
Description
Causes the currently executing thread to sleep (cease execution) for the specified number of milliseconds plus the specified number of nanoseconds. The thread does not lose ownership of any monitors.

Exceptions
IllegalArgumentException if the value of millis is negative or the value of nanos is not in the range 0-999999.
Exceptions
InterruptedException if another thread has interrupted this thread.
See Also
notify


 Thread.start

Thread.start

Syntax
public native synchronized void start()
Description
Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread.

The result is that two threads are running concurrently: the current thread (which returns from the call to the start method) and the other thread (which executes its run method).

Exceptions
IllegalThreadStateException if the thread was already started.
See Also
run, stop


 Thread.stop

Thread.stop

Syntax 1
public final void stop()
Description
Forces the thread to stop executing.

First, the checkAccess method of this thread is called with no arguments. This may result in throwing a SecurityException (in the current thread).

The thread represented by this thread is forced to stop whatever it is doing abnormally and to throw a newly created ThreadDeath object as an exception.

It is permitted to stop a thread that has not yet been started. If the thread is eventually started, it immediately terminates.

An application should not normally try to catch ThreadDeath unless it must do some extraordinary cleanup operation (note that the throwing of ThreadDeath causes finally clauses of try statements to be executed before the thread officially dies). If a catch clause catches a ThreadDeath object, it is important to rethrow the object so that the thread actually dies.

The top-level error handler that reacts to otherwise uncaught exceptions does not print out a message or otherwise notify the application if the uncaught exception is an instance of ThreadDeath.

Exceptions
SecurityException if the current thread cannot modify this thread.
See Also
checkAccess, run, start, ThreadDeath, uncaughtException

Syntax 2
public final synchronized void stop( Throwable o )
Parameters
obj
the Throwable object to be thrown.
Description
Forces the thread to stop executing.

First, the checkAccess method of this thread is called with no arguments. This may result in throwing a SecurityException (in the current thread).

If the argument obj is null, a NullPointerException is thrown (in the current thread).

The thread represented by this thread is forced to complete whatever it is doing abnormally and to throw the Throwable object obj as an exception. This is an unusual action to take; normally, the stop method that takes no arguments should be used.

It is permitted to stop a thread that has not yet been started. If the thread is eventually started, it immediately terminates.

Exceptions
SecurityException if the current thread cannot modify this thread.
See Also
checkAccess, run, start, stop


 Thread.suspend

Thread.suspend

Syntax
public final void suspend()
Description
Suspends this thread.

First, the checkAccess method of this thread is called with no arguments. This may result in throwing a SecurityException (in the current thread).

If the thread is alive, it is suspended and makes no further progress unless and until it is resumed.

Exceptions
SecurityException if the current thread cannot modify this thread.
See Also
checkAccess, isAlive


 Thread.toString

Thread.toString

Syntax
public String toString()
Returns
a string representation of this thread.
Description
Returns a string representation of this thread, including the thread's name, priority, and thread group.

Overrides
toString in class Object


 Thread.yield

Thread.yield

Syntax
public static native void yield()
Description
Causes the currently executing thread object to temporarily pause and allow other threads to execute.


 Class ThreadDeath

Class java.lang.ThreadDeath

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.ThreadDeath

public class ThreadDeath
extends Error

An instance of ThreadDeath is thrown in the victim thread when the stop method with zero arguments in class Thread is called.

An application should catch instances of this class only if it must clean up after being terminated asynchronously. If ThreadDeath is caught by a method, it is important that it be rethrown so that the thread actually dies.

The top-level error handler does not print out a message if ThreadDeath is never caught.

The class ThreadDeath is specifically a subclass of Error rather than Exception, even though it is a "normal occurrence", because many applications catch all occurrences of Exception and then discard the exception.

See Also:
stop


 ThreadDeath Members

ThreadDeath Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ThreadDeath() |


 ThreadDeath.ThreadDeath

ThreadDeath.ThreadDeath

Syntax
public ThreadDeath()


 Class ThreadGroup

Class java.lang.ThreadGroup

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.ThreadGroup

public class ThreadGroup
extends Object

A thread group represents a set of threads. In addition, a thread group can also include other thread groups. The thread groups form a tree in which every thread group except the initial thread group has a parent.

A thread is allowed to access information about its own thread group, but not to access information about its thread group's parent thread group or any other thread groups.


 ThreadGroup Members

ThreadGroup Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ThreadGroup(String) | Constructs a new thread group.
ThreadGroup(ThreadGroup, String) | Creates a new thread group.

Methods
Name | Description
activeCount() | Returns an estimate of the number of active threads in this thread group.
activeGroupCount() | Returns an estimate of the number of active groups in this thread group.
allowThreadSuspension(boolean) | Used by VM to control lowmem implicit suspension.
checkAccess() | Determines if the currently running thread has permission to modify this thread group.
destroy() | Destroys this thread group and all of its subgroups.
enumerate(Thread[]) | Copies into the specified array every active thread in this thread group and its subgroups.
enumerate(Thread[], boolean) | Copies into the specified array every active thread in this thread group.
enumerate(ThreadGroup[]) | Copies into the specified array references to every active subgroup in this thread group.
enumerate(ThreadGroup[], boolean) | Copies into the specified array references to every active subgroup in this thread group.
getMaxPriority() | Returns the maximum priority of this thread group.
getName() | Returns the name of this thread group.
getParent() | Returns the parent of this thread group.
isDaemon() | Tests if this thread group is a daemon thread group.
isDestroyed() | Tests if this thread group has been destroyed.
list() | Prints information about this thread group to the standard output.
parentOf(ThreadGroup) | Tests if this thread group is either the thread group argument or one of its ancestor thread groups.
resume() | Resumes all processes in this thread group.
setDaemon(boolean) | Changes the daemon status of this thread group.
setMaxPriority(int) | Sets the maximum priority of the group.
stop() | Stops all processes in this thread group.
suspend() | Suspends all processes in this thread group.
toString() | Returns a string representation of this Thread group.
uncaughtException(Thread, Throwable) | Called by the Java Virtual Machine when a thread in this thread group stops because of an uncaught exception.


 ThreadGroup.ThreadGroup

ThreadGroup.ThreadGroup

Syntax 1
public ThreadGroup( String name )
Parameters
name
the name of the new thread group.
Description
Constructs a new thread group. The parent of this new group is the thread group of the currently running thread.

Syntax 2
public ThreadGroup( ThreadGroup parent, String name )
Parameters
parent
the parent thread group.
name
the name of the new thread group.
Description
Creates a new thread group. The parent of this new group is the specified thread group.

The checkAccess method of the parent thread group is called with no arguments; this may result in a security exception.

Exceptions
NullPointerException if the thread group argument is null.
Exceptions
SecurityException if the current thread cannot create a thread in the specified thread group.
See Also
SecurityException, checkAccess


 ThreadGroup.activeCount

ThreadGroup.activeCount

Syntax
public int activeCount()
Returns
the number of active threads in this thread group and in any other thread group that has this thread group as an ancestor.
Description
Returns an estimate of the number of active threads in this thread group.


 ThreadGroup.activeGroupCount

ThreadGroup.activeGroupCount

Syntax
public int activeGroupCount()
Returns
the number of active thread groups with this thread group as an ancestor.
Description
Returns an estimate of the number of active groups in this thread group.


 ThreadGroup.allowThreadSuspension

ThreadGroup.allowThreadSuspension

Syntax
public boolean allowThreadSuspension( boolean b )
Description
Used by VM to control lowmem implicit suspension.


 ThreadGroup.checkAccess

ThreadGroup.checkAccess

Syntax
public final void checkAccess()
Description
Determines if the currently running thread has permission to modify this thread group.

If there is a security manager, its checkAccess method is called with this thread group as its argument. This may result in throwing a SecurityException.

Exceptions
SecurityException if the current thread is not allowed to access this thread group.
See Also
checkAccess


 ThreadGroup.destroy

ThreadGroup.destroy

Syntax
public final void destroy()
Description
Destroys this thread group and all of its subgroups. This thread group must be empty, indicating that all threads that had been in this thread group have since stopped.

Exceptions
IllegalThreadStateException if the thread group is not empty or if the thread group has already been destroyed.
Exceptions
SecurityException if the current thread cannot modify this thread group.


 ThreadGroup.enumerate

ThreadGroup.enumerate

Syntax 1
public int enumerate( Thread list[] )
Parameters
list
an array into which to place the list of threads.
Returns
the number of threads put into the array.
Description
Copies into the specified array every active thread in this thread group and its subgroups.

An application should use the activeCount method to get an estimate of how big the array should be. If the array is too short to hold all the threads, the extra threads are silently ignored.

See Also
activeCount

Syntax 2
public int enumerate( Thread list[], boolean recurse )
Parameters
list
an array into which to place the list of threads.
recurse
a flag indicating whether also to include threads in thread groups that are subgroups of this thread group.
Returns
the number of threads placed into the array.
Description
Copies into the specified array every active thread in this thread group. If the recurse flag is true, references to every active thread in this thread's subgroups are also included. If the array is too short to hold all the threads, the extra threads are silently ignored.

An application should use the activeCount method to get an estimate of how big the array should be.

See Also
activeCount


 ThreadGroup.enumerate

ThreadGroup.enumerate

Syntax
public int enumerate( ThreadGroup list[] )
Parameters
list
an array into which to place the list of thread groups.
Returns
the number of thread groups put into the array.
Description
Copies into the specified array references to every active subgroup in this thread group.

An application should use the activeGroupCount method to get an estimate of how big the array should be. If the array is too short to hold all the thread groups, the extra thread groups are silently ignored.

See Also
activeGroupCount


 ThreadGroup.enumerate

ThreadGroup.enumerate

Syntax
public int enumerate( ThreadGroup list[], boolean recurse )
Parameters
list
an array into which to place the list of threads.
recurse
a flag indicating whether to recursively enumerate all included thread groups.
Returns
the number of thread groups put into the array.
Description
Copies into the specified array references to every active subgroup in this thread group. If the recurse flag is true, references to all active subgroups of the subgroups and so forth are also included.

An application should use the activeGroupCount method to get an estimate of how big the array should be.

See Also
activeGroupCount


 ThreadGroup.getMaxPriority

ThreadGroup.getMaxPriority

Syntax
public final int getMaxPriority()
Returns
the maximum priority that a thread in this thread group can have.
Description
Returns the maximum priority of this thread group. Threads that are part of this group cannot have a higher priority than the maximum priority.


 ThreadGroup.getName

ThreadGroup.getName

Syntax
public final String getName()
Returns
the name of this thread group.
Description
Returns the name of this thread group.


 ThreadGroup.getParent

ThreadGroup.getParent

Syntax
public final ThreadGroup getParent()
Returns
the parent of this thread group. The top-level thread group is the only thread group whose parent is null.
Description
Returns the parent of this thread group.


 ThreadGroup.isDaemon

ThreadGroup.isDaemon

Syntax
public final boolean isDaemon()
Returns
true if this thread group is a daemon thread group; false otherwise.
Description
Tests if this thread group is a daemon thread group. A daemon thread group is automatically destroyed when its last thread is stopped or its last thread group is destroyed.


 ThreadGroup.isDestroyed

ThreadGroup.isDestroyed

Syntax
public synchronized boolean isDestroyed()
Description
Tests if this thread group has been destroyed.


 ThreadGroup.list

ThreadGroup.list

Syntax
public void list()
Description
Prints information about this thread group to the standard output. This method is useful only for debugging.


 ThreadGroup.parentOf

ThreadGroup.parentOf

Syntax
public final boolean parentOf( ThreadGroup g )
Parameters
g
a thread group.
Returns
true if this thread group is the thread group argument or one of its ancestor thread groups; false otherwise.
Description
Tests if this thread group is either the thread group argument or one of its ancestor thread groups.


 ThreadGroup.resume

ThreadGroup.resume

Syntax
public final void resume()
Description
Resumes all processes in this thread group.

First, the checkAccess method of this thread group is called with no arguments; this may result in a security exception.

This method then calls the resume method on all the threads in this thread group and in all of its sub groups.

Exceptions
SecurityException if the current thread is not allowed to access this thread group or any of the threads in the thread group.
See Also
SecurityException, resume, checkAccess


 ThreadGroup.setDaemon

ThreadGroup.setDaemon

Syntax
public final void setDaemon( boolean daemon )
Parameters
daemon
if true, marks this thread group as a daemon thread group; otherwise, marks this thread group as normal.
Description
Changes the daemon status of this thread group.

First, the checkAccess method of this thread group is called with no arguments; this may result in a security exception.

A daemon thread group is automatically destroyed when its last thread is stopped or its last thread group is destroyed.

Exceptions
SecurityException if the current thread cannot modify this thread.
See Also
SecurityException, checkAccess


 ThreadGroup.setMaxPriority

ThreadGroup.setMaxPriority

Syntax
public final void setMaxPriority( int pri )
Parameters
pri
the new priority of the thread group.
Description
Sets the maximum priority of the group.

First, the checkAccess method of this thread group is called with no arguments; this may result in a security exception.

Threads in the thread group that already have a higher priority are not affected.

Exceptions
SecurityException if the current thread cannot modify this thread group.
See Also
SecurityException, checkAccess


 ThreadGroup.stop

ThreadGroup.stop

Syntax
public final void stop()
Description
Stops all processes in this thread group.

First, the checkAccess method of this thread group is called with no arguments; this may result in a security exception.

This method then calls the stop method on all the threads in this thread group and in all of its subgroups.

Exceptions
SecurityException if the current thread is not allowed to access this thread group or any of the threads in the thread group.
See Also
SecurityException, stop, checkAccess


 ThreadGroup.suspend

ThreadGroup.suspend

Syntax
public final void suspend()
Description
Suspends all processes in this thread group.

First, the checkAccess method of this thread group is called with no arguments; this may result in a security exception.

This method then calls the suspend method on all the threads in this thread group and in all of its subgroups.

Exceptions
SecurityException if the current thread is not allowed to access this thread group or any of the threads in the thread group.
See Also
SecurityException, suspend, checkAccess


 ThreadGroup.toString

ThreadGroup.toString

Syntax
public String toString()
Returns
a string representation of this thread group.
Description
Returns a string representation of this Thread group.

Overrides
toString in class Object


 ThreadGroup.uncaughtException

ThreadGroup.uncaughtException

Syntax
public void uncaughtException( Thread t, Throwable e )
Parameters
t
the thread that is about to exit.
e
the uncaught exception.
Description
Called by the Java Virtual Machine when a thread in this thread group stops because of an uncaught exception.

The uncaughtException method of ThreadGroup does the following:

  • If this thread group has a parent thread group, the uncaughtException method of that parent is called with the same two arguments.
  • Otherwise, this method determines if the Throwable argument is an instance of ThreadDeath. If so, nothing special is done. Otherwise, the Throwable's printStackTrace method is called to print a stack backtrace to the standard error stream.

Applications can override this method in subclasses of ThreadGroup to provide alternative handling of uncaught exceptions.

See Also
err, ThreadDeath, printStackTrace


 Class Throwable

Class java.lang.Throwable

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable

public class Throwable
extends Object
implements Serializable

The Throwable class is the superclass of all errors and exceptions in the Java language. Only objects that are instances of this class (or of one of its subclasses) are thrown by the Java Virtual Machine or can be thrown by the Java throw statement. Similarly, only this class or one of its subclasses can be the argument type in a catch clause.

A Throwable class contains a snapshot of the execution stack of its thread at the time it was created. It can also contain a message string that gives more information about the error.

Here is one example of catching an exception:

     try {
         int a[] = new int[2];
         a[4];
     } catch (ArrayIndexOutOfBoundsException e) {
         System.out.println("exception: " + e.getMessage());
         e.printStackTrace();
     }


 Throwable Members

Throwable Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Throwable() | Constructs a new Throwable with no detail message.
Throwable(String) | Constructs a new Throwable with the specified detail message.

Methods
Name | Description
fillInStackTrace() | Fills in the execution stack trace.
getLocalizedMessage() | Creates a localized description of this Throwable.
getMessage() | Returns the detail message of this throwable object.
printStackTrace() | Prints this Throwable and its backtrace to the standard error stream.
printStackTrace(PrintStream) | Prints this Throwable and its backtrace to the specified print stream.
printStackTrace(PrintWriter) | Prints this Throwable and its backtrace to the specified print writer.
toString() | Returns a short description of this throwable object.


 Throwable.Throwable

Throwable.Throwable

Syntax 1
public Throwable()
Description
Constructs a new Throwable with no detail message. The stack trace is automatically filled in.

Syntax 2
public Throwable( String message )
Parameters
message
the detail message.
Description
Constructs a new Throwable with the specified detail message. The stack trace is automatically filled in.


 Throwable.fillInStackTrace

Throwable.fillInStackTrace

Syntax
public native Throwable fillInStackTrace()
Returns
this Throwable object.
Description
Fills in the execution stack trace. This method is useful when an application is re-throwing an error or exception. For example:

     try {
         a = b / c;
     } catch(ArithmeticThrowable e) {
         a = Number.MAX_VALUE;
         throw e.fillInStackTrace();
     }

See Also
printStackTrace


 Throwable.getLocalizedMessage

Throwable.getLocalizedMessage

Syntax
public String getLocalizedMessage()
Description
Creates a localized description of this Throwable. Subclasses may override this method in order to produce a locale-specific message. For subclasses that do not override this method, the default implementation returns the same result as getMessage().


 Throwable.getMessage

Throwable.getMessage

Syntax
public String getMessage()
Returns
the detail message of this Throwable, or null if this Throwable does not have a detail message.
Description
Returns the detail message of this throwable object.


 Throwable.printStackTrace

Throwable.printStackTrace

Syntax 1
public void printStackTrace()
Description
Prints this Throwable and its backtrace to the standard error stream.

See Also
err

Syntax 2
public void printStackTrace( PrintStream s )
Description
Prints this Throwable and its backtrace to the specified print stream.

Syntax 3
public void printStackTrace( PrintWriter s )
Description
Prints this Throwable and its backtrace to the specified print writer.


 Throwable.toString

Throwable.toString

Syntax
public String toString()
Returns
a string representation of this Throwable.
Description
Returns a short description of this throwable object.

Overrides
toString in class Object


 Class UnknownError

Class java.lang.UnknownError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.VirtualMachineError
                           |
                           +----java.lang.UnknownError

public class UnknownError
extends VirtualMachineError

Thrown when an unknown but serious exception has occurred in the Java Virtual Machine.


 UnknownError Members

UnknownError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
UnknownError() | Constructs an UnknownError with no detail message.
UnknownError(String) | Constructs an UnknownError with the specified detail message.


 UnknownError.UnknownError

UnknownError.UnknownError

Syntax 1
public UnknownError()
Description
Constructs an UnknownError with no detail message.

Syntax 2
public UnknownError( String s )
Parameters
s
the detail message.
Description
Constructs an UnknownError with the specified detail message.


 Class UnsatisfiedLinkError

Class java.lang.UnsatisfiedLinkError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.LinkageError
                           |
                           +----java.lang.UnsatisfiedLinkError

public class UnsatisfiedLinkError
extends LinkageError

Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native.

See Also:
Runtime


 UnsatisfiedLinkError Members

UnsatisfiedLinkError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
UnsatisfiedLinkError() | Constructs an UnsatisfiedLinkError with no detail message.
UnsatisfiedLinkError(String) | Constructs an UnsatisfiedLinkError with the specified detail message.


 UnsatisfiedLinkError.UnsatisfiedLinkError

UnsatisfiedLinkError.UnsatisfiedLinkError

Syntax 1
public UnsatisfiedLinkError()
Description
Constructs an UnsatisfiedLinkError with no detail message.

Syntax 2
public UnsatisfiedLinkError( String s )
Parameters
s
the detail message.
Description
Constructs an UnsatisfiedLinkError with the specified detail message.


 Class VerifyError

Class java.lang.VerifyError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.LinkageError
                           |
                           +----java.lang.VerifyError

public class VerifyError
extends LinkageError

Thrown when the "verifier" detects that a class file, though well formed, contains some sort of internal inconsistency or security problem.


 VerifyError Members

VerifyError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
VerifyError() | Constructs an VerifyError with no detail message.
VerifyError(String) | Constructs an VerifyError with the specified detail message.


 VerifyError.VerifyError

VerifyError.VerifyError

Syntax 1
public VerifyError()
Description
Constructs an VerifyError with no detail message.

Syntax 2
public VerifyError( String s )
Parameters
s
the detail message.
Description
Constructs an VerifyError with the specified detail message.


 Class VirtualMachineError

Class java.lang.VirtualMachineError

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Error
                   |
                   +----java.lang.VirtualMachineError

public abstract class VirtualMachineError
extends Error

Thrown to indicate that the Java Virtual Machine is broken or has run out of resources necessary for it to continue operating.


 VirtualMachineError Members

VirtualMachineError Members

Class Overview | This Package | All Packages

Constructors
Name | Description
VirtualMachineError() | Constructs a VirtualMachineError with no detail message.
VirtualMachineError(String) | Constructs a VirtualMachineError with the specified detail message.


 VirtualMachineError.VirtualMachineError

VirtualMachineError.VirtualMachineError

Syntax 1
public VirtualMachineError()
Description
Constructs a VirtualMachineError with no detail message.

Syntax 2
public VirtualMachineError( String s )
Parameters
s
the detail message.
Description
Constructs a VirtualMachineError with the specified detail message.


 Class Void

Class java.lang.Void

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Void

public final class Void
extends Object

The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the primitive Java type void.


 Void Members

Void Members

Class Overview | This Package | All Packages

Fields
Name | Description
TYPE | The Class object representing the primitive Java type void.


 Void.TYPE

Void.TYPE

Syntax
public static final Class TYPE
Description
The Class object representing the primitive Java type void.


 Package java.lang.reflect

Package java.lang.reflect

All Packages

Interfaces

  • Member

    • Classes

  • Array
  • Constructor
  • Field
  • Method
  • Modifier

    • Exceptions

  • InvocationTargetException


 Class Array

Class java.lang.reflect.Array

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.reflect.Array

public final class Array
extends Object

The Array class provides static methods to dynamically create and access Java arrays.

Array permits widening conversions to occur during a get or set operation, but throws an IllegalArgumentException if a narrowing conversion would occur.


 Array Members

Array Members

Class Overview | This Package | All Packages

Methods
Name | Description
get(Object, int) | Returns the value of the indexed component in the specified array object.
getBoolean(Object, int) | Returns the value of the indexed component in the specified array object, as a boolean.
getByte(Object, int) | Returns the value of the indexed component in the specified array object, as a byte.
getChar(Object, int) | Returns the value of the indexed component in the specified array object, as a char.
getDouble(Object, int) | Returns the value of the indexed component in the specified array object, as a double.
getFloat(Object, int) | Returns the value of the indexed component in the specified array object, as a float.
getInt(Object, int) | Returns the value of the indexed component in the specified array object, as an int.
getLength(Object) | Returns the length of the specified array object, as an int.
getLong(Object, int) | Returns the value of the indexed component in the specified array object, as a long.
getShort(Object, int) | Returns the value of the indexed component in the specified array object, as a short.
newInstance(Class, int) | Creates a new array with the specified component type and length.
newInstance(Class, int[]) | Creates a new array with the specified component type and dimensions.
set(Object, int, Object) | Sets the value of the indexed component of the specified array object to the specified new value.
setBoolean(Object, int, boolean) | Sets the value of the indexed component of the specified array object to the specified boolean value.
setByte(Object, int, byte) | Sets the value of the indexed component of the specified array object to the specified boolean value.
setChar(Object, int, char) | Sets the value of the indexed component of the specified array object to the specified byte value.
setDouble(Object, int, double) | Sets the value of the indexed component of the specified array object to the specified double value.
setFloat(Object, int, float) | Sets the value of the indexed component of the specified array object to the specified float value.
setInt(Object, int, int) | Sets the value of the indexed component of the specified array object to the specified int value.
setLong(Object, int, long) | Sets the value of the indexed component of the specified array object to the specified long value.
setShort(Object, int, short) | Sets the value of the indexed component of the specified array object to the specified short value.


 Array.get

Array.get

Syntax
public static native Object get( Object array, int index ) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Parameters
array
the array
index
the index
Returns
the (possibly wrapped) value of the indexed component in the specified array
Description
Returns the value of the indexed component in the specified array object. The value is automatically wrapped in an object if it has a primitive type.

Exceptions
NullPointerException If the specified object is null
Exceptions
IllegalArgumentException If the specified object is not an array
Exceptions
ArrayIndexOutOfBoundsException If the specified index argument is negative, or if it is greater than or equal to the length of the specified array


 Array.getBoolean

Array.getBoolean

Syntax
public static native boolean getBoolean( Object array, int index ) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Parameters
array
the array
index
the index
Returns
the value of the indexed component in the specified array
Description
Returns the value of the indexed component in the specified array object, as a boolean.

Exceptions
NullPointerException If the specified object is null
Exceptions
IllegalArgumentException If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion
Exceptions
ArrayIndexOutOfBoundsException If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also
get


 Array.getByte

Array.getByte

Syntax
public static native byte getByte( Object array, int index ) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Parameters
array
the array
index
the index
Returns
the value of the indexed component in the specified array
Description
Returns the value of the indexed component in the specified array object, as a byte.

Exceptions
NullPointerException If the specified object is null
Exceptions
IllegalArgumentException If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion
Exceptions
ArrayIndexOutOfBoundsException If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also
get


 Array.getChar

Array.getChar

Syntax
public static native char getChar( Object array, int index ) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Parameters
array
the array
index
the index
Returns
the value of the indexed component in the specified array
Description
Returns the value of the indexed component in the specified array object, as a char.

Exceptions
NullPointerException If the specified object is null
Exceptions
IllegalArgumentException If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion
Exceptions
ArrayIndexOutOfBoundsException If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also
get


 Array.getDouble

Array.getDouble

Syntax
public static native double getDouble( Object array, int index ) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Parameters
array
the array
index
the index
Returns
the value of the indexed component in the specified array
Description
Returns the value of the indexed component in the specified array object, as a double.

Exceptions
NullPointerException If the specified object is null
Exceptions
IllegalArgumentException If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion
Exceptions
ArrayIndexOutOfBoundsException If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also
get


 Array.getFloat

Array.getFloat

Syntax
public static native float getFloat( Object array, int index ) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Parameters
array
the array
index
the index
Returns
the value of the indexed component in the specified array
Description
Returns the value of the indexed component in the specified array object, as a float.

Exceptions
NullPointerException If the specified object is null
Exceptions
IllegalArgumentException If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion
Exceptions
ArrayIndexOutOfBoundsException If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also
get


 Array.getInt

Array.getInt

Syntax
public static native int getInt( Object array, int index ) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Parameters
array
the array
index
the index
Returns
the value of the indexed component in the specified array
Description
Returns the value of the indexed component in the specified array object, as an int.

Exceptions
NullPointerException If the specified object is null
Exceptions
IllegalArgumentException If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion
Exceptions
ArrayIndexOutOfBoundsException If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also
get


 Array.getLength

Array.getLength

Syntax
public static native int getLength( Object array ) throws IllegalArgumentException
Parameters
array
the array
Returns
the length of the array
Description
Returns the length of the specified array object, as an int.

Exceptions
IllegalArgumentException if the object argument is not an array


 Array.getLong

Array.getLong

Syntax
public static native long getLong( Object array, int index ) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Parameters
array
the array
index
the index
Returns
the value of the indexed component in the specified array
Description
Returns the value of the indexed component in the specified array object, as a long.

Exceptions
NullPointerException If the specified object is null
Exceptions
IllegalArgumentException If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion
Exceptions
ArrayIndexOutOfBoundsException If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also
get


 Array.getShort

Array.getShort

Syntax
public static native short getShort( Object array, int index ) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Parameters
array
the array
index
the index
Returns
the value of the indexed component in the specified array
Description
Returns the value of the indexed component in the specified array object, as a short.

Exceptions
NullPointerException If the specified object is null
Exceptions
IllegalArgumentException If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion
Exceptions
ArrayIndexOutOfBoundsException If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also
get


 Array.newInstance

Array.newInstance

Syntax 1
public static Object newInstance( Class componentType, int length ) throws NegativeArraySizeException
Parameters
componentType
the Class object representing the component type of the new array
length
the length of the new array
Returns
the new array
Description
Creates a new array with the specified component type and length. The effect is that of the equivalent array creation expression:
    new componentType[length]

Exceptions
NullPointerException if the specified componentType parameter is null
Exceptions
NegativeArraySizeException if the specified length is negative

Syntax 2
public static Object newInstance( Class componentType, int dimensions[] ) throws IllegalArgumentException, NegativeArraySizeException
Parameters
componentType
the Class object representing the component type of the new array
dimensions
an array of ints representing the dimensions of the new array
Returns
the new array
Description
Creates a new array with the specified component type and dimensions.

The effect is that of the equivalent array creation expression:

    new componentType[dimensions[0]][dimensions[1]]...

Exceptions
NullPointerException if the specified componentType argument is null
Exceptions
IllegalArgumentException if the specified dimensions argument is a zero-dimensional array, or if the number of requested dimensions exceeds the limit on the number of array dimensions supported by the implementation (typically 255).
Exceptions
NegativeArraySizeException if any of the components in the specified dimension argument is negative.


 Array.set

Array.set

Syntax
public static native void set( Object array, int index, Object value ) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Parameters
array
the array
index
the index into the array
value
the new value of the indexed component
Description
Sets the value of the indexed component of the specified array object to the specified new value. The new value is first automatically unwrapped if the array has a primitive component type.

Exceptions
NullPointerException If the specified object argument is null, or if the array component type is primitive and the specified value is null
Exceptions
IllegalArgumentException If the specified object argument is not an array, or if the array component type is primitive and the specified value cannot be converted to the primitive type by a combination of unwrapping and identity or widening conversions
Exceptions
ArrayIndexOutOfBoundsException If the specified index argument is negative, or if it is greater than or equal to the length of the specified array


 Array.setBoolean

Array.setBoolean

Syntax
public static native void setBoolean( Object array, int index, boolean z ) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Parameters
array
the array
index
the index into the array
value
the new value of the indexed component
Description
Sets the value of the indexed component of the specified array object to the specified boolean value.

Exceptions
NullPointerException If the specified object argument is null
Exceptions
IllegalArgumentException If the specified object argument is not an array, or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion
Exceptions
ArrayIndexOutOfBoundsException If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also
set


 Array.setByte

Array.setByte

Syntax
public static native void setByte( Object array, int index, byte b ) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Parameters
array
the array
index
the index into the array
value
the new value of the indexed component
Description
Sets the value of the indexed component of the specified array object to the specified boolean value.

Exceptions
NullPointerException If the specified object argument is null
Exceptions
IllegalArgumentException If the specified object argument is not an array, or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion
Exceptions
ArrayIndexOutOfBoundsException If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also
set


 Array.setChar

Array.setChar

Syntax
public static native void setChar( Object array, int index, char c ) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Parameters
array
the array
index
the index into the array
value
the new value of the indexed component
Description
Sets the value of the indexed component of the specified array object to the specified byte value.

Exceptions
NullPointerException If the specified object argument is null
Exceptions
IllegalArgumentException If the specified object argument is not an array, or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion
Exceptions
ArrayIndexOutOfBoundsException If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also
set


 Array.setDouble

Array.setDouble

Syntax
public static native void setDouble( Object array, int index, double d ) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Parameters
array
the array
index
the index into the array
value
the new value of the indexed component
Description
Sets the value of the indexed component of the specified array object to the specified double value.

Exceptions
NullPointerException If the specified object argument is null
Exceptions
IllegalArgumentException If the specified object argument is not an array, or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion
Exceptions
ArrayIndexOutOfBoundsException If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also
set


 Array.setFloat

Array.setFloat

Syntax
public static native void setFloat( Object array, int index, float f ) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Parameters
array
the array
index
the index into the array
value
the new value of the indexed component
Description
Sets the value of the indexed component of the specified array object to the specified float value.

Exceptions
NullPointerException If the specified object argument is null
Exceptions
IllegalArgumentException If the specified object argument is not an array, or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion
Exceptions
ArrayIndexOutOfBoundsException If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also
set


 Array.setInt

Array.setInt

Syntax
public static native void setInt( Object array, int index, int i ) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Parameters
array
the array
index
the index into the array
value
the new value of the indexed component
Description
Sets the value of the indexed component of the specified array object to the specified int value.

Exceptions
NullPointerException If the specified object argument is null
Exceptions
IllegalArgumentException If the specified object argument is not an array, or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion
Exceptions
ArrayIndexOutOfBoundsException If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also
set


 Array.setLong

Array.setLong

Syntax
public static native void setLong( Object array, int index, long l ) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Parameters
array
the array
index
the index into the array
value
the new value of the indexed component
Description
Sets the value of the indexed component of the specified array object to the specified long value.

Exceptions
NullPointerException If the specified object argument is null
Exceptions
IllegalArgumentException If the specified object argument is not an array, or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion
Exceptions
ArrayIndexOutOfBoundsException If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also
set


 Array.setShort

Array.setShort

Syntax
public static native void setShort( Object array, int index, short s ) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Parameters
array
the array
index
the index into the array
value
the new value of the indexed component
Description
Sets the value of the indexed component of the specified array object to the specified short value.

Exceptions
NullPointerException If the specified object argument is null
Exceptions
IllegalArgumentException If the specified object argument is not an array, or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion
Exceptions
ArrayIndexOutOfBoundsException If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also
set


 Class Constructor

Class java.lang.reflect.Constructor

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.reflect.Constructor

public final class Constructor
extends Object
implements Member

Constructor provides information about, and access to, a single constructor for a class.

Constructor permits widening conversions to occur when matching the actual parameters to newInstance() with the underlying constructor's formal parameters, but throws an IllegalArgumentException if a narrowing conversion would occur.

See Also:
Member, Class, getConstructors, getConstructor, getDeclaredConstructors


 Constructor Members

Constructor Members

Class Overview | This Package | All Packages

Methods
Name | Description
equals(Object) | Compares this Constructor against the specified object.
getDeclaringClass() | Returns the Class object representing the class that declares the constructor represented by this Constructor object.
getExceptionTypes() | Returns an array of Class objects that represent the types of the checked exceptions thrown by the underlying constructor represented by this Constructor object.
getModifiers() | Returns the Java language modifiers for the constructor represented by this Constructor object, as an integer.
getName() | Returns the name of this constructor, as a string.
getParameterTypes() | Returns an array of Class objects that represent the formal parameter types, in declaration order, of the constructor represented by this Constructor object.
hashCode() | Returns a hashcode for this Constructor.
newInstance(Object[]) | Uses the constructor represented by this Constructor object to create and initialize a new instance of the constructor's declaring class, with the specified initialization parameters.
toString() | Return a string describing this Constructor.


 Constructor.equals

Constructor.equals

Syntax
public boolean equals( Object obj )
Description
Compares this Constructor against the specified object. Returns true if the objects are the same. Two Constructors are the same if they were declared by the same class and have the same formal parameter types.

Overrides
equals in class Object


 Constructor.getDeclaringClass

Constructor.getDeclaringClass

Syntax
public Class getDeclaringClass()
Description
Returns the Class object representing the class that declares the constructor represented by this Constructor object.


 Constructor.getExceptionTypes

Constructor.getExceptionTypes

Syntax
public Class[] getExceptionTypes()
Description
Returns an array of Class objects that represent the types of the checked exceptions thrown by the underlying constructor represented by this Constructor object. Returns an array of length 0 if the constructor throws no checked exceptions.


 Constructor.getModifiers

Constructor.getModifiers

Syntax
public native int getModifiers()
Description
Returns the Java language modifiers for the constructor represented by this Constructor object, as an integer. The Modifier class should be used to decode the modifiers.

See Also
Modifier


 Constructor.getName

Constructor.getName

Syntax
public String getName()
Description
Returns the name of this constructor, as a string. This is always the same as the name of the constructor's declaring class.


 Constructor.getParameterTypes

Constructor.getParameterTypes

Syntax
public Class[] getParameterTypes()
Description
Returns an array of Class objects that represent the formal parameter types, in declaration order, of the constructor represented by this Constructor object. Returns an array of length 0 if the underlying constructor takes no parameters.


 Constructor.hashCode

Constructor.hashCode

Syntax
public int hashCode()
Description
Returns a hashcode for this Constructor. The hashcode is the same as the hashcode for the underlying constructor's declaring class name.

Overrides
hashCode in class Object


 Constructor.newInstance

Constructor.newInstance

Syntax
public native Object newInstance( Object initargs[] ) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
Description
Uses the constructor represented by this Constructor object to create and initialize a new instance of the constructor's declaring class, with the specified initialization parameters. Individual parameters are automatically unwrapped to match primitive formal parameters, and both primitive and reference parameters are subject to widening conversions as necessary. Returns the newly created and initialized object.

Creation proceeds with the following steps, in order:

If the class that declares the underlying constructor represents an abstract class, the creation throws an InstantiationException.

If this Constructor object enforces Java language access control and the underlying constructor is inaccessible, the creation throws an IllegalAccessException.

If the number of actual parameters supplied via initargs is different from the number of formal parameters required by the underlying constructor, the creation throws an IllegalArgumentException.

A new instance of the constructor's declaring class is created, and its fields are initialized to their default initial values.

For each actual parameter in the supplied initargs array:

If the corresponding formal parameter has a primitive type, an unwrapping conversion is attempted to convert the object value to a value of the primitive type. If this attempt fails, the creation throws an IllegalArgumentException.

If, after possible unwrapping, the parameter value cannot be converted to the corresponding formal parameter type by an identity or widening conversion, the creation throws an IllegalArgumentException.

Control transfers to the underlying constructor to initialize the new instance. If the constructor completes abruptly by throwing an exception, the exception is placed in an InvocationTargetException and thrown in turn to the caller of newInstance.

If the constructor completes normally, returns the newly created and initialized instance.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the number of actual and formal parameters differ, or if an unwrapping conversion fails.
Exceptions
InstantiationException if the class that declares the underlying constructor represents an abstract class.
Exceptions
InvocationTargetException if the underlying constructor throws an exception.


 Constructor.toString

Constructor.toString

Syntax
public String toString()
Description
Return a string describing this Constructor. The string is formatted as the constructor access modifiers, if any, followed by the fully-qualified name of the declaring class, followed by a parenthesized, comma-separated list of the constructor's formal parameter types. For example:
    public java.util.Hashtable(int,float)

The only possible modifiers for constructors are the access modifiers public, protected or private. Only one of these may appear, or none if the constructor has default (package) access.

Overrides
toString in class Object


 Class Field

Class java.lang.reflect.Field

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.reflect.Field

public final class Field
extends Object
implements Member

A Field provides information about, and dynamic access to, a single field of a class or an interface. The reflected field may be a class (static) field or an instance field.

A Field permits widening conversions to occur during a get or set access operation, but throws an IllegalArgumentException if a narrowing conversion would occur.

See Also:
Member, Class, getFields, getField, getDeclaredFields, getDeclaredField


 Field Members

Field Members

Class Overview | This Package | All Packages

Methods
Name | Description
equals(Object) | Compares this Field against the specified object.
get(Object) | Returns the value of the field represented by this Field, on the specified object.
getBoolean(Object) | Get the value of a field as a boolean on specified object.
getByte(Object) | Get the value of a field as a byte on specified object.
getChar(Object) | Get the value of a field as a char on specified object.
getDeclaringClass() | Returns the Class object representing the class or interface that declares the field represented by this Field object.
getDouble(Object) | Get the value of a field as a double on specified object.
getFloat(Object) | Get the value of a field as a float on specified object.
getInt(Object) | Get the value of a field as a int on specified object.
getLong(Object) | Get the value of a field as a long on specified object.
getModifiers() | Returns the Java language modifiers for the field represented by this Field object, as an integer.
getName() | Returns the name of the field represented by this Field object.
getShort(Object) | Get the value of a field as a short on specified object.
getType() | Returns a Class object that identifies the declared type for the field represented by this Field object.
hashCode() | Returns a hashcode for this Field.
set(Object, Object) | Sets the field represented by this Field object on the specified object argument to the specified new value.
setBoolean(Object, boolean) | Set the value of a field as a boolean on specified object.
setByte(Object, byte) | Set the value of a field as a byte on specified object.
setChar(Object, char) | Set the value of a field as a char on specified object.
setDouble(Object, double) | Set the value of a field as a double on specified object.
setFloat(Object, float) | Set the value of a field as a float on specified object.
setInt(Object, int) | Set the value of a field as an int on specified object.
setLong(Object, long) | Set the value of a field as a long on specified object.
setShort(Object, short) | Set the value of a field as a short on specified object.
toString() | Return a string describing this Field.


 Field.equals

Field.equals

Syntax
public boolean equals( Object obj )
Description
Compares this Field against the specified object. Returns true if the objects are the same. Two Fields are the same if they were declared by the same class and have the same name and type.

Overrides
equals in class Object


 Field.get

Field.get

Syntax
public native Object get( Object obj ) throws IllegalArgumentException, IllegalAccessException
Description
Returns the value of the field represented by this Field, on the specified object. The value is automatically wrapped in an object if it has a primitive type.

The underlying field's value is obtained as follows:

If the underlying field is a static field, the object argument is ignored; it may be null.

Otherwise, the underlying field is an instance field. If the specified object argument is null, the method throws a NullPointerException. If the specified object is not an instance of the class or interface declaring the underlying field, the method throws an IllegalArgumentException.

If this Field object enforces Java language access control, and the underlying field is inaccessible, the method throws an IllegalAccessException.

Otherwise, the value is retrieved from the underlying instance or static field. If the field has a primitive type, the value is wrapped in an object before being returned, otherwise it is returned as is.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field.
Exceptions
NullPointerException if the specified object is null.


 Field.getBoolean

Field.getBoolean

Syntax
public native boolean getBoolean( Object obj ) throws IllegalArgumentException, IllegalAccessException
Description
Get the value of a field as a boolean on specified object.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the field value cannot be converted to the return type by a widening conversion.
See Also
get


 Field.getByte

Field.getByte

Syntax
public native byte getByte( Object obj ) throws IllegalArgumentException, IllegalAccessException
Description
Get the value of a field as a byte on specified object.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the field value cannot be converted to the return type by a widening conversion.
See Also
get


 Field.getChar

Field.getChar

Syntax
public native char getChar( Object obj ) throws IllegalArgumentException, IllegalAccessException
Description
Get the value of a field as a char on specified object.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the field value cannot be converted to the return type by a widening conversion.
See Also
get


 Field.getDeclaringClass

Field.getDeclaringClass

Syntax
public Class getDeclaringClass()
Description
Returns the Class object representing the class or interface that declares the field represented by this Field object.


 Field.getDouble

Field.getDouble

Syntax
public native double getDouble( Object obj ) throws IllegalArgumentException, IllegalAccessException
Description
Get the value of a field as a double on specified object.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the field value cannot be converted to the return type by a widening conversion.
See Also
get


 Field.getFloat

Field.getFloat

Syntax
public native float getFloat( Object obj ) throws IllegalArgumentException, IllegalAccessException
Description
Get the value of a field as a float on specified object.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the field value cannot be converted to the return type by a widening conversion.
See Also
get


 Field.getInt

Field.getInt

Syntax
public native int getInt( Object obj ) throws IllegalArgumentException, IllegalAccessException
Description
Get the value of a field as a int on specified object.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the field value cannot be converted to the return type by a widening conversion.
See Also
get


 Field.getLong

Field.getLong

Syntax
public native long getLong( Object obj ) throws IllegalArgumentException, IllegalAccessException
Description
Get the value of a field as a long on specified object.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the field value cannot be converted to the return type by a widening conversion.
See Also
get


 Field.getModifiers

Field.getModifiers

Syntax
public native int getModifiers()
Description
Returns the Java language modifiers for the field represented by this Field object, as an integer. The Modifier class should be used to decode the modifiers.

See Also
Modifier


 Field.getName

Field.getName

Syntax
public String getName()
Description
Returns the name of the field represented by this Field object.


 Field.getShort

Field.getShort

Syntax
public native short getShort( Object obj ) throws IllegalArgumentException, IllegalAccessException
Description
Get the value of a field as a short on specified object.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the field value cannot be converted to the return type by a widening conversion.
See Also
get


 Field.getType

Field.getType

Syntax
public Class getType()
Description
Returns a Class object that identifies the declared type for the field represented by this Field object.


 Field.hashCode

Field.hashCode

Syntax
public int hashCode()
Description
Returns a hashcode for this Field. This is computed as the exclusive-or of the hashcodes for the underlying field's declaring class name and its name.

Overrides
hashCode in class Object


 Field.set

Field.set

Syntax
public native void set( Object obj, Object value ) throws IllegalArgumentException, IllegalAccessException
Description
Sets the field represented by this Field object on the specified object argument to the specified new value. The new value is automatically unwrapped if the underlying field has a primitive type.

The operation proceeds as follows:

If the underlying field is static, the object argument is ignored; it may be null.

Otherwise the underlying field is an instance field. If the specified object argument is null, the method throws a NullPointerException. If the specified object argument is not an instance of the class or interface declaring the underlying field, the method throws an IllegalArgumentException.

If this Field object enforces Java language access control, and the underlying field is inaccessible, the method throws an IllegalAccessException.

If the underlying field is final, the method throws an IllegalAccessException.

If the underlying field is of a primitive type, an unwrapping conversion is attempted to convert the new value to a value of a primitive type. If this attempt fails, the method throws an IllegalArgumentException.

If, after possible unwrapping, the new value cannot be converted to the type of the underlying field by an identity or widening conversion, the method throws an IllegalArgumentException.

The field is set to the possibly unwrapped and widened new value.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field, or if an unwrapping conversion fails.
Exceptions
NullPointerException if the specified object is null.


 Field.setBoolean

Field.setBoolean

Syntax
public native void setBoolean( Object obj, boolean z ) throws IllegalArgumentException, IllegalAccessException
Description
Set the value of a field as a boolean on specified object.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field, or if an unwrapping conversion fails.
See Also
set


 Field.setByte

Field.setByte

Syntax
public native void setByte( Object obj, byte b ) throws IllegalArgumentException, IllegalAccessException
Description
Set the value of a field as a byte on specified object.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field, or if an unwrapping conversion fails.
See Also
set


 Field.setChar

Field.setChar

Syntax
public native void setChar( Object obj, char c ) throws IllegalArgumentException, IllegalAccessException
Description
Set the value of a field as a char on specified object.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field, or if an unwrapping conversion fails.
See Also
set


 Field.setDouble

Field.setDouble

Syntax
public native void setDouble( Object obj, double d ) throws IllegalArgumentException, IllegalAccessException
Description
Set the value of a field as a double on specified object.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field, or if an unwrapping conversion fails.
See Also
set


 Field.setFloat

Field.setFloat

Syntax
public native void setFloat( Object obj, float f ) throws IllegalArgumentException, IllegalAccessException
Description
Set the value of a field as a float on specified object.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field, or if an unwrapping conversion fails.
See Also
set


 Field.setInt

Field.setInt

Syntax
public native void setInt( Object obj, int i ) throws IllegalArgumentException, IllegalAccessException
Description
Set the value of a field as an int on specified object.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field, or if an unwrapping conversion fails.
See Also
set


 Field.setLong

Field.setLong

Syntax
public native void setLong( Object obj, long l ) throws IllegalArgumentException, IllegalAccessException
Description
Set the value of a field as a long on specified object.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field, or if an unwrapping conversion fails.
See Also
set


 Field.setShort

Field.setShort

Syntax
public native void setShort( Object obj, short s ) throws IllegalArgumentException, IllegalAccessException
Description
Set the value of a field as a short on specified object.

Exceptions
IllegalAccessException if the underlying constructor is inaccessible.
Exceptions
IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field, or if an unwrapping conversion fails.
See Also
set


 Field.toString

Field.toString

Syntax
public String toString()
Description
Return a string describing this Field. The format is the access modifiers for the field, if any, followed by the field type, followed by a space, followed by the fully-qualified name of the class declaring the field, followed by a period, followed by the name of the field. For example:
    public static final int java.lang.Thread.MIN_PRIORITY
    private int java.io.FileDescriptor.fd

The modifiers are placed in canonical order as specified by "The Java Language Specification". This is public, protected or private first, and then other modifiers in the following order: static, final, transient, volatile.

Overrides
toString in class Object


 Class InvocationTargetException

Class java.lang.reflect.InvocationTargetException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.reflect.InvocationTargetException

public class InvocationTargetException
extends Exception

InvocationTargetException is a checked exception that wraps an exception thrown by an invoked method or constructor.

See Also:
Method, Constructor


 InvocationTargetException Members

InvocationTargetException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
InvocationTargetException() |
InvocationTargetException(Throwable) | Constructs a InvocationTargetException with a target exception.
InvocationTargetException(Throwable, String) | Constructs a InvocationTargetException with a target exception and a detail message.

Methods
Name | Description
getTargetException() | Get the thrown target exception.


 InvocationTargetException.InvocationTargetException

InvocationTargetException.InvocationTargetException

Syntax 1
protected InvocationTargetException()

Syntax 2
public InvocationTargetException( Throwable target )
Description
Constructs a InvocationTargetException with a target exception.

Syntax 3
public InvocationTargetException( Throwable target, String s )
Description
Constructs a InvocationTargetException with a target exception and a detail message.


 InvocationTargetException.getTargetException

InvocationTargetException.getTargetException

Syntax
public Throwable getTargetException()
Description
Get the thrown target exception.


 Interface Member

Interface java.lang.reflect.Member

Interface Members | This Package | All Packages

public interface Member

Member is an interface that reflects identifying information about a single member (a field or a method) or a constructor.

See Also:
Class, Field, Method, Constructor


 Member Members

Member Members

Interface Overview | This Package | All Packages

Fields
Name | Description
DECLARED | Identifies the set of declared members of a class or interface.
PUBLIC | Identifies the set of all public members of a class or interface, including inherited members.

Methods
Name | Description
getDeclaringClass() | Returns the Class object representing the class or interface that declares the member or constructor represented by this Member.
getModifiers() | Returns the Java language modifiers for the member or constructor represented by this Member, as an integer.
getName() | Returns the simple name of the underlying member or constructor represented by this Member.


 Member.DECLARED

Member.DECLARED

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int DECLARED
Description
Identifies the set of declared members of a class or interface. Inherited members are not included.

See Also
checkMemberAccess


 Member.PUBLIC

Member.PUBLIC

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int PUBLIC
Description
Identifies the set of all public members of a class or interface, including inherited members.

See Also
checkMemberAccess


 Member.getDeclaringClass

Member.getDeclaringClass

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Class getDeclaringClass()
Description
Returns the Class object representing the class or interface that declares the member or constructor represented by this Member.


 Member.getModifiers

Member.getModifiers

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getModifiers()
Description
Returns the Java language modifiers for the member or constructor represented by this Member, as an integer. The Modifier class should be used to decode the modifiers in the integer.

See Also
Modifier


 Member.getName

Member.getName

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getName()
Description
Returns the simple name of the underlying member or constructor represented by this Member.


 Class Method

Class java.lang.reflect.Method

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.reflect.Method

public final class Method
extends Object
implements Member

A Method provides information about, and access to, a single method on a class or interface. The reflected method may be a class method or an instance method (including an abstract method).

A Method permits widening conversions to occur when matching the actual parameters to invokewith the underlying method's formal parameters, but it throws an IllegalArgumentException if a narrowing conversion would occur.

See Also:
Member, Class, getMethods, getMethod, getDeclaredMethods, getDeclaredMethod


 Method Members

Method Members

Class Overview | This Package | All Packages

Methods
Name | Description
equals(Object) | Compares this Method against the specified object.
getDeclaringClass() | Returns the Class object representing the class or interface that declares the method represented by this Method object.
getExceptionTypes() | Returns an array of Class objects that represent the types of the checked exceptions thrown by the underlying method represented by this Method object.
getModifiers() | Returns the Java language modifiers for the method represented by this Method object, as an integer.
getName() | Returns the name of the method represented by this Method object, as a String.
getParameterTypes() | Returns an array of Class objects that represent the formal parameter types, in declaration order, of the method represented by this Method object.
getReturnType() | Returns a Class object that represents the formal return type of the method represented by this Method object.
hashCode() | Returns a hashcode for this Method.
invoke(Object, Object[]) | Invokes the underlying method represented by this Method object, on the specified object with the specified parameters.
toString() | Returns a string describing this Method.


 Method.equals

Method.equals

Syntax
public boolean equals( Object obj )
Description
Compares this Method against the specified object. Returns true if the objects are the same. Two Methods are the same if they were declared by the same class and have the same name and formal parameter types.

Overrides
equals in class Object


 Method.getDeclaringClass

Method.getDeclaringClass

Syntax
public Class getDeclaringClass()
Description
Returns the Class object representing the class or interface that declares the method represented by this Method object.


 Method.getExceptionTypes

Method.getExceptionTypes

Syntax
public Class[] getExceptionTypes()
Description
Returns an array of Class objects that represent the types of the checked exceptions thrown by the underlying method represented by this Method object. Returns an array of length 0 if the method throws no checked exceptions.


 Method.getModifiers

Method.getModifiers

Syntax
public native int getModifiers()
Description
Returns the Java language modifiers for the method represented by this Method object, as an integer. The Modifier class should be used to decode the modifiers.

See Also
Modifier


 Method.getName

Method.getName

Syntax
public String getName()
Description
Returns the name of the method represented by this Method object, as a String.


 Method.getParameterTypes

Method.getParameterTypes

Syntax
public Class[] getParameterTypes()
Description
Returns an array of Class objects that represent the formal parameter types, in declaration order, of the method represented by this Method object. Returns an array of length 0 if the underlying method takes no parameters.


 Method.getReturnType

Method.getReturnType

Syntax
public Class getReturnType()
Description
Returns a Class object that represents the formal return type of the method represented by this Method object.


 Method.hashCode

Method.hashCode

Syntax
public int hashCode()
Description
Returns a hashcode for this Method. The hashcode is computed as the exclusive-or of the hashcodes for the underlying method's declaring class name and the method's name.

Overrides
hashCode in class Object


 Method.invoke

Method.invoke

Syntax
public native Object invoke( Object obj, Object args[] ) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
Description
Invokes the underlying method represented by this Method object, on the specified object with the specified parameters. Individual parameters are automatically unwrapped to match primitive formal parameters, and both primitive and reference parameters are subject to widening conversions as necessary. The value returned by the underlying method is automatically wrapped in an object if it has a primitive type.

Method invocation proceeds with the following steps, in order:

If the underlying method is static, then the specified object argument is ignored. It may be null.

Otherwise, the method is an instance method. If the specified object argument is null, the invocation throws a NullPointerException. Otherwise, if the specified object argument is not an instance of the class or interface declaring the underlying method, the invocation throws an IllegalArgumentException.

If this Method object enforces Java language access control and the underlying method is inaccessible, the invocation throws an IllegalAccessException.

If the number of actual parameters supplied via args is different from the number of formal parameters required by the underlying method, the invocation throws an IllegalArgumentException.

For each actual parameter in the supplied args array:

If the corresponding formal parameter has a primitive type, an unwrapping conversion is attempted to convert the object value to a value of a primitive type. If this attempt fails, the invocation throws an IllegalArgumentException.

If, after possible unwrapping, the parameter value cannot be converted to the corresponding formal parameter type by an identity or widening conversion, the invocation throws an IllegalArgumentException.

If the underlying method is an instance method, it is invoked using dynamic method lookup as documented in The Java Language Specification, section 15.11.4.4; in particular, overriding based on the runtime type of the target object will occur.

If the underlying method is static, it is invoked as exactly the method on the declaring class.

Control transfers to the underlying method. If the method completes abruptly by throwing an exception, the exception is placed in an InvocationTargetException and thrown in turn to the caller of invoke.

If the method completes normally, the value it returns is returned to the caller of invoke; if the value has a primitive type, it is first appropriately wrapped in an object. If the underlying method return type is void, the invocation returns null.

Exceptions
IllegalAccessException if the underlying method is inaccessible.
Exceptions
IllegalArgumentException if the number of actual and formal parameters differ, or if an unwrapping conversion fails.
Exceptions
InvocationTargetException if the underlying method throws an exception.
Exceptions
NullPointerException if the specified object is null.


 Method.toString

Method.toString

Syntax
public String toString()
Description
Returns a string describing this Method. The string is formatted as the method access modifiers, if any, followed by the method return type, followed by a space, followed by the class declaring the method, followed by a period, followed by the method name, followed by a parenthesized, comma-separated list of the method's formal parameter types. If the method throws checked exceptions, the parameter list is followed by a space, followed by the word throws followed by a comma-separated list of the thrown exception types. For example:
    public boolean java.lang.Object.equals(java.lang.Object)

The access modifiers are placed in canonical order as specified by "The Java Language Specification". This is public, protected or private first, and then other modifiers in the following order: abstract, static, final, synchronized native.

Overrides
toString in class Object


 Class Modifier

Class java.lang.reflect.Modifier

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.reflect.Modifier

public class Modifier
extends Object

The Modifier class provides static methods and constants to decode class and member access modifiers.

See Also:
getModifiers, getModifiers


 Modifier Members

Modifier Members

Class Overview | This Package | All Packages

Fields
Name | Description
ABSTRACT |
FINAL |
INTERFACE |
NATIVE |
PRIVATE |
PROTECTED |
PUBLIC |
STATIC |
SYNCHRONIZED |
TRANSIENT |
VOLATILE |

Constructors
Name | Description
Modifier() |

Methods
Name | Description
isAbstract(int) | Return true if the specifier integer includes the abstract modifier.
isFinal(int) | Return true if the specifier integer includes the final modifier.
isInterface(int) | Return true if the specifier integer includes the interface modifier.
isNative(int) | Return true if the specifier integer includes the native modifier.
isPrivate(int) | Return true if the specifier integer includes the private modifier.
isProtected(int) | Return true if the specifier integer includes the protected modifier.
isPublic(int) | Return true if the specified integer includes the public modifier.
isStatic(int) | Return true if the specifier integer includes the static modifier.
isSynchronized(int) | Return true if the specifier integer includes the final modifier.
isTransient(int) | Return true if the specifier integer includes the transient modifier.
isVolatile(int) | Return true if the specifier integer includes the volatile modifier.
toString(int) | Return a string describing the access modifier flags in the specified modifier.


 Modifier.ABSTRACT

Modifier.ABSTRACT

Syntax
public static final int ABSTRACT


 Modifier.FINAL

Modifier.FINAL

Syntax
public static final int FINAL


 Modifier.INTERFACE

Modifier.INTERFACE

Syntax
public static final int INTERFACE


 Modifier.NATIVE

Modifier.NATIVE

Syntax
public static final int NATIVE


 Modifier.PRIVATE

Modifier.PRIVATE

Syntax
public static final int PRIVATE


 Modifier.PROTECTED

Modifier.PROTECTED

Syntax
public static final int PROTECTED


 Modifier.PUBLIC

Modifier.PUBLIC

Syntax
public static final int PUBLIC


 Modifier.STATIC

Modifier.STATIC

Syntax
public static final int STATIC


 Modifier.SYNCHRONIZED

Modifier.SYNCHRONIZED

Syntax
public static final int SYNCHRONIZED


 Modifier.TRANSIENT

Modifier.TRANSIENT

Syntax
public static final int TRANSIENT


 Modifier.VOLATILE

Modifier.VOLATILE

Syntax
public static final int VOLATILE


 Modifier.Modifier

Modifier.Modifier

Syntax
public Modifier()


 Modifier.isAbstract

Modifier.isAbstract

Syntax
public static boolean isAbstract( int mod )
Description
Return true if the specifier integer includes the abstract modifier.


 Modifier.isFinal

Modifier.isFinal

Syntax
public static boolean isFinal( int mod )
Description
Return true if the specifier integer includes the final modifier.


 Modifier.isInterface

Modifier.isInterface

Syntax
public static boolean isInterface( int mod )
Description
Return true if the specifier integer includes the interface modifier.


 Modifier.isNative

Modifier.isNative

Syntax
public static boolean isNative( int mod )
Description
Return true if the specifier integer includes the native modifier.


 Modifier.isPrivate

Modifier.isPrivate

Syntax
public static boolean isPrivate( int mod )
Description
Return true if the specifier integer includes the private modifier.


 Modifier.isProtected

Modifier.isProtected

Syntax
public static boolean isProtected( int mod )
Description
Return true if the specifier integer includes the protected modifier.


 Modifier.isPublic

Modifier.isPublic

Syntax
public static boolean isPublic( int mod )
Description
Return true if the specified integer includes the public modifier.


 Modifier.isStatic

Modifier.isStatic

Syntax
public static boolean isStatic( int mod )
Description
Return true if the specifier integer includes the static modifier.


 Modifier.isSynchronized

Modifier.isSynchronized

Syntax
public static boolean isSynchronized( int mod )
Description
Return true if the specifier integer includes the final modifier.


 Modifier.isTransient

Modifier.isTransient

Syntax
public static boolean isTransient( int mod )
Description
Return true if the specifier integer includes the transient modifier.


 Modifier.isVolatile

Modifier.isVolatile

Syntax
public static boolean isVolatile( int mod )
Description
Return true if the specifier integer includes the volatile modifier.


 Modifier.toString

Modifier.toString

Syntax
public static String toString( int mod )
Description
Return a string describing the access modifier flags in the specified modifier. For example:
    public final synchronized
    private transient volatile
The modifier names are return in canonical order, as specified by The Java Language Specification.


 Package java.math

Package java.math

All Packages

Classes

  • BigDecimal
  • BigInteger


 Class BigDecimal

Class java.math.BigDecimal

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Number
           |
           +----java.math.BigDecimal

public class BigDecimal
extends Number

Immutable, arbitrary-precision signed decimal numbers. A BigDecimal consists of an arbitrary precision integer value and a non-negative integer scale, which represents the number of decimal digits to the right of the decimal point. (The number represented by the BigDecimal is intVal/10**scale.) BigDecimals provide operations for basic arithmetic, scale manipulation, comparison, format conversion and hashing.

The BigDecimal class gives its user complete control over rounding behavior, forcing the user to explicitly specify a rounding behavior for operations capable of discarding precision (divide and setScale). Eight rounding modes are provided for this purpose. Two types of operations are provided for manipulating the scale of a BigDecimal: scaling/rounding operations and decimal point motion operations. Scaling/Rounding operations (SetScale) return a BigDecimal whose value is approximately (or exactly) equal to that of the operand, but whose scale is the specified value; that is, they increase or decrease the precision of the number with minimal effect on its value. Decimal point motion operations (movePointLeft and movePointRight) return a BigDecimal created from the operand by moving the decimal point a specified distance in the specified direction; that is, they change a number's value without affecting its precision.

See Also:
BigInteger


 BigDecimal Members

BigDecimal Members

Class Overview | This Package | All Packages

Fields
Name | Description
ROUND_CEILING | If the BigDecimal is positive, behave as for ROUND_UP; if negative, behave as for ROUND_DOWN.
ROUND_DOWN | Never increment the digit prior to a discarded fraction (i.e., truncate).
ROUND_FLOOR | If the BigDecimal is positive, behave as for ROUND_DOWN; if negative behave as for ROUND_UP.
ROUND_HALF_DOWN | Behave as for ROUND_UP if the discarded fraction is > .5; otherwise, behave as for ROUND_DOWN.
ROUND_HALF_EVEN | Behave as for ROUND_HALF_UP if the digit to the left of the discarded fraction is odd; behave as for ROUND_HALF_DOWN if it's even.
ROUND_HALF_UP | Behave as for ROUND_UP if the discarded fraction is >= .5; otherwise, behave as for ROUND_DOWN.
ROUND_UNNECESSARY | This "pseudo-rounding-mode" is actually an assertion that the requested operation has an exact result, hence no rounding is necessary.
ROUND_UP | Always increment the digit prior to a non-zero discarded fraction.

Constructors
Name | Description
BigDecimal(BigInteger) | Translates a BigInteger into a BigDecimal.
BigDecimal(BigInteger, int) | Translates a BigInteger and a scale into a BigDecimal.
BigDecimal(double) | Translates a double into a BigDecimal.
BigDecimal(String) | Constructs a BigDecimal from a string containing an optional minus sign followed by a sequence of zero or more decimal digits, optionally followed by a fraction, which consists of a decimal point followed by zero or more decimal digits.

Methods
Name | Description
abs() | Returns a BigDecimal whose value is the absolute value of this number, and whose scale is this.scale().
add(BigDecimal) | Returns a BigDecimal whose value is (this + val), and whose scale is MAX(this.scale(), val.scale).
compareTo(BigDecimal) | Returns -1, 0 or 1 as this number is less than, equal to, or greater than val.
divide(BigDecimal, int) | Returns a BigDecimal whose value is (this / val), and whose scale is this.scale().
divide(BigDecimal, int, int) | Returns a BigDecimal whose value is (this / val), and whose scale is as specified.
doubleValue() | Converts the number to a double.
equals(Object) | Returns true iff x is a BigDecimal whose value is equal to this number.
floatValue() | Converts this number to a float.
hashCode() | Computes a hash code for this object.
intValue() | Converts this number to an int.
longValue() | Converts this number to a long.
max(BigDecimal) | Returns the BigDecimal whose value is the greater of this and val.
min(BigDecimal) | Returns the BigDecimal whose value is the lesser of this and val.
movePointLeft(int) | Returns a BigDecimal which is equivalent to this one with the decimal point moved n places to the left.
movePointRight(int) | Moves the decimal point the specified number of places to the right.
multiply(BigDecimal) | Returns a BigDecimal whose value is (this * val), and whose scale is this.scale() + val.scale.
negate() | Returns a BigDecimal whose value is -1 * this, and whose scale is this.scale().
scale() | Returns the scale of this number.
setScale(int) | Returns a BigDecimal whose scale is the specified value, and whose value is exactly equal to this number's.
setScale(int, int) | Returns a BigDecimal whose scale is the specified value, and whose integer value is determined by multiplying or dividing this BigDecimal's integer value by the appropriate power of ten to maintain the overall value.
signum() | Returns the signum function of this number (i.e., -1, 0 or 1 as the value of this number is negative, zero or positive).
subtract(BigDecimal) | Returns a BigDecimal whose value is (this - val), and whose scale is MAX(this.scale(), val.scale).
toBigInteger() | Converts this number to a BigInteger.
toString() | Returns the string representation of this number.
valueOf(long) | Returns a BigDecimal with the given value and a scale of zero.
valueOf(long, int) | Returns a BigDecimal with a value of (val/10**scale).


 BigDecimal.ROUND_CEILING

BigDecimal.ROUND_CEILING

Syntax
public static final int ROUND_CEILING
Description
If the BigDecimal is positive, behave as for ROUND_UP; if negative, behave as for ROUND_DOWN. Note that this rounding mode never decreases the value. (Rounds towards positive infinity.)


 BigDecimal.ROUND_DOWN

BigDecimal.ROUND_DOWN

Syntax
public static final int ROUND_DOWN
Description
Never increment the digit prior to a discarded fraction (i.e., truncate). Note that this rounding mode never increases the magnitude. (Rounds towards zero.)


 BigDecimal.ROUND_FLOOR

BigDecimal.ROUND_FLOOR

Syntax
public static final int ROUND_FLOOR
Description
If the BigDecimal is positive, behave as for ROUND_DOWN; if negative behave as for ROUND_UP. Note that this rounding mode never increases the value. (Rounds towards negative infinity.)


 BigDecimal.ROUND_HALF_DOWN

BigDecimal.ROUND_HALF_DOWN

Syntax
public static final int ROUND_HALF_DOWN
Description
Behave as for ROUND_UP if the discarded fraction is > .5; otherwise, behave as for ROUND_DOWN. (Rounds towards "nearest neighbor" unless both neighbors are equidistant, in which case rounds down.)


 BigDecimal.ROUND_HALF_EVEN

BigDecimal.ROUND_HALF_EVEN

Syntax
public static final int ROUND_HALF_EVEN
Description
Behave as for ROUND_HALF_UP if the digit to the left of the discarded fraction is odd; behave as for ROUND_HALF_DOWN if it's even. (Rounds towards the "nearest neighbor" unless both neighbors are equidistant, in which case, rounds towards the even neighbor.)


 BigDecimal.ROUND_HALF_UP

BigDecimal.ROUND_HALF_UP

Syntax
public static final int ROUND_HALF_UP
Description
Behave as for ROUND_UP if the discarded fraction is >= .5; otherwise, behave as for ROUND_DOWN. (Rounds towards "nearest neighbor" unless both neighbors are equidistant, in which case rounds up.)


 BigDecimal.ROUND_UNNECESSARY

BigDecimal.ROUND_UNNECESSARY

Syntax
public static final int ROUND_UNNECESSARY
Description
This "pseudo-rounding-mode" is actually an assertion that the requested operation has an exact result, hence no rounding is necessary. If this rounding mode is specified on an operation that yields an inexact result, an arithmetic exception is thrown.


 BigDecimal.ROUND_UP

BigDecimal.ROUND_UP

Syntax
public static final int ROUND_UP
Description
Always increment the digit prior to a non-zero discarded fraction. Note that this rounding mode never decreases the magnitude. (Rounds away from zero.)


 BigDecimal.BigDecimal

BigDecimal.BigDecimal

Syntax 1
public BigDecimal( String val ) throws NumberFormatException
Description
Constructs a BigDecimal from a string containing an optional minus sign followed by a sequence of zero or more decimal digits, optionally followed by a fraction, which consists of a decimal point followed by zero or more decimal digits. The string must contain at least one digit in the integer or fractional part. The scale of the resulting BigDecimal will be the number of digits to the right of the decimal point in the string, or 0 if the string contains no decimal point. The character-to-digit mapping is provided by Character.digit. Any extraneous characters (including whitespace) will result in a NumberFormatException.

Syntax 2
public BigDecimal( double val ) throws NumberFormatException
Description
Translates a double into a BigDecimal. The scale of the BigDecimal is the smallest value such that (10**scale * val) is an integer. A double whose value is -infinity, +infinity or NaN will result in a NumberFormatException.

Syntax 3
public BigDecimal( BigInteger val )
Description
Translates a BigInteger into a BigDecimal. The scale of the BigDecimal is zero.

Syntax 4
public BigDecimal( BigInteger val, int scale ) throws NumberFormatException
Description
Translates a BigInteger and a scale into a BigDecimal. The value of the BigDecimal is (BigInteger/10**scale). A negative scale will result in a NumberFormatException.


 BigDecimal.abs

BigDecimal.abs

Syntax
public BigDecimal abs()
Description
Returns a BigDecimal whose value is the absolute value of this number, and whose scale is this.scale().


 BigDecimal.add

BigDecimal.add

Syntax
public BigDecimal add( BigDecimal val )
Description
Returns a BigDecimal whose value is (this + val), and whose scale is MAX(this.scale(), val.scale).


 BigDecimal.compareTo

BigDecimal.compareTo

Syntax
public int compareTo( BigDecimal val )
Description
Returns -1, 0 or 1 as this number is less than, equal to, or greater than val. Two BigDecimals that are equal in value but have a different scale (e.g., 2.0, 2.00) are considered equal by this method. This method is provided in preference to individual methods for each of the six boolean comparison operators (<, ==, >, >=, !=, <=). The suggested idiom for performing these comparisons is: (x.compareTo(y) 0), where is one of the six comparison operators.


 BigDecimal.divide

BigDecimal.divide

Syntax 1
public BigDecimal divide( BigDecimal val, int scale, int roundingMode ) throws ArithmeticException, IllegalArgumentException
Description
Returns a BigDecimal whose value is (this / val), and whose scale is as specified. If rounding must be performed to generate a result with the given scale, the specified rounding mode is applied. Throws an ArithmeticException if val == 0, scale < 0, or the rounding mode is ROUND_UNNECESSARY and the specified scale is insufficient to represent the result of the division exactly. Throws an IllegalArgumentException if roundingMode does not represent a valid rounding mode.

Syntax 2
public BigDecimal divide( BigDecimal val, int roundingMode ) throws ArithmeticException, IllegalArgumentException
Description
Returns a BigDecimal whose value is (this / val), and whose scale is this.scale(). If rounding must be performed to generate a result with the given scale, the specified rounding mode is applied. Throws an ArithmeticException if val == 0. Throws an IllegalArgumentException if roundingMode does not represent a valid rounding mode.


 BigDecimal.doubleValue

BigDecimal.doubleValue

Syntax
public double doubleValue()
Description
Converts the number to a double. Similar to the double-to-float narrowing primitive conversion defined in The Java Language Specification: if the number has too great a magnitude to represent as a double, it will be converted to infinity or negative infinity, as appropriate.

Overrides
doubleValue in class Number


 BigDecimal.equals

BigDecimal.equals

Syntax
public boolean equals( Object x )
Description
Returns true iff x is a BigDecimal whose value is equal to this number. This method is provided so that BigDecimals can be used as hash keys. Unlike compareTo, this method considers two BigDecimals equal only if they are equal in value and scale.

Overrides
equals in class Object


 BigDecimal.floatValue

BigDecimal.floatValue

Syntax
public float floatValue()
Description
Converts this number to a float. Similar to the double-to-float narrowing primitive conversion defined in The Java Language Specification: if the number has too great a magnitude to represent as a float, it will be converted to infinity or negative infinity, as appropriate.

Overrides
floatValue in class Number


 BigDecimal.hashCode

BigDecimal.hashCode

Syntax
public int hashCode()
Description
Computes a hash code for this object. Note that two BigDecimals that are numerically equal but differ in scale (e.g., 2.0, 2.00) will not generally have the same hash code.

Overrides
hashCode in class Object


 BigDecimal.intValue

BigDecimal.intValue

Syntax
public int intValue()
Description
Converts this number to an int. Standard narrowing primitive conversion as per The Java Language Specification. In particular, note that any fractional part of this number will be truncated.

Overrides
intValue in class Number


 BigDecimal.longValue

BigDecimal.longValue

Syntax
public long longValue()
Description
Converts this number to a long. Standard narrowing primitive conversion as per The Java Language Specification. In particular, note that any fractional part of this number will be truncated.

Overrides
longValue in class Number


 BigDecimal.max

BigDecimal.max

Syntax
public BigDecimal max( BigDecimal val )
Description
Returns the BigDecimal whose value is the greater of this and val. If the values are equal (as defined by the compareTo operator), either may be returned.


 BigDecimal.min

BigDecimal.min

Syntax
public BigDecimal min( BigDecimal val )
Description
Returns the BigDecimal whose value is the lesser of this and val. If the values are equal (as defined by the compareTo operator), either may be returned.


 BigDecimal.movePointLeft

BigDecimal.movePointLeft

Syntax
public BigDecimal movePointLeft( int n )
Description
Returns a BigDecimal which is equivalent to this one with the decimal point moved n places to the left. If n is non-negative, the call merely adds n to the scale. If n is negative, the call is equivalent to movePointRight(-n). (The BigDecimal returned by this call has value (this * 10**-n) and scale MAX(this.scale()+n, 0).)


 BigDecimal.movePointRight

BigDecimal.movePointRight

Syntax
public BigDecimal movePointRight( int n )
Description
Moves the decimal point the specified number of places to the right. If this number's scale is >= n, the call merely subtracts n from the scale; otherwise, it sets the scale to zero, and multiplies the integer value by 10 ** (n - this.scale). If n is negative, the call is equivalent to movePointLeft(-n). (The BigDecimal returned by this call has value (this * 10**n) and scale MAX(this.scale()-n, 0).)


 BigDecimal.multiply

BigDecimal.multiply

Syntax
public BigDecimal multiply( BigDecimal val )
Description
Returns a BigDecimal whose value is (this * val), and whose scale is this.scale() + val.scale.


 BigDecimal.negate

BigDecimal.negate

Syntax
public BigDecimal negate()
Description
Returns a BigDecimal whose value is -1 * this, and whose scale is this.scale().


 BigDecimal.scale

BigDecimal.scale

Syntax
public int scale()
Description
Returns the scale of this number.


 BigDecimal.setScale

BigDecimal.setScale

Syntax 1
public BigDecimal setScale( int scale, int roundingMode ) throws ArithmeticException, IllegalArgumentException
Description
Returns a BigDecimal whose scale is the specified value, and whose integer value is determined by multiplying or dividing this BigDecimal's integer value by the appropriate power of ten to maintain the overall value. If the scale is reduced by the operation, the integer value must be divided (rather than multiplied), and precision may be lost; in this case, the specified rounding mode is applied to the division. Throws an ArithmeticException if scale is negative, or the rounding mode is ROUND_UNNECESSARY and it is impossible to perform the specified scaling operation without loss of precision. Throws an IllegalArgumentException if roundingMode does not represent a valid rounding mode.

Syntax 2
public BigDecimal setScale( int scale ) throws ArithmeticException, IllegalArgumentException
Description
Returns a BigDecimal whose scale is the specified value, and whose value is exactly equal to this number's. Throws an ArithmeticException if this is not possible. This call is typically used to increase the scale, in which case it is guaranteed that there exists a BigDecimal of the specified scale and the correct value. The call can also be used to reduce the scale if the caller knows that the number has sufficiently many zeros at the end of its fractional part (i.e., factors of ten in its integer value) to allow for the rescaling without loss of precision. Note that this call returns the same result as the two argument version of setScale, but saves the caller the trouble of specifying a rounding mode in cases where it is irrelevant.


 BigDecimal.signum

BigDecimal.signum

Syntax
public int signum()
Description
Returns the signum function of this number (i.e., -1, 0 or 1 as the value of this number is negative, zero or positive).


 BigDecimal.subtract

BigDecimal.subtract

Syntax
public BigDecimal subtract( BigDecimal val )
Description
Returns a BigDecimal whose value is (this - val), and whose scale is MAX(this.scale(), val.scale).


 BigDecimal.toBigInteger

BigDecimal.toBigInteger

Syntax
public BigInteger toBigInteger()
Description
Converts this number to a BigInteger. Standard narrowing primitive conversion as per The Java Language Specification. In particular, note that any fractional part of this number will be truncated.


 BigDecimal.toString

BigDecimal.toString

Syntax
public String toString()
Description
Returns the string representation of this number. The digit-to- character mapping provided by Character.forDigit is used. The minus sign and decimal point are used to indicate sign and scale. (This representation is compatible with the (String, int) constructor.)

Overrides
toString in class Object


 BigDecimal.valueOf

BigDecimal.valueOf

Syntax 1
public static BigDecimal valueOf( long val, int scale ) throws NumberFormatException
Description
Returns a BigDecimal with a value of (val/10**scale). This factory is provided in preference to a (long) constructor because it allows for reuse of frequently used BigDecimals (like 0 and 1), obviating the need for exported constants. A negative scale will result in a NumberFormatException.

Syntax 2
public static BigDecimal valueOf( long val )
Description
Returns a BigDecimal with the given value and a scale of zero. This factory is provided in preference to a (long) constructor because it allows for reuse of frequently used BigDecimals (like 0 and 1), obviating the need for exported constants.


 Class BigInteger

Class java.math.BigInteger

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Number
           |
           +----java.math.BigInteger

public class BigInteger
extends Number

Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in two's-complement notation (like Java's primitive integer types). BigIntegers provide analogues to all of Java's primitive integer operators, and all relevant static methods from java.lang.Math. Additionally, BigIntegers provide operations for modular arithmetic, GCD calculation, primality testing, prime generation, single-bit manipulation, and a few other odds and ends.

Semantics of arithmetic operations exactly mimic those of java's integer arithmetic operators, as defined in The Java Language Specification. For example, division by zero throws an ArithmeticException, and division of a negative by a positive yields a negative (or zero) remainder. All of the details in the Spec concerning overflow are ignored, as BigIntegers are made as large as necessary to accommodate the results of an operation.

Semantics of shift operations extend those of Java's shift operators to allow for negative shift distances. A right-shift with a negative shift distance results in a left shift, and vice-versa. The unsigned right shift operator (>>>) is omitted, as this operation makes little sense in combination with the "infinite word size" abstraction provided by this class.

Semantics of bitwise logical operations are are exactly mimic those of Java's bitwise integer operators. The Binary operators (and, or, xor) implicitly perform sign extension on the shorter of the two operands prior to performing the operation.

Comparison operations perform signed integer comparisons, analogous to those performed by java's relational and equality operators.

Modular arithmetic operations are provided to compute residues, perform exponentiation, and compute multiplicative inverses. These methods always return a non-negative result, between 0 and (modulus - 1), inclusive.

Single-bit operations operate on a single bit of the two's-complement representation of their operand. If necessary, the operand is sign extended so that it contains the designated bit. None of the single-bit operations can produce a number with a different sign from the the BigInteger being operated on, as they affect only a single bit, and the "infinite word size" abstraction provided by this class ensures that there are infinitely many "virtual sign bits" preceding each BigInteger.

See Also:
BigDecimal


 BigInteger Members

BigInteger Members

Class Overview | This Package | All Packages

Constructors
Name | Description
BigInteger(byte[]) | Translates a byte array containing the two's-complement representation of a (signed) integer into a BigInteger.
BigInteger(int, byte[]) | Translates the sign-magnitude representation of an integer into a BigInteger.
BigInteger(int, int, Random) | Returns a randomly selected BigInteger with the specified bitLength that is probably prime.
BigInteger(int, Random) | Returns a random number uniformly distributed on [0, 2**numBits - 1] (assuming a fair source of random bits is provided in rndSrc).
BigInteger(String) | Translates a string containing an optional minus sign followed by a sequence of one or more decimal digits into a BigInteger.
BigInteger(String, int) | Translates a string containing an optional minus sign followed by a sequence of one or more digits in the specified radix into a BigInteger.

Methods
Name | Description
abs() | Returns a BigInteger whose value is the absolute value of this number.
add(BigInteger) | Returns a BigInteger whose value is (this + val).
and(BigInteger) | Returns a BigInteger whose value is (this & val).
andNot(BigInteger) | Returns a BigInteger whose value is (this & ~val).
bitCount() | Returns the number of bits in the two's complement representation of this number that differ from its sign bit.
bitLength() | Returns the number of bits in the minimal two's-complement representation of this number, *excluding* a sign bit, i.e., (ceil(log2(this < 0 ? -this : this + 1))).
clearBit(int) | Returns a BigInteger whose value is equivalent to this number with the designated bit cleared.
compareTo(BigInteger) | Returns -1, 0 or 1 as this number is less than, equal to, or greater than val.
divide(BigInteger) | Returns a BigInteger whose value is (this / val).
divideAndRemainder(BigInteger) | Returns an array of two BigIntegers.
doubleValue() | Converts the number to a double.
equals(Object) | Returns true iff x is a BigInteger whose value is equal to this number.
flipBit(int) | Returns a BigInteger whose value is equivalent to this number with the designated bit flipped.
floatValue() | Converts this number to a float.
gcd(BigInteger) | Returns a BigInteger whose value is the greatest common denominator of abs(this) and abs(val).
getLowestSetBit() | Returns the index of the rightmost (lowest-order) one bit in this number (i.e., the number of zero bits to the right of the rightmost one bit).
hashCode() | Computes a hash code for this object.
intValue() | Converts this number to an int.
isProbablePrime(int) | Returns true if this BigInteger is probably prime, false if it's definitely composite.
longValue() | Converts this number to a long.
max(BigInteger) | Returns the BigInteger whose value is the greater of this and val.
min(BigInteger) | Returns the BigInteger whose value is the lesser of this and val.
mod(BigInteger) | Returns a BigInteger whose value is this mod m.
modInverse(BigInteger) | Returns modular multiplicative inverse of this, mod m.
modPow(BigInteger, BigInteger) | Returns a BigInteger whose value is (this ** exponent) mod m.
multiply(BigInteger) | Returns a BigInteger whose value is (this * val).
negate() | Returns a BigInteger whose value is (-1 * this).
not() | Returns a BigInteger whose value is (~this).
or(BigInteger) | Returns a BigInteger whose value is (this | val).
pow(int) | Returns a BigInteger whose value is (this ** exponent).
remainder(BigInteger) | Returns a BigInteger whose value is (this % val).
setBit(int) | Returns a BigInteger whose value is equivalent to this number with the designated bit set.
shiftLeft(int) | Returns a BigInteger whose value is (this << n).
shiftRight(int) | Returns a BigInteger whose value is (this >> n).
signum() | Returns the signum function of this number (i.e., -1, 0 or 1 as the value of this number is negative, zero or positive).
subtract(BigInteger) | Returns a BigInteger whose value is (this - val).
testBit(int) | Returns true iff the designated bit is set.
toByteArray() | Returns the two's-complement representation of this number.
toString() | Returns the string representation of this number, radix 10.
toString(int) | Returns the string representation of this number in the given radix.
valueOf(long) | Returns a BigInteger with the specified value.
xor(BigInteger) | Returns a BigInteger whose value is (this ^ val).


 BigInteger.BigInteger

BigInteger.BigInteger

Syntax 1
public BigInteger( byte val[] ) throws NumberFormatException
Description
Translates a byte array containing the two's-complement representation of a (signed) integer into a BigInteger. The input array is assumed to be big-endian (i.e., the most significant byte is in the [0] position). (The most significant bit of the most significant byte is the sign bit.) The array must contain at least one byte or a NumberFormatException will be thrown.

Syntax 2
public BigInteger( int signum, byte magnitude[] ) throws NumberFormatException
Description
Translates the sign-magnitude representation of an integer into a BigInteger. The sign is represented as an integer signum value (-1 for negative, 0 for zero, 1 for positive). The magnitude is represented as a big-endian byte array (i.e., the most significant byte is in the [0] position). An invalid signum value or a 0 signum value coupled with a nonzero magnitude will result in a NumberFormatException. A zero length magnitude array is permissible, and will result in in a value of 0 (irrespective of the given signum value).

Syntax 3
public BigInteger( String val, int radix ) throws NumberFormatException
Description
Translates a string containing an optional minus sign followed by a sequence of one or more digits in the specified radix into a BigInteger. The character-to-digit mapping is provided by Character.digit. Any extraneous characters (including whitespace), or a radix outside the range from Character.MIN_RADIX(2) to Character.MAX_RADIX(36), inclusive, will result in a NumberFormatException.

Syntax 4
public BigInteger( String val ) throws NumberFormatException
Description
Translates a string containing an optional minus sign followed by a sequence of one or more decimal digits into a BigInteger. The character-to-digit mapping is provided by Character.digit. Any extraneous characters (including whitespace) will result in a NumberFormatException.

Syntax 5
public BigInteger( int numBits, Random rndSrc ) throws IllegalArgumentException
Description
Returns a random number uniformly distributed on [0, 2**numBits - 1] (assuming a fair source of random bits is provided in rndSrc). Note that this constructor always returns a non-negative BigInteger. Throws an IllegalArgumentException if numBits < 0.

Syntax 6
public BigInteger( int bitLength, int certainty, Random rnd )
Description
Returns a randomly selected BigInteger with the specified bitLength that is probably prime. The certainty parameter is a measure of the uncertainty that the caller is willing to tolerate: the probability that the number is prime will exceed 1 - 1/2**certainty. The execution time is proportional to the value of the certainty parameter. The given random number generator is used to select candidates to be tested for primality. Throws an ArithmeticException if bitLength < 2.


 BigInteger.abs

BigInteger.abs

Syntax
public BigInteger abs()
Description
Returns a BigInteger whose value is the absolute value of this number.


 BigInteger.add

BigInteger.add

Syntax
public BigInteger add( BigInteger val ) throws ArithmeticException
Description
Returns a BigInteger whose value is (this + val).


 BigInteger.and

BigInteger.and

Syntax
public BigInteger and( BigInteger val )
Description
Returns a BigInteger whose value is (this & val). (This method returns a negative number iff this and val are both negative.)


 BigInteger.andNot

BigInteger.andNot

Syntax
public BigInteger andNot( BigInteger val )
Description
Returns a BigInteger whose value is (this & ~val). This method, which is equivalent to and(val.not()), is provided as a convenience for masking operations. (This method returns a negative number iff this is negative and val is positive.)


 BigInteger.bitCount

BigInteger.bitCount

Syntax
public int bitCount()
Description
Returns the number of bits in the two's complement representation of this number that differ from its sign bit. This method is useful when implementing bit-vector style sets atop BigIntegers.


 BigInteger.bitLength

BigInteger.bitLength

Syntax
public int bitLength()
Description
Returns the number of bits in the minimal two's-complement representation of this number, *excluding* a sign bit, i.e., (ceil(log2(this < 0 ? -this : this + 1))). (For positive numbers, this is equivalent to the number of bits in the ordinary binary representation.)


 BigInteger.clearBit

BigInteger.clearBit

Syntax
public BigInteger clearBit( int n ) throws ArithmeticException
Description
Returns a BigInteger whose value is equivalent to this number with the designated bit cleared. (Computes (this & ~(1 << n)).) Throws an ArithmeticException if n < 0.


 BigInteger.compareTo

BigInteger.compareTo

Syntax
public int compareTo( BigInteger val )
Description
Returns -1, 0 or 1 as this number is less than, equal to, or greater than val. This method is provided in preference to individual methods for each of the six boolean comparison operators (<, ==, >, >=, !=, <=). The suggested idiom for performing these comparisons is: (x.compareTo(y) 0), where is one of the six comparison operators.


 BigInteger.divide

BigInteger.divide

Syntax
public BigInteger divide( BigInteger val ) throws ArithmeticException
Description
Returns a BigInteger whose value is (this / val). Throws an ArithmeticException if val == 0.


 BigInteger.divideAndRemainder

BigInteger.divideAndRemainder

Syntax
public BigInteger[] divideAndRemainder( BigInteger val ) throws ArithmeticException
Description
Returns an array of two BigIntegers. The first ([0]) element of the return value is the quotient (this / val), and the second ([1]) element is the remainder (this % val). Throws an ArithmeticException if val == 0.


 BigInteger.doubleValue

BigInteger.doubleValue

Syntax
public double doubleValue()
Description
Converts the number to a double. Similar to the double-to-float narrowing primitive conversion defined in The Java Language Specification: if the number has too great a magnitude to represent as a double, it will be converted to infinity or negative infinity, as appropriate.

Overrides
doubleValue in class Number


 BigInteger.equals

BigInteger.equals

Syntax
public boolean equals( Object x )
Description
Returns true iff x is a BigInteger whose value is equal to this number. This method is provided so that BigIntegers can be used as hash keys.

Overrides
equals in class Object


 BigInteger.flipBit

BigInteger.flipBit

Syntax
public BigInteger flipBit( int n ) throws ArithmeticException
Description
Returns a BigInteger whose value is equivalent to this number with the designated bit flipped. (Computes (this ^ (1 << n)).) Throws an ArithmeticException if n < 0.


 BigInteger.floatValue

BigInteger.floatValue

Syntax
public float floatValue()
Description
Converts this number to a float. Similar to the double-to-float narrowing primitive conversion defined in The Java Language Specification: if the number has too great a magnitude to represent as a float, it will be converted to infinity or negative infinity, as appropriate.

Overrides
floatValue in class Number


 BigInteger.gcd

BigInteger.gcd

Syntax
public BigInteger gcd( BigInteger val )
Description
Returns a BigInteger whose value is the greatest common denominator of abs(this) and abs(val). Returns 0 if this == 0 && val == 0.


 BigInteger.getLowestSetBit

BigInteger.getLowestSetBit

Syntax
public int getLowestSetBit()
Description
Returns the index of the rightmost (lowest-order) one bit in this number (i.e., the number of zero bits to the right of the rightmost one bit). Returns -1 if this number contains no one bits. (Computes (this==0? -1 : log2(this & -this)).)


 BigInteger.hashCode

BigInteger.hashCode

Syntax
public int hashCode()
Description
Computes a hash code for this object.

Overrides
hashCode in class Object


 BigInteger.intValue

BigInteger.intValue

Syntax
public int intValue()
Description
Converts this number to an int. Standard narrowing primitive conversion as per The Java Language Specification.

Overrides
intValue in class Number


 BigInteger.isProbablePrime

BigInteger.isProbablePrime

Syntax
public boolean isProbablePrime( int certainty )
Description
Returns true if this BigInteger is probably prime, false if it's definitely composite. The certainty parameter is a measure of the uncertainty that the caller is willing to tolerate: the method returns true if the probability that this number is is prime exceeds 1 - 1/2**certainty. The execution time is proportional to the value of the certainty parameter.


 BigInteger.longValue

BigInteger.longValue

Syntax
public long longValue()
Description
Converts this number to a long. Standard narrowing primitive conversion as per The Java Language Specification.

Overrides
longValue in class Number


 BigInteger.max

BigInteger.max

Syntax
public BigInteger max( BigInteger val )
Description
Returns the BigInteger whose value is the greater of this and val. If the values are equal, either may be returned.


 BigInteger.min

BigInteger.min

Syntax
public BigInteger min( BigInteger val )
Description
Returns the BigInteger whose value is the lesser of this and val. If the values are equal, either may be returned.


 BigInteger.mod

BigInteger.mod

Syntax
public BigInteger mod( BigInteger m )
Description
Returns a BigInteger whose value is this mod m. Throws an ArithmeticException if m <= 0.


 BigInteger.modInverse

BigInteger.modInverse

Syntax
public BigInteger modInverse( BigInteger m ) throws ArithmeticException
Description
Returns modular multiplicative inverse of this, mod m. Throws an ArithmeticException if m <= 0 or this has no multiplicative inverse mod m (i.e., gcd(this, m) != 1).


 BigInteger.modPow

BigInteger.modPow

Syntax
public BigInteger modPow( BigInteger exponent, BigInteger m )
Description
Returns a BigInteger whose value is (this ** exponent) mod m. (If exponent == 1, the returned value is (this mod m). If exponent < 0, the returned value is the modular multiplicative inverse of (this ** -exponent).) Throws an ArithmeticException if m <= 0.


 BigInteger.multiply

BigInteger.multiply

Syntax
public BigInteger multiply( BigInteger val )
Description
Returns a BigInteger whose value is (this * val).


 BigInteger.negate

BigInteger.negate

Syntax
public BigInteger negate()
Description
Returns a BigInteger whose value is (-1 * this).


 BigInteger.not

BigInteger.not

Syntax
public BigInteger not()
Description
Returns a BigInteger whose value is (~this). (This method returns a negative value iff this number is non-negative.)


 BigInteger.or

BigInteger.or

Syntax
public BigInteger or( BigInteger val )
Description
Returns a BigInteger whose value is (this | val). (This method returns a negative number iff either this or val is negative.)


 BigInteger.pow

BigInteger.pow

Syntax
public BigInteger pow( int exponent ) throws ArithmeticException
Description
Returns a BigInteger whose value is (this ** exponent). Throws an ArithmeticException if exponent < 0 (as the operation would yield a non-integer value). Note that exponent is an integer rather than a BigInteger.


 BigInteger.remainder

BigInteger.remainder

Syntax
public BigInteger remainder( BigInteger val ) throws ArithmeticException
Description
Returns a BigInteger whose value is (this % val). Throws an ArithmeticException if val == 0.


 BigInteger.setBit

BigInteger.setBit

Syntax
public BigInteger setBit( int n ) throws ArithmeticException
Description
Returns a BigInteger whose value is equivalent to this number with the designated bit set. (Computes (this | (1 << n)).) Throws an ArithmeticException if n < 0.


 BigInteger.shiftLeft

BigInteger.shiftLeft

Syntax
public BigInteger shiftLeft( int n )
Description
Returns a BigInteger whose value is (this << n). (Computes floor(this * 2**n).)


 BigInteger.shiftRight

BigInteger.shiftRight

Syntax
public BigInteger shiftRight( int n )
Description
Returns a BigInteger whose value is (this >> n). Sign extension is performed. (Computes floor(this / 2**n).)


 BigInteger.signum

BigInteger.signum

Syntax
public int signum()
Description
Returns the signum function of this number (i.e., -1, 0 or 1 as the value of this number is negative, zero or positive).


 BigInteger.subtract

BigInteger.subtract

Syntax
public BigInteger subtract( BigInteger val )
Description
Returns a BigInteger whose value is (this - val).


 BigInteger.testBit

BigInteger.testBit

Syntax
public boolean testBit( int n ) throws ArithmeticException
Description
Returns true iff the designated bit is set. (Computes ((this & (1 << n)) != 0).) Throws an ArithmeticException if n < 0.


 BigInteger.toByteArray

BigInteger.toByteArray

Syntax
public byte[] toByteArray()
Description
Returns the two's-complement representation of this number. The array is big-endian (i.e., the most significant byte is in the [0] position). The array contains the minimum number of bytes required to represent the number (ceil((this.bitLength() + 1)/8)). (This representation is compatible with the (byte[]) constructor.)


 BigInteger.toString

BigInteger.toString

Syntax 1
public String toString( int radix )
Description
Returns the string representation of this number in the given radix. If the radix is outside the range from Character.MIN_RADIX(2) to Character.MAX_RADIX(36) inclusive, it will default to 10 (as is the case for Integer.toString). The digit-to-character mapping provided by Character.forDigit is used, and a minus sign is prepended if appropriate. (This representation is compatible with the (String, int) constructor.)

Syntax 2
public String toString()
Description
Returns the string representation of this number, radix 10. The digit-to-character mapping provided by Character.forDigit is used, and a minus sign is prepended if appropriate. (This representation is compatible with the (String) constructor, and allows for string concatenation with Java's + operator.)

Overrides
toString in class Object


 BigInteger.valueOf

BigInteger.valueOf

Syntax
public static BigInteger valueOf( long val )
Description
Returns a BigInteger with the specified value. This factory is provided in preference to a (long) constructor because it allows for reuse of frequently used BigIntegers (like 0 and 1), obviating the need for exported constants.


 BigInteger.xor

BigInteger.xor

Syntax
public BigInteger xor( BigInteger val )
Description
Returns a BigInteger whose value is (this ^ val). (This method returns a negative number iff exactly one of this and val are negative.)


 Package java.net

Package java.net

All Packages

Interfaces

  • ContentHandlerFactory
  • FileNameMap
  • SocketImplFactory
  • URLStreamHandlerFactory

    • Classes

  • ContentHandler
  • DatagramPacket
  • DatagramSocket
  • DatagramSocketImpl
  • HttpURLConnection
  • InetAddress
  • MulticastSocket
  • ServerSocket
  • Socket
  • SocketImpl
  • URL
  • URLConnection
  • URLEncoder
  • URLStreamHandler

    • Exceptions

  • BindException
  • ConnectException
  • MalformedURLException
  • NoRouteToHostException
  • ProtocolException
  • SocketException
  • UnknownHostException
  • UnknownServiceException


 Class BindException

Class java.net.BindException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.net.SocketException
                                   |
                                   +----java.net.BindException

public class BindException
extends SocketException

Signals that an error occurred while attempting to bind a socket to a local address and port. Typically, the port is in use, or the requested local address could not be assigned.


 BindException Members

BindException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
BindException() | Construct a new BindException with no detailed message.
BindException(String) | Constructs a new BindException with the specified detail message as to why the bind error occurred.


 BindException.BindException

BindException.BindException

Syntax 1
public BindException( String msg )
Parameters
msg
the detail message
Description
Constructs a new BindException with the specified detail message as to why the bind error occurred. A detail message is a String that gives a specific description of this error.

Syntax 2
public BindException()
Description
Construct a new BindException with no detailed message.


 Class ConnectException

Class java.net.ConnectException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.net.SocketException
                                   |
                                   +----java.net.ConnectException

public class ConnectException
extends SocketException

Signals that an error occurred while attempting to connect a socket to a remote address and port. Typically, the connection was refused remotely (e.g., no process is listening on the remote address/port).


 ConnectException Members

ConnectException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ConnectException() | Construct a new ConnectException with no detailed message.
ConnectException(String) | Constructs a new ConnectException with the specified detail message as to why the connect error occurred.


 ConnectException.ConnectException

ConnectException.ConnectException

Syntax 1
public ConnectException( String msg )
Parameters
msg
the detail message
Description
Constructs a new ConnectException with the specified detail message as to why the connect error occurred. A detail message is a String that gives a specific description of this error.

Syntax 2
public ConnectException()
Description
Construct a new ConnectException with no detailed message.


 Class ContentHandler

Class java.net.ContentHandler

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.net.ContentHandler

public abstract class ContentHandler
extends Object

The abstract class ContentHandler is the superclass of all classes that read an Object from a URLConnection.

An application does not generally call the getContent method in this class directly. Instead, an application calls the getContent method in class URL or in URLConnection. The application's content handler factory (an instance of a class that implements the interface ContentHandlerFactory set up by a call to setContentHandler) is called with a String giving the MIME type of the object being received on the socket. The factory returns an instance of a subclass of ContentHandler, and its getContent method is called to create the object.

See Also:
getContent, ContentHandlerFactory, getContent, URLConnection, getContent, setContentHandlerFactory


 ContentHandler Members

ContentHandler Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ContentHandler() |

Methods
Name | Description
getContent(URLConnection) | Given a URL connect stream positioned at the beginning of the representation of an object, this method reads that stream and creates an object from it.


 ContentHandler.ContentHandler

ContentHandler.ContentHandler

Syntax
public ContentHandler()


 ContentHandler.getContent

ContentHandler.getContent

Syntax
public abstract Object getContent( URLConnection urlc ) throws IOException
Parameters
urlc
a URL connection.
Returns
the object read by the ContentHandler.
Description
Given a URL connect stream positioned at the beginning of the representation of an object, this method reads that stream and creates an object from it.

Exceptions
IOException if an I/O error occurs while reading the object.


 Interface ContentHandlerFactory

Interface java.net.ContentHandlerFactory

Interface Members | This Package | All Packages

public interface ContentHandlerFactory

This interface defines a factory for content handlers. An implementation of this interface should map a MIME type into an instance of ContentHandler.

This interface is used by the URLStreamHandler class to create a ContentHandler for a MIME type.

See Also:
ContentHandler, URLStreamHandler


 ContentHandlerFactory Members

ContentHandlerFactory Members

Interface Overview | This Package | All Packages

Methods
Name | Description
createContentHandler(String) | Creates a new ContentHandler to read an object from a URLStreamHandler.


 ContentHandlerFactory.createContentHandler

ContentHandlerFactory.createContentHandler

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ContentHandler createContentHandler( String mimetype )
Parameters
mimetype
the MIME type for which a content handler is desired.
Returns
a new ContentHandler to read an object from a URLStreamHandler.
Description
Creates a new ContentHandler to read an object from a URLStreamHandler.

See Also
ContentHandler, URLStreamHandler


 Class DatagramPacket

Class java.net.DatagramPacket

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.net.DatagramPacket

public final class DatagramPacket
extends Object

This class represents a datagram packet.

Datagram packets are used to implement a connectionless packet delivery service. Each message is routed from one machine to another based solely on information contained within that packet. Multiple packets sent from one machine to another might be routed differently, and might arrive in any order.


 DatagramPacket Members

DatagramPacket Members

Class Overview | This Package | All Packages

Constructors
Name | Description
DatagramPacket(byte[], int) | Constructs a DatagramPacket for receiving packets of length ilength.
DatagramPacket(byte[], int, InetAddress, int) | Constructs a datagram packet for sending packets of length ilength to the specified port number on the specified host.

Methods
Name | Description
getAddress() | Returns the IP address of the machine to which this datagram is being sent or from which the datagram was received.
getData() | Returns the data received or the data to be sent.
getLength() | Returns the length of the data to be sent or the length of the data received.
getPort() | Returns the port number on the remote host to which this datagram is being sent or from which the datagram was received.
setAddress(InetAddress) |
setData(byte[]) |
setLength(int) |
setPort(int) |


 DatagramPacket.DatagramPacket

DatagramPacket.DatagramPacket

Syntax 1
public DatagramPacket( byte ibuf[], int ilength )
Parameters
ibuf
buffer for holding the incoming datagram.
ilength
the number of bytes to read.
Description
Constructs a DatagramPacket for receiving packets of length ilength.

The length argument must be less than or equal to ibuf.length.

Syntax 2
public DatagramPacket( byte ibuf[], int ilength, InetAddress iaddr, int iport )
Parameters
ibuf
the packet data.
ilength
the packet length.
iaddr
the destination address.
iport
the destination port number.
Description
Constructs a datagram packet for sending packets of length ilength to the specified port number on the specified host. The length argument must be less than or equal to ibuf.length.

See Also
InetAddress


 DatagramPacket.getAddress

DatagramPacket.getAddress

Syntax
public synchronized InetAddress getAddress()
Returns
the IP address of the machine to which this datagram is being sent or from which the datagram was received.
Description
Returns the IP address of the machine to which this datagram is being sent or from which the datagram was received.

See Also
InetAddress


 DatagramPacket.getData

DatagramPacket.getData

Syntax
public synchronized byte[] getData()
Returns
the data received or the data to be sent.
Description
Returns the data received or the data to be sent.


 DatagramPacket.getLength

DatagramPacket.getLength

Syntax
public synchronized int getLength()
Returns
the length of the data to be sent or the length of the data received.
Description
Returns the length of the data to be sent or the length of the data received.


 DatagramPacket.getPort

DatagramPacket.getPort

Syntax
public synchronized int getPort()
Returns
the port number on the remote host to which this datagram is being sent or from which the datagram was received.
Description
Returns the port number on the remote host to which this datagram is being sent or from which the datagram was received.


 DatagramPacket.setAddress

DatagramPacket.setAddress

Syntax
public synchronized void setAddress( InetAddress iaddr )


 DatagramPacket.setData

DatagramPacket.setData

Syntax
public synchronized void setData( byte ibuf[] )


 DatagramPacket.setLength

DatagramPacket.setLength

Syntax
public synchronized void setLength( int ilength )


 DatagramPacket.setPort

DatagramPacket.setPort

Syntax
public synchronized void setPort( int iport )


 Class DatagramSocket

Class java.net.DatagramSocket

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.net.DatagramSocket

public class DatagramSocket
extends Object

This class represents a socket for sending and receiving datagram packets.

A datagram socket is the sending or receiving point for a connectionless packet delivery service. Each packet sent or received on a datagram socket is individually addressed and routed. Multiple packets sent from one machine to another may be routed differently, and may arrive in any order.

See Also:
DatagramPacket


 DatagramSocket Members

DatagramSocket Members

Class Overview | This Package | All Packages

Constructors
Name | Description
DatagramSocket() | Constructs a datagram socket and binds it to any available port on the local host machine.
DatagramSocket(int) | Constructs a datagram socket and binds it to the specified port on the local host machine.
DatagramSocket(int, InetAddress) | Creates a datagram socket, bound to the specified local address.

Methods
Name | Description
close() | Closes this datagram socket.
getLocalAddress() | Gets the local address to which the socket is bound.
getLocalPort() | Returns the port number on the local host to which this socket is bound.
getSoTimeout() | Retrive setting for SO_TIMEOUT.
receive(DatagramPacket) | Receives a datagram packet from this socket.
send(DatagramPacket) | Sends a datagram packet from this socket.
setSoTimeout(int) | Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.


 DatagramSocket.DatagramSocket

DatagramSocket.DatagramSocket

Syntax 1
public DatagramSocket() throws SocketException
Description
Constructs a datagram socket and binds it to any available port on the local host machine.

Exceptions
SocketException if the socket could not be opened, or the socket could not bind to the specified local port.

Syntax 2
public DatagramSocket( int port ) throws SocketException
Parameters
local
port to use.
Description
Constructs a datagram socket and binds it to the specified port on the local host machine.

Exceptions
SocketException if the socket could not be opened, or the socket could not bind to the specified local port.

Syntax 3
public DatagramSocket( int port, InetAddress laddr ) throws SocketException
Parameters
port
local port to use
laddr
local address to bind
Description
Creates a datagram socket, bound to the specified local address. The local port must be between 0 and 65535 inclusive.


 DatagramSocket.close

DatagramSocket.close

Syntax
public void close()
Description
Closes this datagram socket.


 DatagramSocket.getLocalAddress

DatagramSocket.getLocalAddress

Syntax
public InetAddress getLocalAddress()
Description
Gets the local address to which the socket is bound.


 DatagramSocket.getLocalPort

DatagramSocket.getLocalPort

Syntax
public int getLocalPort()
Returns
the port number on the local host to which this socket is bound.
Description
Returns the port number on the local host to which this socket is bound.


 DatagramSocket.getSoTimeout

DatagramSocket.getSoTimeout

Syntax
public synchronized int getSoTimeout() throws SocketException
Description
Retrive setting for SO_TIMEOUT. 0 returns implies that the option is disabled (i.e., timeout of infinity).


 DatagramSocket.receive

DatagramSocket.receive

Syntax
public synchronized void receive( DatagramPacket p ) throws IOException
Parameters
p
the DatagramPacket into which to place the incoming data.
Description
Receives a datagram packet from this socket. When this method returns, the DatagramPacket's buffer is filled with the data received. The datagram packet also contains the sender's IP address, and the port number on the sender's machine.

This method blocks until a datagram is received. The length field of the datagram packet object contains the length of the received message. If the message is longer than the buffer length, the message is truncated.

Exceptions
IOException if an I/O error occurs.
See Also
DatagramPacket, DatagramSocket


 DatagramSocket.send

DatagramSocket.send

Syntax
public void send( DatagramPacket p ) throws IOException
Parameters
p
the DatagramPacket to be sent.
Description
Sends a datagram packet from this socket. The DatagramPacket includes information indicating the data to be sent, its length, the IP address of the remote host, and the port number on the remote host.

Exceptions
IOException if an I/O error occurs.
See Also
DatagramPacket


 DatagramSocket.setSoTimeout

DatagramSocket.setSoTimeout

Syntax
public synchronized void setSoTimeout( int timeout ) throws SocketException
Description
Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. With this option set to a non-zero timeout, a call to receive() for this DatagramSocket will block for only this amount of time. If the timeout expires, a java.io.InterruptedIOException is raised, though the ServerSocket is still valid. The option must be enabled prior to entering the blocking operation to have effect. The timeout must be > 0. A timeout of zero is interpreted as an infinite timeout.


 Class DatagramSocketImpl

Class java.net.DatagramSocketImpl

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.net.DatagramSocketImpl

public abstract class DatagramSocketImpl
extends Object
implements SocketOptions

Abstract datagram and multicast socket implementation base class.


 DatagramSocketImpl Members

DatagramSocketImpl Members

Class Overview | This Package | All Packages

Fields
Name | Description
fd | The file descriptor object
localPort |

Constructors
Name | Description
DatagramSocketImpl() |

Methods
Name | Description
bind(int, InetAddress) | Binds a datagram socket to a local port and address.
close() | Close the socket.
create() | Creates a datagram socket
getFileDescriptor() | Get the datagram socket file descriptor
getLocalPort() | Get the local port.
getTTL() | Retrieve the TTL (time-to-live) option.
join(InetAddress) | Join the multicast group.
leave(InetAddress) | Leave the multicast group.
peek(InetAddress) | Peek at the packet to see who it is from.
receive(DatagramPacket) | Receive the datagram packet.
send(DatagramPacket) | Sends a datagram packet.
setTTL(byte) | Set the TTL (time-to-live) option.


 DatagramSocketImpl.fd

DatagramSocketImpl.fd

Syntax
protected FileDescriptor fd
Description
The file descriptor object


 DatagramSocketImpl.localPort

DatagramSocketImpl.localPort

Syntax
protected int localPort


 DatagramSocketImpl.DatagramSocketImpl

DatagramSocketImpl.DatagramSocketImpl

Syntax
public DatagramSocketImpl()


 DatagramSocketImpl.bind

DatagramSocketImpl.bind

Syntax
protected abstract void bind( int lport, InetAddress laddr ) throws SocketException
Description
Binds a datagram socket to a local port and address.


 DatagramSocketImpl.close

DatagramSocketImpl.close

Syntax
protected abstract void close()
Description
Close the socket.


 DatagramSocketImpl.create

DatagramSocketImpl.create

Syntax
protected abstract void create() throws SocketException
Description
Creates a datagram socket


 DatagramSocketImpl.getFileDescriptor

DatagramSocketImpl.getFileDescriptor

Syntax
protected FileDescriptor getFileDescriptor()
Description
Get the datagram socket file descriptor


 DatagramSocketImpl.getLocalPort

DatagramSocketImpl.getLocalPort

Syntax
protected int getLocalPort()
Description
Get the local port.


 DatagramSocketImpl.getTTL

DatagramSocketImpl.getTTL

Syntax
protected abstract byte getTTL() throws IOException
Description
Retrieve the TTL (time-to-live) option.


 DatagramSocketImpl.join

DatagramSocketImpl.join

Syntax
protected abstract void join( InetAddress inetaddr ) throws IOException
Parameters
multicast
address to join.
Description
Join the multicast group.


 DatagramSocketImpl.leave

DatagramSocketImpl.leave

Syntax
protected abstract void leave( InetAddress inetaddr ) throws IOException
Parameters
multicast
address to leave.
Description
Leave the multicast group.


 DatagramSocketImpl.peek

DatagramSocketImpl.peek

Syntax
protected abstract int peek( InetAddress i ) throws IOException
Parameters
return
the address which the packet came from.
Description
Peek at the packet to see who it is from.


 DatagramSocketImpl.receive

DatagramSocketImpl.receive

Syntax
protected abstract void receive( DatagramPacket p ) throws IOException
Parameters
Packet
Received.
Description
Receive the datagram packet.


 DatagramSocketImpl.send

DatagramSocketImpl.send

Syntax
protected abstract void send( DatagramPacket p ) throws IOException
Parameters
packet
to be sent.
Description
Sends a datagram packet. The packet contains the data and the destination address to send the packet to.


 DatagramSocketImpl.setTTL

DatagramSocketImpl.setTTL

Syntax
protected abstract void setTTL( byte ttl ) throws IOException
Parameters
TTL
to be set.
Description
Set the TTL (time-to-live) option.


 Interface FileNameMap

Interface java.net.FileNameMap

Interface Members | This Package | All Packages

public interface FileNameMap

A simple interface which provides a mechanism to map between between a file name and a MIME type string.


 FileNameMap Members

FileNameMap Members

Interface Overview | This Package | All Packages

Methods
Name | Description
getContentTypeFor(String) |


 FileNameMap.getContentTypeFor

FileNameMap.getContentTypeFor

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getContentTypeFor( String fileName )


 Class HttpURLConnection

Class java.net.HttpURLConnection

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.net.URLConnection
           |
           +----java.net.HttpURLConnection

public abstract class HttpURLConnection
extends URLConnection

A URLConnection with support for HTTP-specific features. See the spec for details.


 HttpURLConnection Members

HttpURLConnection Members

Class Overview | This Package | All Packages

Fields
Name | Description
HTTP_ACCEPTED |
HTTP_BAD_GATEWAY |
HTTP_BAD_METHOD |
HTTP_BAD_REQUEST | 4XX: client error
HTTP_CLIENT_TIMEOUT |
HTTP_CONFLICT |
HTTP_CREATED |
HTTP_ENTITY_TOO_LARGE |
HTTP_FORBIDDEN |
HTTP_GATEWAY_TIMEOUT |
HTTP_GONE |
HTTP_INTERNAL_ERROR |
HTTP_LENGTH_REQUIRED |
HTTP_MOVED_PERM |
HTTP_MOVED_TEMP |
HTTP_MULT_CHOICE | 3XX: relocation/redirect
HTTP_NO_CONTENT |
HTTP_NOT_ACCEPTABLE |
HTTP_NOT_AUTHORITATIVE |
HTTP_NOT_FOUND |
HTTP_NOT_MODIFIED |
HTTP_OK | 2XX: generally "OK"
HTTP_PARTIAL |
HTTP_PAYMENT_REQUIRED |
HTTP_PRECON_FAILED |
HTTP_PROXY_AUTH |
HTTP_REQ_TOO_LONG |
HTTP_RESET |
HTTP_SEE_OTHER |
HTTP_SERVER_ERROR | 5XX: server error
HTTP_UNAUTHORIZED |
HTTP_UNAVAILABLE |
HTTP_UNSUPPORTED_TYPE |
HTTP_USE_PROXY |
HTTP_VERSION |
method |
responseCode |
responseMessage |

Constructors
Name | Description
HttpURLConnection(URL) | Constructor for the URLStreamHandler.

Methods
Name | Description
disconnect() | Close the connection to the server.
getFollowRedirects()
getRequestMethod() | Get the request method.
getResponseCode() | Gets HTTP response status.
getResponseMessage() | Gets the HTTP response message, if any, returned along with the response code from a server.
setFollowRedirects(boolean) | Sets whether HTTP redirects (requests with response code 3xx) should be automatically followed by this class.
setRequestMethod(String) Set the method for the URL request, one of:
  • GET
  • POST
  • HEAD
  • OPTIONS
  • PUT
  • DELETE
  • TRACE
are legal, subject to protocol restrictions.
usingProxy() | Indicates if the connection is going through a proxy.


 HttpURLConnection.HTTP_ACCEPTED

HttpURLConnection.HTTP_ACCEPTED

Syntax
public static final int HTTP_ACCEPTED


 HttpURLConnection.HTTP_BAD_GATEWAY

HttpURLConnection.HTTP_BAD_GATEWAY

Syntax
public static final int HTTP_BAD_GATEWAY


 HttpURLConnection.HTTP_BAD_METHOD

HttpURLConnection.HTTP_BAD_METHOD

Syntax
public static final int HTTP_BAD_METHOD


 HttpURLConnection.HTTP_BAD_REQUEST

HttpURLConnection.HTTP_BAD_REQUEST

Syntax
public static final int HTTP_BAD_REQUEST
Description
4XX: client error


 HttpURLConnection.HTTP_CLIENT_TIMEOUT

HttpURLConnection.HTTP_CLIENT_TIMEOUT

Syntax
public static final int HTTP_CLIENT_TIMEOUT


 HttpURLConnection.HTTP_CONFLICT

HttpURLConnection.HTTP_CONFLICT

Syntax
public static final int HTTP_CONFLICT


 HttpURLConnection.HTTP_CREATED

HttpURLConnection.HTTP_CREATED

Syntax
public static final int HTTP_CREATED


 HttpURLConnection.HTTP_ENTITY_TOO_LARGE

HttpURLConnection.HTTP_ENTITY_TOO_LARGE

Syntax
public static final int HTTP_ENTITY_TOO_LARGE


 HttpURLConnection.HTTP_FORBIDDEN

HttpURLConnection.HTTP_FORBIDDEN

Syntax
public static final int HTTP_FORBIDDEN


 HttpURLConnection.HTTP_GATEWAY_TIMEOUT

HttpURLConnection.HTTP_GATEWAY_TIMEOUT

Syntax
public static final int HTTP_GATEWAY_TIMEOUT


 HttpURLConnection.HTTP_GONE

HttpURLConnection.HTTP_GONE

Syntax
public static final int HTTP_GONE


 HttpURLConnection.HTTP_INTERNAL_ERROR

HttpURLConnection.HTTP_INTERNAL_ERROR

Syntax
public static final int HTTP_INTERNAL_ERROR


 HttpURLConnection.HTTP_LENGTH_REQUIRED

HttpURLConnection.HTTP_LENGTH_REQUIRED

Syntax
public static final int HTTP_LENGTH_REQUIRED


 HttpURLConnection.HTTP_MOVED_PERM

HttpURLConnection.HTTP_MOVED_PERM

Syntax
public static final int HTTP_MOVED_PERM


 HttpURLConnection.HTTP_MOVED_TEMP

HttpURLConnection.HTTP_MOVED_TEMP

Syntax
public static final int HTTP_MOVED_TEMP


 HttpURLConnection.HTTP_MULT_CHOICE

HttpURLConnection.HTTP_MULT_CHOICE

Syntax
public static final int HTTP_MULT_CHOICE
Description
3XX: relocation/redirect


 HttpURLConnection.HTTP_NO_CONTENT

HttpURLConnection.HTTP_NO_CONTENT

Syntax
public static final int HTTP_NO_CONTENT


 HttpURLConnection.HTTP_NOT_ACCEPTABLE

HttpURLConnection.HTTP_NOT_ACCEPTABLE

Syntax
public static final int HTTP_NOT_ACCEPTABLE


 HttpURLConnection.HTTP_NOT_AUTHORITATIVE

HttpURLConnection.HTTP_NOT_AUTHORITATIVE

Syntax
public static final int HTTP_NOT_AUTHORITATIVE


 HttpURLConnection.HTTP_NOT_FOUND

HttpURLConnection.HTTP_NOT_FOUND

Syntax
public static final int HTTP_NOT_FOUND


 HttpURLConnection.HTTP_NOT_MODIFIED

HttpURLConnection.HTTP_NOT_MODIFIED

Syntax
public static final int HTTP_NOT_MODIFIED


 HttpURLConnection.HTTP_OK

HttpURLConnection.HTTP_OK

Syntax
public static final int HTTP_OK
Description
2XX: generally "OK"


 HttpURLConnection.HTTP_PARTIAL

HttpURLConnection.HTTP_PARTIAL

Syntax
public static final int HTTP_PARTIAL


 HttpURLConnection.HTTP_PAYMENT_REQUIRED

HttpURLConnection.HTTP_PAYMENT_REQUIRED

Syntax
public static final int HTTP_PAYMENT_REQUIRED


 HttpURLConnection.HTTP_PRECON_FAILED

HttpURLConnection.HTTP_PRECON_FAILED

Syntax
public static final int HTTP_PRECON_FAILED


 HttpURLConnection.HTTP_PROXY_AUTH

HttpURLConnection.HTTP_PROXY_AUTH

Syntax
public static final int HTTP_PROXY_AUTH


 HttpURLConnection.HTTP_REQ_TOO_LONG

HttpURLConnection.HTTP_REQ_TOO_LONG

Syntax
public static final int HTTP_REQ_TOO_LONG


 HttpURLConnection.HTTP_RESET

HttpURLConnection.HTTP_RESET

Syntax
public static final int HTTP_RESET


 HttpURLConnection.HTTP_SEE_OTHER

HttpURLConnection.HTTP_SEE_OTHER

Syntax
public static final int HTTP_SEE_OTHER


 HttpURLConnection.HTTP_SERVER_ERROR

HttpURLConnection.HTTP_SERVER_ERROR

Syntax
public static final int HTTP_SERVER_ERROR
Description
5XX: server error


 HttpURLConnection.HTTP_UNAUTHORIZED

HttpURLConnection.HTTP_UNAUTHORIZED

Syntax
public static final int HTTP_UNAUTHORIZED


 HttpURLConnection.HTTP_UNAVAILABLE

HttpURLConnection.HTTP_UNAVAILABLE

Syntax
public static final int HTTP_UNAVAILABLE


 HttpURLConnection.HTTP_UNSUPPORTED_TYPE

HttpURLConnection.HTTP_UNSUPPORTED_TYPE

Syntax
public static final int HTTP_UNSUPPORTED_TYPE


 HttpURLConnection.HTTP_USE_PROXY

HttpURLConnection.HTTP_USE_PROXY

Syntax
public static final int HTTP_USE_PROXY


 HttpURLConnection.HTTP_VERSION

HttpURLConnection.HTTP_VERSION

Syntax
public static final int HTTP_VERSION


 HttpURLConnection.method

HttpURLConnection.method

Syntax
protected String method


 HttpURLConnection.responseCode

HttpURLConnection.responseCode

Syntax
protected int responseCode


 HttpURLConnection.responseMessage

HttpURLConnection.responseMessage

Syntax
protected String responseMessage


 HttpURLConnection.HttpURLConnection

HttpURLConnection.HttpURLConnection

Syntax
protected HttpURLConnection( URL u )
Description
Constructor for the URLStreamHandler.


 HttpURLConnection.disconnect

HttpURLConnection.disconnect

Syntax
public abstract void disconnect()
Description
Close the connection to the server.


 HttpURLConnection.getFollowRedirects

HttpURLConnection.getFollowRedirects

Syntax
public static boolean getFollowRedirects()


 HttpURLConnection.getRequestMethod

HttpURLConnection.getRequestMethod

Syntax
public String getRequestMethod()
Description
Get the request method.


 HttpURLConnection.getResponseCode

HttpURLConnection.getResponseCode

Syntax
public int getResponseCode() throws IOException
Description
Gets HTTP response status. From responses like:
 HTTP/1.0 200 OK
 HTTP/1.0 401 Unauthorized
Extracts the ints 200 and 401 respectively. Returns -1 if none can be discerned from the response (i.e., the response is not valid HTTP).


 HttpURLConnection.getResponseMessage

HttpURLConnection.getResponseMessage

Syntax
public String getResponseMessage() throws IOException
Description
Gets the HTTP response message, if any, returned along with the response code from a server. From responses like:
 HTTP/1.0 200 OK
 HTTP/1.0 404 Not Found
Extracts the Strings "OK" and "Not Found" respectively. Returns null if none could be discerned from the responses (the result was not valid HTTP).


 HttpURLConnection.setFollowRedirects

HttpURLConnection.setFollowRedirects

Syntax
public static void setFollowRedirects( boolean set )
Description
Sets whether HTTP redirects (requests with response code 3xx) should be automatically followed by this class. False by default. Applets cannot change this variable.


 HttpURLConnection.setRequestMethod

HttpURLConnection.setRequestMethod

Syntax
public void setRequestMethod( String method ) throws ProtocolException
Description
Set the method for the URL request, one of:
  • GET
  • POST
  • HEAD
  • OPTIONS
  • PUT
  • DELETE
  • TRACE
are legal, subject to protocol restrictions. The default method is GET.

Exceptions
ProtocolException if the method cannot be reset or if the requested method isn't valid for HTTP.


 HttpURLConnection.usingProxy

HttpURLConnection.usingProxy

Syntax
public abstract boolean usingProxy()
Description
Indicates if the connection is going through a proxy.


 Class InetAddress

Class java.net.InetAddress

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.net.InetAddress

public final class InetAddress
extends Object
implements Serializable

This class represents an Internet Protocol (IP) address.

Applications should use the methods getLocalHost, getByName, or getAllByName to create a new InetAddress instance.

See Also:
getAllByName, getByName, getLocalHost


 InetAddress Members

InetAddress Members

Class Overview | This Package | All Packages

Methods
Name | Description
equals(Object) | Compares this object against the specified object.
getAddress() | Returns the raw IP address of this InetAddress object.
getAllByName(String) | Determines all the IP addresses of a host, given the host's name.
getByName(String) | Determines the IP address of a host, given the host's name.
getHostAddress() | Returns the IP address string "%d.%d.%d.%d"
getHostName() | Returns the hostname for this address.
getLocalHost() | Returns the local host.
hashCode() | Returns a hashcode for this IP address.
isMulticastAddress() | Utility routine to check if the InetAddress is a IP multicast address.
toString() | Converts this IP address to a String.


 InetAddress.equals

InetAddress.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the object to compare against.
Returns
true if the objects are the same; false otherwise.
Description
Compares this object against the specified object. The result is true if and only if the argument is not null and it represents the same IP address as this object.

Two instances of InetAddress represent the same IP address if the length of the byte arrays returned by getAddress is the same for both, and each of the array components is the same for the byte arrays.

Overrides
equals in class Object
See Also
getAddress


 InetAddress.getAddress

InetAddress.getAddress

Syntax
public byte[] getAddress()
Returns
the raw IP address of this object.
Description
Returns the raw IP address of this InetAddress object. The result is in network byte order: the highest order byte of the address is in getAddress()[0].


 InetAddress.getAllByName

InetAddress.getAllByName

Syntax
public static InetAddress[] getAllByName( String host ) throws UnknownHostException
Parameters
host
the name of the host.
Returns
an array of all the IP addresses for a given host name.
Description
Determines all the IP addresses of a host, given the host's name. The host name can either be a machine name, such as "java.sun.com", or a string representing its IP address, such as "206.26.48.100".

Exceptions
UnknownHostException if no IP address for the host could be found.


 InetAddress.getByName

InetAddress.getByName

Syntax
public static InetAddress getByName( String host ) throws UnknownHostException
Parameters
host
the specified host, or null for the local host.
Returns
an IP address for the given host name.
Description
Determines the IP address of a host, given the host's name. The host name can either be a machine name, such as "java.sun.com", or a string representing its IP address, such as "206.26.48.100".

Exceptions
UnknownHostException if no IP address for the host could be found.


 InetAddress.getHostAddress

InetAddress.getHostAddress

Syntax
public String getHostAddress()
Returns
raw IP address in a string format
Description
Returns the IP address string "%d.%d.%d.%d"


 InetAddress.getHostName

InetAddress.getHostName

Syntax
public String getHostName()
Returns
the host name for this IP address.
Description
Returns the hostname for this address. If the host is equal to null, then this address refers to any of the local machine's available network addresses.


 InetAddress.getLocalHost

InetAddress.getLocalHost

Syntax
public static InetAddress getLocalHost() throws UnknownHostException
Returns
the IP address of the local host.
Description
Returns the local host.

Exceptions
UnknownHostException if no IP address for the host could be found.


 InetAddress.hashCode

InetAddress.hashCode

Syntax
public int hashCode()
Returns
a hash code value for this IP address.
Description
Returns a hashcode for this IP address.

Overrides
hashCode in class Object


 InetAddress.isMulticastAddress

InetAddress.isMulticastAddress

Syntax
public boolean isMulticastAddress()
Description
Utility routine to check if the InetAddress is a IP multicast address. IP multicast address is a Class D address i.e first four bits of the address are 1110.


 InetAddress.toString

InetAddress.toString

Syntax
public String toString()
Returns
a string representation of this IP address.
Description
Converts this IP address to a String.

Overrides
toString in class Object


 Class MalformedURLException

Class java.net.MalformedURLException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.net.MalformedURLException

public class MalformedURLException
extends IOException

Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a specification string or the string could not be parsed.


 MalformedURLException Members

MalformedURLException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
MalformedURLException() | Constructs a MalformedURLException with no detail message.
MalformedURLException(String) | Constructs a MalformedURLException with the specified detail message.


 MalformedURLException.MalformedURLException

MalformedURLException.MalformedURLException

Syntax 1
public MalformedURLException()
Description
Constructs a MalformedURLException with no detail message.

Syntax 2
public MalformedURLException( String msg )
Parameters
msg
the detail message.
Description
Constructs a MalformedURLException with the specified detail message.


 Class MulticastSocket

Class java.net.MulticastSocket

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.net.DatagramSocket
           |
           +----java.net.MulticastSocket

public class MulticastSocket
extends DatagramSocket

The multicast datagram socket class is useful for sending and receiving IP multicast packets. A MulticastSocket is a (UDP) DatagramSocket, with additional capabilities for joining "groups" of other multicast hosts on the internet.

A multicast group is specified by a class D IP address, those in the range 224.0.0.1 to 239.255.255.255, inclusive, and by a standard UDP port number. One would join a multicast group by first creating a MulticastSocket with the desired port, then invoking the joinGroup(InetAddress groupAddr) method:

 // join a Multicast group and send the group salutations
 ...
 byte[] msg = {'H', 'e', 'l', 'l', 'o'};
 InetAddress group = InetAddress.getByName("228.5.6.7");
 MulticastSocket s = new MulticastSocket(6789);
 s.joinGroup(group);
 DatagramPacket hi = new DatagramPacket(msg, msg.length,
                             group, 6789);
 s.send(hi);
 // get their responses!
 byte[] buf = new byte[1000];
 DatagramPacket recv = new DatagramPacket(buf, buf.length);
 s.receive(recv);
 ...
 // OK, I'm done talking - leave the group...
 s.leaveGroup(group);
When one sends a message to a multicast group, all subscribing recipients to that host and port receive the message (within the time-to-live range of the packet, see below). The socket needn't be a member of the multicast group to send messages to it.

When a socket subscribes to a multicast group/port, it receives datagrams sent by other hosts to the group/port, as do all other members of the group and port. A socket relinquishes membership in a group by the leaveGroup(InetAddress addr) method. Multiple MulticastSocket's may subscribe to a multicast group and port concurrently, and they will all receive group datagrams.

Currently applets are not allowed ot use multicast sockets.


 MulticastSocket Members

MulticastSocket Members

Class Overview | This Package | All Packages

Constructors
Name | Description
MulticastSocket() | Create a multicast socket.
MulticastSocket(int) | Create a multicast socket and bind it to a specific port.

Methods
Name | Description
getInterface() | Retrieve the address of the network interface used for multicast packets.
getTTL() | Get the default time-to-live for multicast packets sent out on the socket.
joinGroup(InetAddress) | Joins a multicast group.
leaveGroup(InetAddress) | Leave a multicast group.
send(DatagramPacket, byte) | Sends a datagram packet to the destination, with a TTL (time- to-live) other than the default for the socket.
setInterface(InetAddress) | Set the outgoing network interface for multicast packets on this socket, to other than the system default.
setTTL(byte) | Set the default time-to-live for multicast packets sent out on this socket.


 MulticastSocket.MulticastSocket

MulticastSocket.MulticastSocket

Syntax 1
public MulticastSocket() throws IOException
Description
Create a multicast socket.

Syntax 2
public MulticastSocket( int port ) throws IOException
Parameters
local
port to use
Description
Create a multicast socket and bind it to a specific port.


 MulticastSocket.getInterface

MulticastSocket.getInterface

Syntax
public InetAddress getInterface() throws SocketException
Description
Retrieve the address of the network interface used for multicast packets.


 MulticastSocket.getTTL

MulticastSocket.getTTL

Syntax
public byte getTTL() throws IOException
Description
Get the default time-to-live for multicast packets sent out on the socket.


 MulticastSocket.joinGroup

MulticastSocket.joinGroup

Syntax
public void joinGroup( InetAddress mcastaddr ) throws IOException
Parameters
mcastaddr
is the multicast address to join
Description
Joins a multicast group.

Exceptions
IOException is raised if there is an error joining or when address is not a multicast address.


 MulticastSocket.leaveGroup

MulticastSocket.leaveGroup

Syntax
public void leaveGroup( InetAddress mcastaddr ) throws IOException
Parameters
mcastaddr
is the multicast address to leave
Description
Leave a multicast group.

Exceptions
IOException is raised if there is an error leaving or when address is not a multicast address.


 MulticastSocket.send

MulticastSocket.send

Syntax
public synchronized void send( DatagramPacket p, byte ttl ) throws IOException
Parameters
p
is the packet to be sent. The packet should contain the destination multicast ip address and the data to be sent. One does not need to be the member of the group to send packets to a destination multicast address.
ttl
optional time to live for multicast packet. default ttl is 1.
Description
Sends a datagram packet to the destination, with a TTL (time- to-live) other than the default for the socket. This method need only be used in instances where a particular TTL is desired; otherwise it is preferable to set a TTL once on the socket, and use that default TTL for all packets. This method does not alter the default TTL for the socket.

Exceptions
IOException is raised if an error occurs i.e error while setting ttl.
See Also
send, receive


 MulticastSocket.setInterface

MulticastSocket.setInterface

Syntax
public void setInterface( InetAddress inf ) throws SocketException
Description
Set the outgoing network interface for multicast packets on this socket, to other than the system default. Useful for multihomed hosts.


 MulticastSocket.setTTL

MulticastSocket.setTTL

Syntax
public void setTTL( byte ttl ) throws IOException
Parameters
ttl
the time-to-live
Description
Set the default time-to-live for multicast packets sent out on this socket. The TTL sets the IP time-to-live for DatagramPackets sent to a MulticastGroup, which specifies how many "hops" that the packet will be forwarded on the network before it expires.

The ttl is an unsigned 8-bit quantity, and so must be in the range 0 < ttl <= 0xFF .


 Class NoRouteToHostException

Class java.net.NoRouteToHostException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.net.SocketException
                                   |
                                   +----java.net.NoRouteToHostException

public class NoRouteToHostException
extends SocketException

Signals that an error occurred while attempting to connect a socket to a remote address and port. Typically, the remote host cannot be reached because of an intervening firewall, or if an intermediate router is down.


 NoRouteToHostException Members

NoRouteToHostException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
NoRouteToHostException() | Construct a new NoRouteToHostException with no detailed message.
NoRouteToHostException(String) | Constructs a new NoRouteToHostException with the specified detail message as to why the remote host cannot be reached.


 NoRouteToHostException.NoRouteToHostException

NoRouteToHostException.NoRouteToHostException

Syntax 1
public NoRouteToHostException( String msg )
Parameters
msg
the detail message
Description
Constructs a new NoRouteToHostException with the specified detail message as to why the remote host cannot be reached. A detail message is a String that gives a specific description of this error.

Syntax 2
public NoRouteToHostException()
Description
Construct a new NoRouteToHostException with no detailed message.


 Class ProtocolException

Class java.net.ProtocolException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.net.ProtocolException

public class ProtocolException
extends IOException

Thrown to indicate that there is an error in the underlying protocol, such as a TCP error.


 ProtocolException Members

ProtocolException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ProtocolException() | Constructs a new ProtocolException with no detail message.
ProtocolException(String) | Constructs a new ProtocolException with the specified detail message.


 ProtocolException.ProtocolException

ProtocolException.ProtocolException

Syntax 1
public ProtocolException( String host )
Parameters
host
the detail message.
Description
Constructs a new ProtocolException with the specified detail message.

Syntax 2
public ProtocolException()
Description
Constructs a new ProtocolException with no detail message.


 Class ServerSocket

Class java.net.ServerSocket

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.net.ServerSocket

public class ServerSocket
extends Object

This class implements server sockets. A server socket waits for requests to come in over the network. It performs some operation based on that request, and then possibly returns a result to the requester.

The actual work of the server socket is performed by an instance of the SocketImpl class. An application can change the socket factory that creates the socket implementation to configure itself to create sockets appropriate to the local firewall.

See Also:
SocketImpl, setSocketFactory


 ServerSocket Members

ServerSocket Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ServerSocket(int) | Creates a server socket on a specified port.
ServerSocket(int, int) | Creates a server socket and binds it to the specified local port number.
ServerSocket(int, int, InetAddress) | Create a server with the specified port, listen backlog, and local IP address to bind to.

Methods
Name | Description
accept() | Listens for a connection to be made to this socket and accepts it.
close() | Closes this socket.
getInetAddress() | Returns the local address of this server socket.
getLocalPort() | Returns the port on which this socket is listening.
getSoTimeout() | Retrive setting for SO_TIMEOUT.
implAccept(Socket) | Subclasses of ServerSocket use this method to override accept() to return their own subclass of socket.
setSocketFactory(SocketImplFactory) | Sets the server socket implementation factory for the application.
setSoTimeout(int) | Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.
toString() | Returns the implementation address and implementation port of this socket as a String.


 ServerSocket.ServerSocket

ServerSocket.ServerSocket

Syntax 1
public ServerSocket( int port ) throws IOException
Parameters
port
the port number, or 0 to use any free port.
Description
Creates a server socket on a specified port. A port of 0 creates a socket on any free port.

The maximum queue length for incoming connection indications (a request to connect) is set to 50. If a connection indication arrives when the queue is full, the connection is refused.

If the application has specified a server socket factory, that factory's createSocketImpl method is called to create the actual socket implementation. Otherwise a "plain" socket is created.

Exceptions
IOException if an I/O error occurs when opening the socket.
See Also
SocketImpl, createSocketImpl, setSocketFactory

Syntax 2
public ServerSocket( int port, int backlog ) throws IOException
Parameters
port
the specified port, or 0 to use any free port.
backlog
the maximum length of the queue.
Description
Creates a server socket and binds it to the specified local port number. A port number of 0 creates a socket on any free port.

The maximum queue length for incoming connection indications (a request to connect) is set to the count parameter. If a connection indication arrives when the queue is full, the connection is refused.

If the application has specified a server socket factory, that factory's createSocketImpl method is called to create the actual socket implementation. Otherwise a "plain" socket is created.

Exceptions
IOException if an I/O error occurs when opening the socket.
See Also
SocketImpl, createSocketImpl, setSocketFactory

Syntax 3
public ServerSocket( int port, int backlog, InetAddress bindAddr ) throws IOException
Parameters
port
the local TCP port
backlog
the listen backlog
bindAddr
the local InetAddress the server will bind to
Description
Create a server with the specified port, listen backlog, and local IP address to bind to. The bindAddr argument can be used on a multi-homed host for a ServerSocket that will only accept connect requests to one of its addresses. If bindAddr is null, it will default accepting connections on any/all local addresses. The port must be between 0 and 65535, inclusive.

See Also
SocketConstants, SocketOption, SocketImpl, 1


 ServerSocket.accept

ServerSocket.accept

Syntax
public Socket accept() throws IOException
Description
Listens for a connection to be made to this socket and accepts it. The method blocks until a connection is made.

Exceptions
IOException if an I/O error occurs when waiting for a connection.


 ServerSocket.close

ServerSocket.close

Syntax
public void close() throws IOException
Description
Closes this socket.

Exceptions
IOException if an I/O error occurs when closing the socket.


 ServerSocket.getInetAddress

ServerSocket.getInetAddress

Syntax
public InetAddress getInetAddress()
Returns
the address to which this socket is connected, or null if the socket is not yet connected.
Description
Returns the local address of this server socket.


 ServerSocket.getLocalPort

ServerSocket.getLocalPort

Syntax
public int getLocalPort()
Returns
the port number to which this socket is listening.
Description
Returns the port on which this socket is listening.


 ServerSocket.getSoTimeout

ServerSocket.getSoTimeout

Syntax
public synchronized int getSoTimeout() throws IOException
Description
Retrive setting for SO_TIMEOUT. 0 returns implies that the option is disabled (i.e., timeout of infinity).


 ServerSocket.implAccept

ServerSocket.implAccept

Syntax
protected final void implAccept( Socket s ) throws IOException
Description
Subclasses of ServerSocket use this method to override accept() to return their own subclass of socket. So a FooServerSocket will typically hand this method an empty FooSocket(). On return from implAccept the FooSocket will be connected to a client.


 ServerSocket.setSocketFactory

ServerSocket.setSocketFactory

Syntax
public static synchronized void setSocketFactory( SocketImplFactory fac ) throws IOException
Parameters
fac
the desired factory.
Description
Sets the server socket implementation factory for the application. The factory can be specified only once.

When an application creates a new server socket, the socket implementation factory's createSocketImpl method is called to create the actual socket implementation.

Exceptions
IOException if an I/O error occurs when setting the socket factory.
Exceptions
SocketException if the factory has already been defined.
See Also
createSocketImpl


 ServerSocket.setSoTimeout

ServerSocket.setSoTimeout

Syntax
public synchronized void setSoTimeout( int timeout ) throws SocketException
Description
Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. With this option set to a non-zero timeout, a call to accept() for this ServerSocket will block for only this amount of time. If the timeout expires, a java.io.InterruptedIOException is raised, though the ServerSocket is still valid. The option must be enabled prior to entering the blocking operation to have effect. The timeout must be > 0. A timeout of zero is interpreted as an infinite timeout.


 ServerSocket.toString

ServerSocket.toString

Syntax
public String toString()
Returns
a string representation of this socket.
Description
Returns the implementation address and implementation port of this socket as a String.

Overrides
toString in class Object


 Class Socket

Class java.net.Socket

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.net.Socket

public class Socket
extends Object

This class implements client sockets (also called just "sockets"). A socket is an endpoint for communication between two machines.

The actual work of the socket is performed by an instance of the SocketImpl class. An application, by changing the socket factory that creates the socket implementation, can configure itself to create sockets appropriate to the local firewall.

See Also:
setSocketImplFactory, SocketImpl


 Socket Members

Socket Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Socket() | Creates an unconnected socket, with the system-default type of SocketImpl.
Socket(InetAddress, int) | Creates a stream socket and connects it to the specified port number at the specified IP address.
Socket(InetAddress, int, boolean) | Creates a socket and connects it to the specified port number at the specified IP address. Deprecated.
Socket(InetAddress, int, InetAddress, int) | Creates a socket and connects it to the specified remote address on the specified remote port.
Socket(SocketImpl) | Creates an unconnected Socket with a user-specified SocketImpl.
Socket(String, int) | Creates a stream socket and connects it to the specified port number on the named host.
Socket(String, int, boolean) | Creates a stream socket and connects it to the specified port number on the named host. Deprecated.
Socket(String, int, InetAddress, int) | Creates a socket and connects it to the specified remote host on the specified remote port.

Methods
Name | Description
close() | Closes this socket.
getInetAddress() | Returns the address to which the socket is connected.
getInputStream() | Returns an input stream for this socket.
getLocalAddress() | Gets the local address to which the socket is bound.
getLocalPort() | Returns the local port to which this socket is bound.
getOutputStream() | Returns an output stream for this socket.
getPort() | Returns the remote port to which this socket is connected.
getSoLinger() | Returns setting for SO_LINGER.
getSoTimeout() | Returns setting for SO_TIMEOUT.
getTcpNoDelay() | Tests if TCP_NODELAY is enabled.
setSocketImplFactory(SocketImplFactory) | Sets the client socket implementation factory for the application.
setSoLinger(boolean, int) | Enable/disable SO_LINGER with the specified linger time.
setSoTimeout(int) | Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.
setTcpNoDelay(boolean) | Enable/disable TCP_NODELAY (disable/enable Nagle's algorithm).
toString() | Converts this socket to a String.


 Socket.Socket

Socket.Socket

Syntax 1
protected Socket()
Description
Creates an unconnected socket, with the system-default type of SocketImpl.

Syntax 2
protected Socket( SocketImpl impl ) throws SocketException
Description
Creates an unconnected Socket with a user-specified SocketImpl.

The impl parameter is an instance of a SocketImpl the subclass wishes to use on the Socket.

Syntax 3
public Socket( String host, int port ) throws UnknownHostException, IOException
Parameters
host
the host name.
port
the port number.
Description
Creates a stream socket and connects it to the specified port number on the named host.

If the application has specified a server socket factory, that factory's createSocketImpl method is called to create the actual socket implementation. Otherwise a "plain" socket is created.

Exceptions
IOException if an I/O error occurs when creating the socket.
See Also
setSocketImplFactory, SocketImpl, createSocketImpl

Syntax 4
public Socket( InetAddress address, int port ) throws IOException
Parameters
address
the IP address.
port
the port number.
Description
Creates a stream socket and connects it to the specified port number at the specified IP address.

If the application has specified a socket factory, that factory's createSocketImpl method is called to create the actual socket implementation. Otherwise a "plain" socket is created.

Exceptions
IOException if an I/O error occurs when creating the socket.
See Also
setSocketImplFactory, SocketImpl, createSocketImpl

Syntax 5
public Socket( String host, int port, InetAddress localAddr, int localPort ) throws IOException
Parameters
host
the name of the remote host
port
the remote port
localAddr
the local address the socket is bound to
localPort
the local port the socket is bound to
Description
Creates a socket and connects it to the specified remote host on the specified remote port. The Socket will also bind() to the local address and port supplied.

Syntax 6
public Socket( InetAddress address, int port, InetAddress localAddr, int localPort ) throws IOException
Parameters
address
the remote address
port
the remote port
localAddr
the local address the socket is bound to
localPort
the local port the socket is bound to
Description
Creates a socket and connects it to the specified remote address on the specified remote port. The Socket will also bind() to the local address and port supplied.

Syntax 7
public Socket( String host, int port, boolean stream ) throws IOException
Parameters
host
the host name.
port
the port number.
stream
a boolean indicating whether this is a stream socket or a datagram socket.
Description
Note: Socket() is deprecated. Use DatagramSocket instead for UDP transport.

Creates a stream socket and connects it to the specified port number on the named host.

If the stream argument is true, this creates a stream socket. If the stream argument is false, it creates a datagram socket.

If the application has specified a server socket factory, that factory's createSocketImpl method is called to create the actual socket implementation. Otherwise a "plain" socket is created.

Exceptions
IOException if an I/O error occurs when creating the socket.
See Also
setSocketImplFactory, SocketImpl, createSocketImpl

Syntax 8
public Socket( InetAddress host, int port, boolean stream ) throws IOException
Parameters
address
the IP address.
port
the port number.
stream
if true, create a stream socket; otherwise, create a datagram socket.
Description
Note: Socket() is deprecated. Use DatagramSocket instead for UDP transport.

Creates a socket and connects it to the specified port number at the specified IP address.

If the stream argument is true, this creates a stream socket. If the stream argument is false, it creates a datagram socket.

If the application has specified a server socket factory, that factory's createSocketImpl method is called to create the actual socket implementation. Otherwise a "plain" socket is created.

Exceptions
IOException if an I/O error occurs when creating the socket.
See Also
setSocketImplFactory, SocketImpl, createSocketImpl


 Socket.close

Socket.close

Syntax
public synchronized void close() throws IOException
Description
Closes this socket.

Exceptions
IOException if an I/O error occurs when closing this socket.


 Socket.getInetAddress

Socket.getInetAddress

Syntax
public InetAddress getInetAddress()
Returns
the remote IP address to which this socket is connected.
Description
Returns the address to which the socket is connected.


 Socket.getInputStream

Socket.getInputStream

Syntax
public InputStream getInputStream() throws IOException
Returns
an input stream for reading bytes from this socket.
Description
Returns an input stream for this socket.

Exceptions
IOException if an I/O error occurs when creating the input stream.


 Socket.getLocalAddress

Socket.getLocalAddress

Syntax
public InetAddress getLocalAddress()
Description
Gets the local address to which the socket is bound.


 Socket.getLocalPort

Socket.getLocalPort

Syntax
public int getLocalPort()
Returns
the local port number to which this socket is connected.
Description
Returns the local port to which this socket is bound.


 Socket.getOutputStream

Socket.getOutputStream

Syntax
public OutputStream getOutputStream() throws IOException
Returns
an output stream for writing bytes to this socket.
Description
Returns an output stream for this socket.

Exceptions
IOException if an I/O error occurs when creating the output stream.


 Socket.getPort

Socket.getPort

Syntax
public int getPort()
Returns
the remote port number to which this socket is connected.
Description
Returns the remote port to which this socket is connected.


 Socket.getSoLinger

Socket.getSoLinger

Syntax
public int getSoLinger() throws SocketException
Description
Returns setting for SO_LINGER. -1 returns implies that the option is disabled.


 Socket.getSoTimeout

Socket.getSoTimeout

Syntax
public synchronized int getSoTimeout() throws SocketException
Description
Returns setting for SO_TIMEOUT. 0 returns implies that the option is disabled (i.e., timeout of infinity).


 Socket.getTcpNoDelay

Socket.getTcpNoDelay

Syntax
public boolean getTcpNoDelay() throws SocketException
Description
Tests if TCP_NODELAY is enabled.


 Socket.setSocketImplFactory

Socket.setSocketImplFactory

Syntax
public static synchronized void setSocketImplFactory( SocketImplFactory fac ) throws IOException
Parameters
fac
the desired factory.
Description
Sets the client socket implementation factory for the application. The factory can be specified only once.

When an application creates a new client socket, the socket implementation factory's createSocketImpl method is called to create the actual socket implementation.

Exceptions
IOException if an I/O error occurs when setting the socket factory.
Exceptions
SocketException if the factory is already defined.
See Also
createSocketImpl


 Socket.setSoLinger

Socket.setSoLinger

Syntax
public void setSoLinger( boolean on, int val ) throws SocketException
Description
Enable/disable SO_LINGER with the specified linger time.


 Socket.setSoTimeout

Socket.setSoTimeout

Syntax
public synchronized void setSoTimeout( int timeout ) throws SocketException
Description
Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. With this option set to a non-zero timeout, a read() call on the InputStream associated with this Socket will block for only this amount of time. If the timeout expires, a java.io.InterruptedIOException is raised, though the Socket is still valid. The option must be enabled prior to entering the blocking operation to have effect. The timeout must be > 0. A timeout of zero is interpreted as an infinite timeout.


 Socket.setTcpNoDelay

Socket.setTcpNoDelay

Syntax
public void setTcpNoDelay( boolean on ) throws SocketException
Description
Enable/disable TCP_NODELAY (disable/enable Nagle's algorithm).


 Socket.toString

Socket.toString

Syntax
public String toString()
Returns
a string representation of this socket.
Description
Converts this socket to a String.

Overrides
toString in class Object


 Class SocketException

Class java.net.SocketException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.net.SocketException

public class SocketException
extends IOException

Thrown to indicate that there is an error in the underlying protocol, such as a TCP error.


 SocketException Members

SocketException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
SocketException() | Constructs a new ProtocolException with no detail message.
SocketException(String) | Constructs a new ProtocolException with the specified detail message.


 SocketException.SocketException

SocketException.SocketException

Syntax 1
public SocketException( String msg )
Parameters
host
the detail message.
Description
Constructs a new ProtocolException with the specified detail message.

Syntax 2
public SocketException()
Description
Constructs a new ProtocolException with no detail message.


 Class SocketImpl

Class java.net.SocketImpl

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.net.SocketImpl

public abstract class SocketImpl
extends Object
implements SocketOptions

The abstract class SocketImpl is a common superclass of all classes that actually implement sockets. It is used to create both client and server sockets.

A "plain" socket implements these methods exactly as described, without attempting to go through a firewall or proxy.


 SocketImpl Members

SocketImpl Members

Class Overview | This Package | All Packages

Fields
Name | Description
address | The IP address of the remote end of this socket.
fd | The file descriptor object for this socket.
localport | The local port number to which this socket is connected.
port | The port number on the remote host to which this socket is connected.

Constructors
Name | Description
SocketImpl() |

Methods
Name | Description
accept(SocketImpl) | Accepts a connection.
available() | Returns the number of bytes that can be read from this socket without blocking.
bind(InetAddress, int) | Binds this socket to the specified port number on the specified host.
close() | Closes this socket.
connect(InetAddress, int) | Connects this socket to the specified port number on the specified host.
connect(String, int) | Connects this socket to the specified port on the named host.
create(boolean) | Creates either a stream or a datagram socket.
getFileDescriptor() | Returns the value of this socket's fd field.
getInetAddress() | Returns the value of this socket's address field.
getInputStream() | Returns an input stream for this socket.
getLocalPort() | Returns the value of this socket's localport field.
getOutputStream() | Returns an output stream for this socket.
getPort() | Returns the value of this socket's port field.
listen(int) | Sets the maximum queue length for incoming connection indications (a request to connect) to the count argument.
toString() | Returns the address and port of this socket as a String.


 SocketImpl.address

SocketImpl.address

Syntax
protected InetAddress address
Description
The IP address of the remote end of this socket.


 SocketImpl.fd

SocketImpl.fd

Syntax
protected FileDescriptor fd
Description
The file descriptor object for this socket.


 SocketImpl.localport

SocketImpl.localport

Syntax
protected int localport
Description
The local port number to which this socket is connected.


 SocketImpl.port

SocketImpl.port

Syntax
protected int port
Description
The port number on the remote host to which this socket is connected.


 SocketImpl.SocketImpl

SocketImpl.SocketImpl

Syntax
public SocketImpl()


 SocketImpl.accept

SocketImpl.accept

Syntax
protected abstract void accept( SocketImpl s ) throws IOException
Parameters
s
the accepted connection.
Description
Accepts a connection.

Exceptions
IOException if an I/O error occurs when accepting the connection.


 SocketImpl.available

SocketImpl.available

Syntax
protected abstract int available() throws IOException
Returns
the number of bytes that can be read from this socket without blocking.
Description
Returns the number of bytes that can be read from this socket without blocking.

Exceptions
IOException if an I/O error occurs when determining the number of bytes available.


 SocketImpl.bind

SocketImpl.bind

Syntax
protected abstract void bind( InetAddress host, int port ) throws IOException
Parameters
host
the IP address of the remote host.
port
the port number.
Description
Binds this socket to the specified port number on the specified host.

Exceptions
IOException if an I/O error occurs when binding this socket.


 SocketImpl.close

SocketImpl.close

Syntax
protected abstract void close() throws IOException
Description
Closes this socket.

Exceptions
IOException if an I/O error occurs when closing this socket.


 SocketImpl.connect

SocketImpl.connect

Syntax 1
protected abstract void connect( String host, int port ) throws IOException
Parameters
host
the name of the remote host.
port
the port number.
Description
Connects this socket to the specified port on the named host.

Exceptions
IOException if an I/O error occurs when connecting to the remote host.

Syntax 2
protected abstract void connect( InetAddress address, int port ) throws IOException
Parameters
address
the IP address of the remote host.
port
the port number.
Description
Connects this socket to the specified port number on the specified host.

Exceptions
IOException if an I/O error occurs when attempting a connection.


 SocketImpl.create

SocketImpl.create

Syntax
protected abstract void create( boolean stream ) throws IOException
Parameters
stream
if true, create a stream socket; otherwise, create a datagram socket.
Description
Creates either a stream or a datagram socket.

Exceptions
IOException if an I/O error occurs while creating the socket.


 SocketImpl.getFileDescriptor

SocketImpl.getFileDescriptor

Syntax
protected FileDescriptor getFileDescriptor()
Returns
the value of this socket's fd field.
Description
Returns the value of this socket's fd field.

See Also
fd


 SocketImpl.getInetAddress

SocketImpl.getInetAddress

Syntax
protected InetAddress getInetAddress()
Returns
the value of this socket's address field.
Description
Returns the value of this socket's address field.

See Also
address


 SocketImpl.getInputStream

SocketImpl.getInputStream

Syntax
protected abstract InputStream getInputStream() throws IOException
Returns
a stream for reading from this socket.
Description
Returns an input stream for this socket.

Exceptions
IOException if an I/O error occurs when creating the input stream.


 SocketImpl.getLocalPort

SocketImpl.getLocalPort

Syntax
protected int getLocalPort()
Returns
the value of this socket's localport field.
Description
Returns the value of this socket's localport field.

See Also
localport


 SocketImpl.getOutputStream

SocketImpl.getOutputStream

Syntax
protected abstract OutputStream getOutputStream() throws IOException
Returns
an output stream for writing to this socket.
Description
Returns an output stream for this socket.

Exceptions
IOException if an I/O error occurs when creating the output stream.


 SocketImpl.getPort

SocketImpl.getPort

Syntax
protected int getPort()
Returns
the value of this socket's port field.
Description
Returns the value of this socket's port field.

See Also
port


 SocketImpl.listen

SocketImpl.listen

Syntax
protected abstract void listen( int backlog ) throws IOException
Parameters
backlog
the maximum length of the queue.
Description
Sets the maximum queue length for incoming connection indications (a request to connect) to the count argument. If a connection indication arrives when the queue is full, the connection is refused.

Exceptions
IOException if an I/O error occurs when creating the queue.


 SocketImpl.toString

SocketImpl.toString

Syntax
public String toString()
Returns
a string representation of this socket.
Description
Returns the address and port of this socket as a String.

Overrides
toString in class Object


 Interface SocketImplFactory

Interface java.net.SocketImplFactory

Interface Members | This Package | All Packages

public interface SocketImplFactory

This interface defines a factory for socket implementations. It is used by the classes Socket and ServerSocket to create actual socket implementations.

See Also:
Socket, ServerSocket


 SocketImplFactory Members

SocketImplFactory Members

Interface Overview | This Package | All Packages

Methods
Name | Description
createSocketImpl() | Creates a new SocketImpl instance.


 SocketImplFactory.createSocketImpl

SocketImplFactory.createSocketImpl

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract SocketImpl createSocketImpl()
Returns
a new instance of SocketImpl.
Description
Creates a new SocketImpl instance.

See Also
SocketImpl


 Class URL

Class java.net.URL

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.net.URL

public final class URL
extends Object
implements Serializable

Class URL represents a Uniform Resource Locator, a pointer to a "resource" on the World Wide Web. A resource can be something as simple as a file or a directory, or it can be a reference to a more complicated object, such as a query to a database or to a search engine. More information on the types of URLs and their formats can be found at:

    http://www.ncsa.uiuc.edu/demoweb/url-primer.html

In general, a URL can be broken into several parts. The previous example of a URL indicates that the protocol to use is http (HyperText Transport Protocol) and that the information resides on a host machine named www.ncsa.uiuc.edu. The information on that host machine is named demoweb/url-primer.html. The exact meaning of this name on the host machine is both protocol dependent and host dependent. The information normally resides in a file, but it could be generated on the fly. This component of the URL is called the file component, even though the information is not necessarily in a file.

A URL can optionally specify a "port", which is the port number to which the TCP connection is made on the remote host machine. If the port is not specified, the default port for the protocol is used instead. For example, the default port for http is 80. An alternative port could be specified as:

    http://www.ncsa.uiuc.edu:8080/demoweb/url-primer.html

A URL may have appended to it an "anchor", also known as a "ref" or a "reference". The anchor is indicated by the sharp sign character "#" followed by more characters. For example,

    http://java.sun.com/index.html#chapter1

This anchor is not technically part of the URL. Rather, it indicates that after the specified resource is retrieved, the application is specifically interested in that part of the document that has the tag chapter1 attached to it. The meaning of a tag is resource specific.

An application can also specify a "relative URL", which contains only enough information to reach the resource relative to another URL. Relative URLs are frequently used within HTML pages. For example, if the contents of the URL:

    http://java.sun.com/index.html
contained within it the relative URL:
    FAQ.html
it would be a shorthand for:
    http://java.sun.com/FAQ.html

The relative URL need not specify all the components of a URL. If the protocol, host name, or port number is missing, the value is inherited from the fully specified URL. The file component must be specified. The optional anchor is not inherited.


 URL Members

URL Members

Class Overview | This Package | All Packages

Constructors
Name | Description
URL(String) | Creates a URL object from the String representation.
URL(String, String, int, String) | Creates a URL object from the specified protocol, host, port number, and file.
URL(String, String, String) | Creates an absolute URL from the specified protocol name, host name, and file name.
URL(URL, String) | Creates a URL by parsing the specification spec within a specified context.

Methods
Name | Description
equals(Object) | Compares two URLs.
getContent() | Returns the contents of this URL.
getFile() | Returns the file name of this URL.
getHost() | Returns the host name of this URL, if applicable.
getPort() | Returns the port number of this URL.
getProtocol() | Returns the protocol name this URL.
getRef() | Returns the anchor (also known as the "reference") of this URL.
hashCode() | Creates an integer suitable for hash table indexing.
openConnection() | Returns a URLConnection object that represents a connection to the remote object referred to by the URL.
openStream() | Opens a connection to this URL and returns an InputStream for reading from that connection.
sameFile(URL) | Compares two URLs, excluding the "ref" fields.
set(String, String, int, String, String) | Sets the fields of the URL.
setURLStreamHandlerFactory(URLStreamHandlerFactory) | Sets an application's URLStreamHandlerFactory.
toExternalForm() | Constructs a string representation of this URL.
toString() | Constructs a string representation of this URL.


 URL.URL

URL.URL

Syntax 1
public URL( String protocol, String host, int port, String file ) throws MalformedURLException
Parameters
protocol
the name of the protocol.
host
the name of the host.
port
the port number.
file
the host file.
Description
Creates a URL object from the specified protocol, host, port number, and file. Specifying a port number of -1 indicates that the URL should use the default port for the protocol.

If this is the first URL object being created with the specified protocol, a stream protocol handler object, an instance of class URLStreamHandler, is created for that protocol:

  1. If the application has previously set up an instance of URLStreamHandlerFactory as the stream handler factory, then the createURLStreamHandler method of that instance is called with the protocol string as an argument to create the stream protocol handler.
  2. If no URLStreamHandlerFactory has yet been set up, or if the factory's createURLStreamHandler method returns null, then the constructor finds the value of the system property:
      java.handler.protol.pkgs
    If the value of that system property is not null, it is interpreted as a list of packages separated by a vertical slash character '|'. The constructor tries to load the class named:
      <package>.<protocol>.Handler
    where <package> is replaced by the name of the package and <protocol> is replaced by the name of the protocol. If this class does not exist, or if the class exists but it is not a subclass of URLStreamHandler, then the next package in the list is tried.
  3. If the previous step fails to find a protocol handler, then the constructor tries to load the class named:
      sun.net.www.protocol.<protocol>.Handler
    If this class does not exist, or if the class exists but it is not a subclass of URLStreamHandler, then a MalformedURLException is thrown.

Exceptions
MalformedURLException if an unknown protocol is specified.
See Also
getProperty, setURLStreamHandlerFactory, URLStreamHandler, createURLStreamHandler

Syntax 2
public URL( String protocol, String host, String file ) throws MalformedURLException
Parameters
protocol
the protocol to use.
host
the host to connect to.
file
the file on that host.
Description
Creates an absolute URL from the specified protocol name, host name, and file name. The default port for the specified protocol is used.

This method is equivalent to calling the four-argument constructor with the arguments being protocol, host, -1, and file.

Exceptions
MalformedURLException if an unknown protocol is specified.
See Also
URL

Syntax 3
public URL( String spec ) throws MalformedURLException
Parameters
spec
the String to parse as a URL.
Description
Creates a URL object from the String representation.

This constructor is equivalent to a call to the two-argument constructor with a null first argument.

Exceptions
MalformedURLException If the string specifies an unknown protocol.
See Also
URL

Syntax 4
public URL( URL context, String spec ) throws MalformedURLException
Parameters
context
the context in which to parse the specification.
spec
a String representation of a URL.
Description
Creates a URL by parsing the specification spec within a specified context. If the context argument is not null and the spec argument is a partial URL specification, then any of the strings missing components are inherited from the context argument.

The specification given by the String argument is parsed to determine if it specifies a protocol. If the String contains an ASCII colon ':' character before the first occurrence of an ASCII slash character '/', then the characters before the colon comprise the protocol.

  • If the spec argument does not specify a protocol:
    • If the context argument is not null, then the protocol is copied from the context argument.
    • If the context argument is null, then a MalformedURLException is thrown.
  • If the spec argument does specify a protocol:
    • If the context argument is null, or specifies a different protocol than the specification argument, the context argument is ignored.
    • If the context argument is not null and specifies the same protocol as the specification, the host, port number, and file are copied from the context argument into the newly created URL.

The constructor then searches for an appropriate stream protocol handler of type URLStreamHandler as outlined for:

    java.net.URL#URL(java.lang.String, java.lang.String, int, java.lang.String)
The stream protocol handler's parseURL method is called to parse the remaining fields of the specification that override any defaults set by the context argument.

Exceptions
MalformedURLException if no protocol is specified, or an unknown protocol is found.
See Also
URL, URLStreamHandler, parseURL


 URL.equals

URL.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the URL to compare against.
Returns
true if the objects are the same; false otherwise.
Description
Compares two URLs. The result is true if and only if the argument is not null and is a URL object that represents the same URL as this object. Two URL objects are equal if they have the same protocol and reference the same host, the same port number on the host, and the same file on the host. The anchors of the URL objects are not compared.

This method is equivalent to:

    (obj instanceof URL) && sameFile((URL)obj)

Overrides
equals in class Object


 URL.getContent

URL.getContent

Syntax
public final Object getContent() throws IOException
Returns
the contents of this URL.
Description
Returns the contents of this URL. This method is a shorthand for:
    openConnection().getContent()

Exceptions
IOException if an I/O exception occurs.
See Also
getContent


 URL.getFile

URL.getFile

Syntax
public String getFile()
Returns
the file name of this URL.
Description
Returns the file name of this URL.


 URL.getHost

URL.getHost

Syntax
public String getHost()
Returns
the host name of this URL.
Description
Returns the host name of this URL, if applicable. For "file" protocol, this is an empty string.


 URL.getPort

URL.getPort

Syntax
public int getPort()
Returns
the port number
Description
Returns the port number of this URL. Returns -1 if the port is not set.


 URL.getProtocol

URL.getProtocol

Syntax
public String getProtocol()
Returns
the protocol of this URL.
Description
Returns the protocol name this URL.


 URL.getRef

URL.getRef

Syntax
public String getRef()
Returns
the anchor (also known as the "reference") of this URL.
Description
Returns the anchor (also known as the "reference") of this URL.


 URL.hashCode

URL.hashCode

Syntax
public int hashCode()
Returns
a hash code for this URL.
Description
Creates an integer suitable for hash table indexing.

Overrides
hashCode in class Object


 URL.openConnection

URL.openConnection

Syntax
public URLConnection openConnection() throws IOException
Returns
a URLConnection to the URL.
Description
Returns a URLConnection object that represents a connection to the remote object referred to by the URL.

If there is not already an open connection, the connection is opened by calling the openConnection method of the protocol handler for this URL.

Exceptions
IOException if an I/O exception occurs.
See Also
URL, URLConnection, openConnection


 URL.openStream

URL.openStream

Syntax
public final InputStream openStream() throws IOException
Returns
an input stream for reading from the URL connection.
Description
Opens a connection to this URL and returns an InputStream for reading from that connection. This method is a shorthand for:
    openConnection().getInputStream()

Exceptions
IOException if an I/O exception occurs.


 URL.sameFile

URL.sameFile

Syntax
public boolean sameFile( URL other )
Parameters
other
the URL to compare against.
Returns
true if they reference the same remote object; false otherwise.
Description
Compares two URLs, excluding the "ref" fields. Returns true if this URL and the other argument both refer to the same resource. The two URLs might not both contain the same anchor.


 URL.set

URL.set

Syntax
protected void set( String protocol, String host, int port, String file, String ref )
Parameters
protocol
the protocol to use
host
the host name to connecto to
port
the protocol port to connect to
file
the specified file name on that host
ref
the reference
Description
Sets the fields of the URL. This is not a public method so that only URLStreamHandlers can modify URL fields. URLs are otherwise constant. REMIND: this method will be moved to URLStreamHandler


 URL.setURLStreamHandlerFactory

URL.setURLStreamHandlerFactory

Syntax
public static synchronized void setURLStreamHandlerFactory( URLStreamHandlerFactory fac )
Parameters
fac
the desired factory.
Description
Sets an application's URLStreamHandlerFactory. This method can be called at most once by an application.

The URLStreamHandlerFactory instance is used to construct a stream protocol handler from a protocol name.

Exceptions
Error if the application has already set a factory.
See Also
URL, URLStreamHandlerFactory


 URL.toExternalForm

URL.toExternalForm

Syntax
public String toExternalForm()
Returns
a string representation of this object.
Description
Constructs a string representation of this URL. The string is created by calling the toExternalForm method of the stream protocol handler for this object.

See Also
URL, toExternalForm


 URL.toString

URL.toString

Syntax
public String toString()
Returns
a string representation of this object.
Description
Constructs a string representation of this URL. The string is created by calling the toExternalForm method of the stream protocol handler for this object.

Overrides
toString in class Object
See Also
URL, toExternalForm


 Class URLConnection

Class java.net.URLConnection

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.net.URLConnection

public abstract class URLConnection
extends Object

The abstract class URLConnection is the superclass of all classes that represent a communications link between the application and a URL. Instances of this class can be used both to read from and to write to the resource referenced by the URL. In general, creating a connection to a URL is a multistep process:

openConnection() | connect()
Manipulate parameters that affect the connection to the remote resource. | Interact with the resource; query header fields and contents.
---------------------------->
time
  1. The connection object is created by invoking the openConnection method on a URL.
  2. The setup parameters and general request properties are manipulated.
  3. The actual connection to the remote object is made, using the connect method.
  4. The remote object becomes available. The header fields and the contents of the remote object can be accessed.

The setup parameters are modified using the following methods:

  • setAllowUserInteraction
  • setDoInput
  • setDoOutput
  • setIfModifiedSince
  • setUseCaches

and the general request properties are modified using the method:

  • setRequestProperty

Default values for the AllowUserInteraction and UseCaches parameters can be set using the methods setDefaultAllowUserInteraction and setDefaultUseCaches. Default values for general request properties can be set using the setDefaultRequestProperty method.

Each of the above set methods has a corresponding get method to retrieve the value of the parameter or general request property. The specific parameters and general request properties that are applicable are protocol specific.

The following methods are used to access the header fields and the contents after the connection is made to the remote object:

  • getContent
  • getHeaderField
  • getInputStream
  • getOutputStream

Certain header fields are accessed frequently. The methods:

  • getContentEncoding
  • getContentLength
  • getContentType
  • getDate
  • getExpiration
  • getLastModifed

provide convenient access to these fields. The getContentType method is used by the getContent method to determine the type of the remote object; subclasses may find it convenient to override the getContentType method.

In the common case, all of the pre-connection parameters and general request properties can be ignored: the pre-connection parameters and request properties default to sensible values. For most clients of this interface, there are only two interesting methods: getInputStream and getObject, which are mirrored in the URL class by convenience methods.

More information on the request properties and header fields of an http connection can be found at:

    http://www.w3.org/hypertext/WWW/Protocols/HTTP1.0/draft-ietf-http-spec.html

See Also:
openConnection, connect, getContent, getContentEncoding, getContentLength, getContentType, getDate, getExpiration, getHeaderField, getHeaderField, getInputStream, getLastModified, getOutputStream, setAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setIfModifiedSince, setRequestProperty, setUseCaches


 URLConnection Members

URLConnection Members

Class Overview | This Package | All Packages

Fields
Name | Description
allowUserInteraction | If true, this URL is being examined in a context in which it makes sense to allow user interactions such as popping up an authentication dialog.
connected | If false, this connection object has not created a communications link to the specified URL.
doInput | This variable is set by the setDoInput method.
doOutput | This variable is set by the setDoOutput method.
fileNameMap |
ifModifiedSince | Some protocols support skipping the fetching of the object unless the object has been modified more recently than a certain time.
url | The URL represents the remote object on the World Wide Web to which this connection is opened.
useCaches | If true, the protocol is allowed to use caching whenever it can.

Constructors
Name | Description
URLConnection(URL) | Constructs a URL connection to the specified URL.

Methods
Name | Description
connect() | Opens a communications link to the resource referenced by this URL, if such a connection has not already been established.
getAllowUserInteraction() | Returns the value of the allowUserInteraction field for this object.
getContent() | Retrieves the contents of this URL connection.
getContentEncoding() | Returns the value of the content-encoding header field.
getContentLength() | Returns the value of the content-length header field.
getContentType() | Returns the value of the content-type header field.
getDate() | Returns the value of the date header field.
getDefaultAllowUserInteraction() | Returns the default value of the allowUserInteraction field.
getDefaultRequestProperty(String) | Returns the value of the default request property.
getDefaultUseCaches() | Returns the default value of a URLConnection's useCaches flag.
getDoInput() | Returns the value of this URLConnection's doInput flag.
getDoOutput() | Returns the value of this URLConnection's doOutput flag.
getExpiration() | Returns the value of the expires header field.
getHeaderField(int) | Returns the value for the nth header field.
getHeaderField(String) | Returns the name of the specified header field.
getHeaderFieldDate(String, long) | Returns the value of the named field parsed as date.
getHeaderFieldInt(String, int) | Returns the value of the named field parsed as a number.
getHeaderFieldKey(int) | Returns the key for the nth header field.
getIfModifiedSince() | Returns the value of this object's ifModifiedSince field.
getInputStream() | Returns an input stream that reads from this open connection.
getLastModified() | Returns the value of the last-modified header field.
getOutputStream() | Returns an output stream that writes to this connection.
getRequestProperty(String) | Returns the value of the named general request property for this connection.
getURL() | Returns the value of this URLConnection's URL field.
getUseCaches() | Returns the value of this URLConnection's useCaches field.
guessContentTypeFromName(String) | Tries to determine the content type of an object, based on the specified "file" component of a URL.
guessContentTypeFromStream(InputStream) | Tries to determine the type of an input stream based on the characters at the beginning of the input stream.
setAllowUserInteraction(boolean) | Set the value of the allowUserInteraction field of this URLConnection.
setContentHandlerFactory(ContentHandlerFactory) | Sets the ContentHandlerFactory of an application.
setDefaultAllowUserInteraction(boolean) | Sets the default value of the allowUserInteraction field for all future URLConnection objects to the specified value.
setDefaultRequestProperty(String, String) | Sets the default value of a general request property.
setDefaultUseCaches(boolean) | Sets the default value of the useCaches field to the specified value.
setDoInput(boolean) | Sets the value of the doInput field for this URLConnection to the specified value.
setDoOutput(boolean) | Sets the value of the doOutput field for this URLConnection to the specified value.
setIfModifiedSince(long) | Sets the value of the ifModifiedSince field of this URLConnection to the specified value.
setRequestProperty(String, String) | Sets the general request property.
setUseCaches(boolean) | Sets the value of the useCaches field of this URLConnection to the specified value.
toString() | Returns a String representation of this URL connection.


 URLConnection.allowUserInteraction

URLConnection.allowUserInteraction

Syntax
protected boolean allowUserInteraction
Description
If true, this URL is being examined in a context in which it makes sense to allow user interactions such as popping up an authentication dialog. If false, then no user interaction is allowed.

The value of this field can be set by the setAllowUserInteraction method. Its value is returned by the getAllowUserInteraction method. Its default value is the value of the argument in the last invocation of the setDefaultAllowUserInteraction method.

See Also
getAllowUserInteraction, setAllowUserInteraction, setDefaultAllowUserInteraction


 URLConnection.connected

URLConnection.connected

Syntax
protected boolean connected
Description
If false, this connection object has not created a communications link to the specified URL. If true, the communications link has been established.


 URLConnection.doInput

URLConnection.doInput

Syntax
protected boolean doInput
Description
This variable is set by the setDoInput method. Its value is returned by the getDoInput method.

A URL connection can be used for input and/or output. Setting the doInput flag to true indicates that the application intends to read data from the URL connection.

The default value of this field is true.

See Also
getDoInput, setDoInput


 URLConnection.doOutput

URLConnection.doOutput

Syntax
protected boolean doOutput
Description
This variable is set by the setDoOutput method. Its value is returned by the getDoInput method.

A URL connection can be used for input and/or output. Setting the doOutput flag to true indicates that the application intends to write data to the URL connection.

The default value of this field is false.

See Also
getDoOutput, setDoOutput


 URLConnection.fileNameMap

URLConnection.fileNameMap

Syntax
public static FileNameMap fileNameMap


 URLConnection.ifModifiedSince

URLConnection.ifModifiedSince

Syntax
protected long ifModifiedSince
Description
Some protocols support skipping the fetching of the object unless the object has been modified more recently than a certain time.

A nonzero value gives a time as the number of seconds since January 1, 1970, GMT. The object is fetched only if it has been modified more recently than that time.

This variable is set by the setIfModifiedSince method. Its value is returned by the getIfModifiedSince method.

The default value of this field is 0, indicating that the fetching must always occur.

See Also
getIfModifiedSince, setIfModifiedSince


 URLConnection.url

URLConnection.url

Syntax
protected URL url
Description
The URL represents the remote object on the World Wide Web to which this connection is opened.

The value of this field can be accessed by the getURL method.

The default value of this variable is the value of the URL argument in the URLConnection constructor.

See Also
getURL, url


 URLConnection.useCaches

URLConnection.useCaches

Syntax
protected boolean useCaches
Description
If true, the protocol is allowed to use caching whenever it can. If false, the protocol must always try to get a fresh copy of the object.

This field is set by the setUseCaches method. Its value is returned by the getUseCaches method.

Its default value is the value given in the last invocation of the setDefaultUseCaches method.

See Also
setUseCaches, getUseCaches, setDefaultUseCaches


 URLConnection.URLConnection

URLConnection.URLConnection

Syntax
protected URLConnection( URL url )
Parameters
url
the specified URL.
Description
Constructs a URL connection to the specified URL. A connection to the object referenced by the URL is not created.


 URLConnection.connect

URLConnection.connect

Syntax
public abstract void connect() throws IOException
Description
Opens a communications link to the resource referenced by this URL, if such a connection has not already been established.

If the connect method is called when the connection has already been opened (indicated by the connected field having the value true), the call is ignored.

URLConnection objects go through two phases: first they are created, then they are connected. After being created, and before being connected, various options can be specified (e.g., doInput and UseCaches). After connecting, it is an error to try to set them. Operations that depend on being connected, like getContentLength, will implicitly perform the connection, if necessary.

Exceptions
IOException if an I/O error occurs while opening the connection.
See Also
connected


 URLConnection.getAllowUserInteraction

URLConnection.getAllowUserInteraction

Syntax
public boolean getAllowUserInteraction()
Returns
the value of the allowUserInteraction field for this object.
Description
Returns the value of the allowUserInteraction field for this object.

See Also
allowUserInteraction


 URLConnection.getContent

URLConnection.getContent

Syntax
public Object getContent() throws IOException
Returns
the object fetched. The instanceOf operation should be used to determine the specific kind of object returned.
Description
Retrieves the contents of this URL connection.

This method first determines the content type of the object by calling the getContentType method. If this is the first time that the application has seen that specific content type, a content handler for that content type is created:

  1. If the application has set up a content handler factory instance using the setContentHandlerFactory method, the createContentHandler method of that instance is called with the content type as an argument; the result is a content handler for that content type.
  2. If no content handler factory has yet been set up, or if the factory's createContentHandler method returns null, then the application loads the class named:
      sun.net.www.content.<contentType>
    where <contentType> is formed by taking the content-type string, replacing all slash characters with a period ('.'), and all other non-alphanumeric characters with the underscore character '_'. The alphanumeric characters are specifically the 26 uppercase ASCII letters 'A' through 'Z', the 26 lowercase ASCII letters 'a' through 'z', and the 10 ASCII digits '0' through '9'. If the specified class does not exist, or is not a subclass of ContentHandler, then an UnknownServiceException is thrown.

Exceptions
IOException if an I/O error occurs while getting the content.
Exceptions
UnknownServiceException if the protocol does not support the content type.
See Also
createContentHandler, getContentType, setContentHandlerFactory


 URLConnection.getContentEncoding

URLConnection.getContentEncoding

Syntax
public String getContentEncoding()
Returns
the content encoding of the resource that the URL references, or null if not known.
Description
Returns the value of the content-encoding header field.

See Also
getHeaderField


 URLConnection.getContentLength

URLConnection.getContentLength

Syntax
public int getContentLength()
Returns
the content length of the resource that this connection's URL references, or -1 if the content length is not known.
Description
Returns the value of the content-length header field.


 URLConnection.getContentType

URLConnection.getContentType

Syntax
public String getContentType()
Returns
the content type of the resource that the URL references, or null if not known.
Description
Returns the value of the content-type header field.

See Also
getHeaderField


 URLConnection.getDate

URLConnection.getDate

Syntax
public long getDate()
Returns
the sending date of the resource that the URL references, or 0 if not known. The value returned is the number of seconds since January 1, 1970 GMT.
Description
Returns the value of the date header field.

See Also
getHeaderField


 URLConnection.getDefaultAllowUserInteraction

URLConnection.getDefaultAllowUserInteraction

Syntax
public static boolean getDefaultAllowUserInteraction()
Returns
the default value of the allowUserInteraction field.
Description
Returns the default value of the allowUserInteraction field.

Ths default is "sticky", being a part of the static state of all URLConnections. This flag applies to the next, and all following URLConnections that are created.

See Also
allowUserInteraction


 URLConnection.getDefaultRequestProperty

URLConnection.getDefaultRequestProperty

Syntax
public static String getDefaultRequestProperty( String key )
Returns
the value of the default request property for the specified key.
Description
Returns the value of the default request property. Default request properties are set for every connection.

See Also
setDefaultRequestProperty


 URLConnection.getDefaultUseCaches

URLConnection.getDefaultUseCaches

Syntax
public boolean getDefaultUseCaches()
Returns
the default value of a URLConnection's useCaches flag.
Description
Returns the default value of a URLConnection's useCaches flag.

Ths default is "sticky", being a part of the static state of all URLConnections. This flag applies to the next, and all following URLConnections that are created.

See Also
useCaches


 URLConnection.getDoInput

URLConnection.getDoInput

Syntax
public boolean getDoInput()
Returns
the value of this URLConnection's doInput flag.
Description
Returns the value of this URLConnection's doInput flag.

See Also
doInput


 URLConnection.getDoOutput

URLConnection.getDoOutput

Syntax
public boolean getDoOutput()
Returns
the value of this URLConnection's doOutput flag.
Description
Returns the value of this URLConnection's doOutput flag.

See Also
doOutput


 URLConnection.getExpiration

URLConnection.getExpiration

Syntax
public long getExpiration()
Returns
the expiration date of the resource that this URL references, or 0 if not known. The value is the number of seconds since January 1, 1970 GMT.
Description
Returns the value of the expires header field.

See Also
getHeaderField


 URLConnection.getHeaderField

URLConnection.getHeaderField

Syntax
public String getHeaderField( String name )
Parameters
name
the name of a header field.
Returns
the value of the named header field, or null if there is no such field in the header.
Description
Returns the name of the specified header field.


 URLConnection.getHeaderField

URLConnection.getHeaderField

Syntax
public String getHeaderField( int n )
Parameters
n
an index.
Returns
the value of the nth header field.
Description
Returns the value for the nth header field. It returns null if there are fewer than n fields.

This method can be used in conjunction with the getHeaderFieldKey method to iterate through all the headers in the message.

See Also
getHeaderFieldKey


 URLConnection.getHeaderFieldDate

URLConnection.getHeaderFieldDate

Syntax
public long getHeaderFieldDate( String name, long Default )
Parameters
name
the name of the header field.
Default
a default value.
Returns
the value of the field, parsed as a date. The value of the Default argument is returned if the field is missing or malformed.
Description
Returns the value of the named field parsed as date. The result is the number of seconds since January 1, 1970 GMT represented by the named field.

This form of getHeaderField exists because some connection types (e.g., http-ng) have pre-parsed headers. Classes for that connection type can override this method and short-circuit the parsing.


 URLConnection.getHeaderFieldInt

URLConnection.getHeaderFieldInt

Syntax
public int getHeaderFieldInt( String name, int Default )
Parameters
name
the name of the header field.
Default
the default value.
Returns
the value of the named field, parsed as an integer. The Default value is returned if the field is missing or malformed.
Description
Returns the value of the named field parsed as a number.

This form of getHeaderField exists because some connection types (e.g., http-ng) have pre-parsed headers. Classes for that connection type can override this method and short-circuit the parsing.


 URLConnection.getHeaderFieldKey

URLConnection.getHeaderFieldKey

Syntax
public String getHeaderFieldKey( int n )
Parameters
n
an index.
Returns
the key for the nth header field, or null if there are fewer than n fields.
Description
Returns the key for the nth header field.


 URLConnection.getIfModifiedSince

URLConnection.getIfModifiedSince

Syntax
public long getIfModifiedSince()
Returns
the value of this object's ifModifiedSince field.
Description
Returns the value of this object's ifModifiedSince field.

See Also
ifModifiedSince


 URLConnection.getInputStream

URLConnection.getInputStream

Syntax
public InputStream getInputStream() throws IOException
Returns
an input stream that reads from this open connection.
Description
Returns an input stream that reads from this open connection.

Exceptions
IOException if an I/O error occurs while creating the input stream.
Exceptions
UnknownServiceException if the protocol does not support input.


 URLConnection.getLastModified

URLConnection.getLastModified

Syntax
public long getLastModified()
Returns
the date the resource referenced by this URLConnection was last modified, or 0 if not known.
Description
Returns the value of the last-modified header field. The result is the number of seconds since January 1, 1970 GMT.

See Also
getHeaderField


 URLConnection.getOutputStream

URLConnection.getOutputStream

Syntax
public OutputStream getOutputStream() throws IOException
Returns
an output stream that writes to this connection.
Description
Returns an output stream that writes to this connection.

Exceptions
IOException if an I/O error occurs while creating the output stream.
Exceptions
UnknownServiceException if the protocol does not support output.


 URLConnection.getRequestProperty

URLConnection.getRequestProperty

Syntax
public String getRequestProperty( String key )
Returns
the value of the named general request property for this connection.
Description
Returns the value of the named general request property for this connection.


 URLConnection.getURL

URLConnection.getURL

Syntax
public URL getURL()
Returns
the value of this URLConnection's URL field.
Description
Returns the value of this URLConnection's URL field.

See Also
url


 URLConnection.getUseCaches

URLConnection.getUseCaches

Syntax
public boolean getUseCaches()
Returns
the value of this URLConnection's useCaches field.
Description
Returns the value of this URLConnection's useCaches field.

See Also
useCaches


 URLConnection.guessContentTypeFromName

URLConnection.guessContentTypeFromName

Syntax
protected static String guessContentTypeFromName( String fname )
Parameters
fname
a filename.
Returns
a guess as to what the content type of the object is, based upon its file name.
Description
Tries to determine the content type of an object, based on the specified "file" component of a URL. This is a convenience method that can be used by subclasses that override the getContentType method.

See Also
getContentType


 URLConnection.guessContentTypeFromStream

URLConnection.guessContentTypeFromStream

Syntax
public static String guessContentTypeFromStream( InputStream is ) throws IOException
Parameters
is
an input stream that supports marks.
Returns
a guess at the content type, or null if none can be determined.
Description
Tries to determine the type of an input stream based on the characters at the beginning of the input stream. This method can be used by subclasses that override the getContentType method.

Ideally, this routine would not be needed. But many http servers return the incorrect content type; in addition, there are many nonstandard extensions. Direct inspection of the bytes to determine the content type is often more accurate than believing the content type claimed by the http server.

Exceptions
IOException if an I/O error occurs while reading the input stream.
See Also
mark, markSupported, getContentType


 URLConnection.setAllowUserInteraction

URLConnection.setAllowUserInteraction

Syntax
public void setAllowUserInteraction( boolean allowuserinteraction )
Parameters
allowuserinteraction
the new value.
Description
Set the value of the allowUserInteraction field of this URLConnection.

See Also
allowUserInteraction


 URLConnection.setContentHandlerFactory

URLConnection.setContentHandlerFactory

Syntax
public static synchronized void setContentHandlerFactory( ContentHandlerFactory fac )
Parameters
fac
the desired factory.
Description
Sets the ContentHandlerFactory of an application. It can be called at most once by an application.

The ContentHandlerFactory instance is used to construct a content handler from a content type

Exceptions
Error if the factory has already been defined.
See Also
ContentHandlerFactory, getContent


 URLConnection.setDefaultAllowUserInteraction

URLConnection.setDefaultAllowUserInteraction

Syntax
public static void setDefaultAllowUserInteraction( boolean defaultallowuserinteraction )
Parameters
defaultallowuserinteraction
the new value.
Description
Sets the default value of the allowUserInteraction field for all future URLConnection objects to the specified value.

See Also
allowUserInteraction


 URLConnection.setDefaultRequestProperty

URLConnection.setDefaultRequestProperty

Syntax
public static void setDefaultRequestProperty( String key, String value )
Parameters
key
the keyword by which the request is known (e.g., "accept").
value
the value associated with the key.
Description
Sets the default value of a general request property. When a URLConnection is created, it is initialized with these properties.


 URLConnection.setDefaultUseCaches

URLConnection.setDefaultUseCaches

Syntax
public void setDefaultUseCaches( boolean defaultusecaches )
Parameters
defaultusecaches
the new value.
Description
Sets the default value of the useCaches field to the specified value.

See Also
useCaches


 URLConnection.setDoInput

URLConnection.setDoInput

Syntax
public void setDoInput( boolean doinput )
Parameters
value
the new value.
Description
Sets the value of the doInput field for this URLConnection to the specified value.

A URL connection can be used for input and/or output. Set the DoInput flag to true if you intend to use the URL connection for input, false if not. The default is true unless DoOutput is explicitly set to true, in which case DoInput defaults to false.

See Also
doInput


 URLConnection.setDoOutput

URLConnection.setDoOutput

Syntax
public void setDoOutput( boolean dooutput )
Parameters
value
the new value.
Description
Sets the value of the doOutput field for this URLConnection to the specified value.

A URL connection can be used for input and/or output. Set the DoOutput flag to true if you intend to use the URL connection for output, false if not. The default is false.

See Also
doOutput


 URLConnection.setIfModifiedSince

URLConnection.setIfModifiedSince

Syntax
public void setIfModifiedSince( long ifmodifiedsince )
Parameters
value
the new value.
Description
Sets the value of the ifModifiedSince field of this URLConnection to the specified value.

See Also
ifModifiedSince


 URLConnection.setRequestProperty

URLConnection.setRequestProperty

Syntax
public void setRequestProperty( String key, String value )
Parameters
key
the keyword by which the request is known (e.g., "accept").
value
the value associated with it.
Description
Sets the general request property.


 URLConnection.setUseCaches

URLConnection.setUseCaches

Syntax
public void setUseCaches( boolean usecaches )
Description
Sets the value of the useCaches field of this URLConnection to the specified value.

Some protocols do caching of documents. Occasionally, it is important to be able to "tunnel through" and ignore the caches (e.g., the "reload" button in a browser). If the UseCaches flag on a connection is true, the connection is allowed to use whatever caches it can. If false, caches are to be ignored. The default value comes from DefaultUseCaches, which defaults to true.

See Also
useCaches


 URLConnection.toString

URLConnection.toString

Syntax
public String toString()
Returns
a string representation of this URLConnection.
Description
Returns a String representation of this URL connection.

Overrides
toString in class Object


 Class URLEncoder

Class java.net.URLEncoder

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.net.URLEncoder

public class URLEncoder
extends Object

The class contains a utility method for converting a String into a MIME format called "x-www-form-urlencoded" format.

To convert a String, each character is examined in turn:

  • The ASCII characters 'a' through 'z', 'A' through 'Z', and '0' through '9' remain the same.
  • The space character ' ' is converted into a plus sign '+'.
  • All other characters are converted into the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the lower 8-bits of the character.


 URLEncoder Members

URLEncoder Members

Class Overview | This Package | All Packages

Methods
Name | Description
encode(String) | Translates a string into x-www-form-urlencoded format.


 URLEncoder.encode

URLEncoder.encode

Syntax
public static String encode( String s )
Parameters
s
String to be translated.
Returns
the translated String.
Description
Translates a string into x-www-form-urlencoded format.


 Class URLStreamHandler

Class java.net.URLStreamHandler

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.net.URLStreamHandler

public abstract class URLStreamHandler
extends Object

The abstract class URLStreamHandler is the common superclass for all stream protocol handlers. A stream protocol handler knows how to make a connection for a particular protocol type, such as http, ftp, or gopher.

In most cases, an instance of a URLStreamHandler subclass is not created directly by an application. Rather, the first time a protocol name is encountered when constructing a URL, the appropriate stream protocol handler is automatically loaded.

See Also:
URL


 URLStreamHandler Members

URLStreamHandler Members

Class Overview | This Package | All Packages

Constructors
Name | Description
URLStreamHandler() |

Methods
Name | Description
openConnection(URL) | Opens a connection to the object referenced by the URL argument.
parseURL(URL, String, int, int) | Parses the string representation of a URL into a URL object.
setURL(URL, String, String, int, String, String) | Sets the fields of the URL argument to the indicated values.
toExternalForm(URL) | Converts a URL of a specific protocol to a String.


 URLStreamHandler.URLStreamHandler

URLStreamHandler.URLStreamHandler

Syntax
public URLStreamHandler()


 URLStreamHandler.openConnection

URLStreamHandler.openConnection

Syntax
protected abstract URLConnection openConnection( URL u ) throws IOException
Parameters
u
the URL that this connects to.
Returns
a URLConnection object for the URL.
Description
Opens a connection to the object referenced by the URL argument. This method should be overridden by a subclass.

Exceptions
IOException if an I/O error occurs while opening the connection.


 URLStreamHandler.parseURL

URLStreamHandler.parseURL

Syntax
protected void parseURL( URL u, String spec, int start, int limit )
Parameters
u
the URL to receive the result of parsing the spec.
spec
the String representing the URL that must be parsed.
start
the character index at which to begin parsing. This is just past the ':' (if there is one) that specifies the determination of the protocol name.
limit
the character position to stop parsing at. This is the end of the string or the position of the "#" character, if present. All information after the sharp sign indicates an anchor.
Description
Parses the string representation of a URL into a URL object.

If there is any inherited context, then it has already been copied into the URL argument.

The parseURL method of URLStreamHandler parses the string representation as if it were an http specification. Most URL protocol families have a similar parsing. A stream protocol handler for a protocol that has a different syntax must override this routine.


 URLStreamHandler.setURL

URLStreamHandler.setURL

Syntax
protected void setURL( URL u, String protocol, String host, int port, String file, String ref )
Parameters
u
the URL to modify.
protocol
the protocol name.
host
the remote host value for the URL.
port
the port on the remote machine.
file
the file.
ref
the reference.
Description
Sets the fields of the URL argument to the indicated values. Only classes derived from URLStreamHandler are supposed to be able to call the set method on a URL.

See Also
set


 URLStreamHandler.toExternalForm

URLStreamHandler.toExternalForm

Syntax
protected String toExternalForm( URL u )
Parameters
u
the URL.
Returns
a string representation of the URL argument.
Description
Converts a URL of a specific protocol to a String.


 Interface URLStreamHandlerFactory

Interface java.net.URLStreamHandlerFactory

Interface Members | This Package | All Packages

public interface URLStreamHandlerFactory

This interface defines a factory for URL stream protocol handlers.

It is used by the URL class to create a URLStreamHandler for a specific protocol.

See Also:
URL, URLStreamHandler


 URLStreamHandlerFactory Members

URLStreamHandlerFactory Members

Interface Overview | This Package | All Packages

Methods
Name | Description
createURLStreamHandler(String) | Creates a new URLStreamHandler instance with the specified protocol.


 URLStreamHandlerFactory.createURLStreamHandler

URLStreamHandlerFactory.createURLStreamHandler

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract URLStreamHandler createURLStreamHandler( String protocol )
Parameters
protocol
the protocol ("ftp", "http", "nntp", etc.).
Returns
a URLStreamHandler for the specific protocol.
Description
Creates a new URLStreamHandler instance with the specified protocol.

See Also
URLStreamHandler


 Class UnknownHostException

Class java.net.UnknownHostException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.net.UnknownHostException

public class UnknownHostException
extends IOException

Thrown to indicate that the IP address of a host could not be determined.


 UnknownHostException Members

UnknownHostException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
UnknownHostException() | Constructs a new UnknownHostException with no detail message.
UnknownHostException(String) | Constructs a new UnknownHostException with the specified detail message.


 UnknownHostException.UnknownHostException

UnknownHostException.UnknownHostException

Syntax 1
public UnknownHostException( String host )
Parameters
host
the detail message.
Description
Constructs a new UnknownHostException with the specified detail message.

Syntax 2
public UnknownHostException()
Description
Constructs a new UnknownHostException with no detail message.


 Class UnknownServiceException

Class java.net.UnknownServiceException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.net.UnknownServiceException

public class UnknownServiceException
extends IOException

Thrown to indicate that an unknown service exception has occurred. Either the MIME type returned by a URL connection does not make sense, or the application is attempting to write to a read-only URL connection.


 UnknownServiceException Members

UnknownServiceException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
UnknownServiceException() | Constructs a new UnknownServiceException with no detail message.
UnknownServiceException(String) | Constructs a new UnknownServiceException with the specified detail message.


 UnknownServiceException.UnknownServiceException

UnknownServiceException.UnknownServiceException

Syntax 1
public UnknownServiceException()
Description
Constructs a new UnknownServiceException with no detail message.

Syntax 2
public UnknownServiceException( String msg )
Parameters
msg
the detail message.
Description
Constructs a new UnknownServiceException with the specified detail message.


 Package java.security

Package java.security

All Packages

Interfaces

  • Certificate
  • Key
  • Principal
  • PrivateKey
  • PublicKey

    • Classes

  • DigestInputStream
  • DigestOutputStream
  • Identity
  • IdentityScope
  • KeyPair
  • KeyPairGenerator
  • MessageDigest
  • Provider
  • SecureRandom
  • Security
  • Signature
  • Signer

    • Exceptions

  • DigestException
  • InvalidKeyException
  • InvalidParameterException
  • KeyException
  • KeyManagementException
  • NoSuchAlgorithmException
  • NoSuchProviderException
  • ProviderException
  • SignatureException


 Interface Certificate

Interface java.security.Certificate

Interface Members | This Package | All Packages

public interface Certificate

This is an interface of abstract methods for managing an identity certificate. An identity certificate is a guarantee by a principal that a public key is that of another principal. (A principal represents an entity such as an individual user or a group.)

In particular, this interface is intended to be a common abstraction for constructs that have different formats but important common uses. For example, different types of certificates, such as X.509 certificates and PGP certificates, share general certificate functionality (the need to encode and decode certificates) and some types of information, such as a public key, the principal whose key it is, and the guarantor guaranteeing that the public key is that of the specified principal. So an implementation of X.509 certificates and an implementation of PGP certificates can both utilize the Certificate interface, even though their formats and additional types and amounts of information stored are different.

Important: This interface is useful for cataloging and grouping objects sharing certain common uses. It does not have any semantics of its own. In particular, a Certificate object does not make any statement as to the validity of the binding. It is the duty of the application implementing this interface to verify the certificate and satisfy itself of its validity.


 Certificate Members

Certificate Members

Interface Overview | This Package | All Packages

Methods
Name | Description
decode(InputStream) | Decodes a certificate from an input stream.
encode(OutputStream) | Encodes the certificate to an output stream in a format that can be decoded by the decode method.
getFormat() | Returns the name of the coding format.
getGuarantor() | Returns the guarantor of the certificate, that is, the principal guaranteeing that the public key associated with this certificate is that of the principal associated with this certificate.
getPrincipal() | Returns the principal of the principal-key pair being guaranteed by the guarantor.
getPublicKey() | Returns the key of the principal-key pair being guaranteed by the guarantor.
toString(boolean) | Returns a string that represents the contents of the certificate.


 Certificate.decode

Certificate.decode

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void decode( InputStream stream ) throws KeyException, IOException
Parameters
stream
the input stream from which to fetch the data being decoded.
Description
Decodes a certificate from an input stream. The format should be that returned by getFormat and produced by encode.

Exceptions
KeyException if the certificate is not properly initialized, or data is missing, etc.
Exceptions
IOException if an exception occurs while trying to input the encoded certificate from the input stream.
See Also
encode, getFormat


 Certificate.encode

Certificate.encode

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void encode( OutputStream stream ) throws KeyException, IOException
Parameters
stream
the output stream to which to encode the certificate.
Description
Encodes the certificate to an output stream in a format that can be decoded by the decode method.

Exceptions
KeyException if the certificate is not properly initialized, or data is missing, etc.
Exceptions
IOException if a stream exception occurs while trying to output the encoded certificate to the output stream.
See Also
decode, getFormat


 Certificate.getFormat

Certificate.getFormat

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getFormat()
Returns
the name of the coding format.
Description
Returns the name of the coding format. This is used as a hint to find an appropriate parser. It could be "X.509", "PGP", etc. This is the format produced and understood by the encode and decode methods.


 Certificate.getGuarantor

Certificate.getGuarantor

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Principal getGuarantor()
Returns
the guarantor which guaranteed the principal-key binding.
Description
Returns the guarantor of the certificate, that is, the principal guaranteeing that the public key associated with this certificate is that of the principal associated with this certificate. For X.509 certificates, the guarantor will typically be a Certificate Authority (such as the United States Postal Service or Verisign, Inc.).


 Certificate.getPrincipal

Certificate.getPrincipal

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Principal getPrincipal()
Returns
the principal to which this certificate is bound.
Description
Returns the principal of the principal-key pair being guaranteed by the guarantor.


 Certificate.getPublicKey

Certificate.getPublicKey

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract PublicKey getPublicKey()
Returns
the public key that this certificate certifies belongs to a particular principal.
Description
Returns the key of the principal-key pair being guaranteed by the guarantor.


 Certificate.toString

Certificate.toString

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String toString( boolean detailed )
Parameters
detailed
whether or not to give detailed information about the certificate.
Description
Returns a string that represents the contents of the certificate.


 Class DigestException

Class java.security.DigestException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.security.DigestException

public class DigestException
extends Exception

This is the generic Message Digest exception.


 DigestException Members

DigestException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
DigestException() | Constructs a DigestException with no detail message.
DigestException(String) | Constructs a DigestException with the specified detail message.


 DigestException.DigestException

DigestException.DigestException

Syntax 1
public DigestException()
Description
Constructs a DigestException with no detail message. (A detail message is a String that describes this particular exception.)

Syntax 2
public DigestException( String msg )
Parameters
msg
the detail message.
Description
Constructs a DigestException with the specified detail message. (A detail message is a String that describes this particular exception.)


 Class DigestInputStream

Class java.security.DigestInputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.FilterInputStream
                   |
                   +----java.security.DigestInputStream

public class DigestInputStream
extends FilterInputStream

A transparent stream that updates the associated message digest using the bits going through the stream.

To complete the message digest computation, call one of the digest methods on the associated message digest after your calls to one of this digest input stream's read methods.

It is possible to turn this stream on or off (see on). When it is on, a call to read results in an update on the message digest. But when it is off, the message digest is not updated. The default is for the stream to be on.

Note that digest objects can compute only one digest (see MessageDigest), so that in order to compute intermediate digests, a caller should retain a handle onto the digest object, and clone it for each digest to be computed, leaving the orginal digest untouched.

See Also:
MessageDigest, DigestOutputStream


 DigestInputStream Members

DigestInputStream Members

Class Overview | This Package | All Packages

Fields
Name | Description
digest | The message digest associated with this stream.

Constructors
Name | Description
DigestInputStream(InputStream, MessageDigest) | Creates a digest input stream, using the specified input stream and message digest.

Methods
Name | Description
getMessageDigest() | Returns the message digest associated with this stream.
on(boolean) | Turns the digest function on or off.
read() | Reads a byte, and updates the message digest (if the digest function is on).
read(byte[], int, int) | Reads into a byte array, and updates the message digest (if the digest function is on).
setMessageDigest(MessageDigest) | Associates the specified message digest with this stream.
toString() | Prints a string representation of this digest input stream and its associated message digest object.


 DigestInputStream.digest

DigestInputStream.digest

Syntax
protected MessageDigest digest
Description
The message digest associated with this stream.


 DigestInputStream.DigestInputStream

DigestInputStream.DigestInputStream

Syntax
public DigestInputStream( InputStream stream, MessageDigest digest )
Parameters
stream
the input stream.
digest
the message digest to associate with this stream.
Description
Creates a digest input stream, using the specified input stream and message digest.


 DigestInputStream.getMessageDigest

DigestInputStream.getMessageDigest

Syntax
public MessageDigest getMessageDigest()
Returns
the message digest associated with this stream.
Description
Returns the message digest associated with this stream.


 DigestInputStream.on

DigestInputStream.on

Syntax
public void on( boolean on )
Parameters
on
true to turn the digest function on, false to turn it off.
Description
Turns the digest function on or off. The default is on. When it is on, a call to read results in an update on the message digest. But when it is off, the message digest is not updated.


 DigestInputStream.read

DigestInputStream.read

Syntax 1
public int read() throws IOException
Returns
the byte read.
Description
Reads a byte, and updates the message digest (if the digest function is on). That is, this method reads a byte from the input stream, blocking until the byte is actually read. If the digest function is on (see on), this method will then call update on the message digest associated with this stream, passing it the byte read.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class FilterInputStream
See Also
update

Syntax 2
public int read( byte b[], int off, int len ) throws IOException
Parameters
b
the array into which the data is read.
off
the starting offset into b of where the data should be placed.
len
the maximum number of bytes to be read from the input stream into b, starting at offset off.
Returns
the actual number of bytes read. This is less than len if the end of the stream is reached prior to reading len bytes. -1 is returned if no bytes were read because the end of the stream had already been reached when the call was made.
Description
Reads into a byte array, and updates the message digest (if the digest function is on). That is, this method reads up to len bytes from the input stream into the array b, starting at offset off. This method blocks until the data is actually read. If the digest function is on (see on), this method will then call update on the message digest associated with this stream, passing it the data.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class FilterInputStream
See Also
update


 DigestInputStream.setMessageDigest

DigestInputStream.setMessageDigest

Syntax
public void setMessageDigest( MessageDigest digest )
Parameters
digest
the message digest to be associated with this stream.
Description
Associates the specified message digest with this stream.


 DigestInputStream.toString

DigestInputStream.toString

Syntax
public String toString()
Description
Prints a string representation of this digest input stream and its associated message digest object.

Overrides
toString in class Object


 Class DigestOutputStream

Class java.security.DigestOutputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----java.io.FilterOutputStream
                   |
                   +----java.security.DigestOutputStream

public class DigestOutputStream
extends FilterOutputStream

A transparent stream that updates the associated message digest using the bits going through the stream.

To complete the message digest computation, call one of the digest methods on the associated message digest after your calls to one of this digest ouput stream's write methods.

It is possible to turn this stream on or off (see on). When it is on, a call to write results in an update on the message digest. But when it is off, the message digest is not updated. The default is for the stream to be on.

See Also:
MessageDigest, DigestInputStream


 DigestOutputStream Members

DigestOutputStream Members

Class Overview | This Package | All Packages

Fields
Name | Description
digest | The message digest associated with this stream.

Constructors
Name | Description
DigestOutputStream(OutputStream, MessageDigest) | Creates a digest output stream, using the specified output stream and message digest.

Methods
Name | Description
getMessageDigest() | Returns the message digest associated with this stream.
on(boolean) | Turns the digest function on or off.
setMessageDigest(MessageDigest) | Associates the specified message digest with this stream.
toString() | Prints a string representation of this digest output stream and its associated message digest object.
write(byte[], int, int) | Updates the message digest (if the digest function is on) using the specified subarray, and in any case writes the subarray to the output stream.
write(int) | Updates the message digest (if the digest function is on) using the specified byte, and in any case writes the byte to the output stream.


 DigestOutputStream.digest

DigestOutputStream.digest

Syntax
protected MessageDigest digest
Description
The message digest associated with this stream.


 DigestOutputStream.DigestOutputStream

DigestOutputStream.DigestOutputStream

Syntax
public DigestOutputStream( OutputStream stream, MessageDigest digest )
Parameters
stream
the output stream.
digest
the message digest to associate with this stream.
Description
Creates a digest output stream, using the specified output stream and message digest.


 DigestOutputStream.getMessageDigest

DigestOutputStream.getMessageDigest

Syntax
public MessageDigest getMessageDigest()
Returns
the message digest associated with this stream.
Description
Returns the message digest associated with this stream.


 DigestOutputStream.on

DigestOutputStream.on

Syntax
public void on( boolean on )
Parameters
on
true to turn the digest function on, false to turn it off.
Description
Turns the digest function on or off. The default is on. When it is on, a call to write results in an update on the message digest. But when it is off, the message digest is not updated.


 DigestOutputStream.setMessageDigest

DigestOutputStream.setMessageDigest

Syntax
public void setMessageDigest( MessageDigest digest )
Parameters
digest
the message digest to be associated with this stream.
Description
Associates the specified message digest with this stream.


 DigestOutputStream.toString

DigestOutputStream.toString

Syntax
public String toString()
Description
Prints a string representation of this digest output stream and its associated message digest object.

Overrides
toString in class Object


 DigestOutputStream.write

DigestOutputStream.write

Syntax 1
public void write( int b ) throws IOException
Parameters
b
the byte to be used for updating and writing to the output stream.
Description
Updates the message digest (if the digest function is on) using the specified byte, and in any case writes the byte to the output stream. That is, if the digest function is on (see on), this method calls update on the message digest associated with this stream, passing it the byte b. This method then writes the byte to the output stream, blocking until the byte is actually written.

Exceptions
IOException if an I/O error occurs.
Overrides
write in class FilterOutputStream
See Also
update

Syntax 2
public void write( byte b[], int off, int len ) throws IOException
Parameters
b
the array containing the subarray to be used for updating and writing to the output stream.
off
the offset into b of the first byte to be updated and written.
len
the number of bytes of data to be updated and written from b, starting at offset off.
Description
Updates the message digest (if the digest function is on) using the specified subarray, and in any case writes the subarray to the output stream. That is, if the digest function is on (see on), this method calls update on the message digest associated with this stream, passing it the subarray specifications. This method then writes the subarray bytes to the output stream, blocking until the bytes are actually written.

Exceptions
IOException if an I/O error occurs.
Overrides
write in class FilterOutputStream
See Also
update


 Class Identity

Class java.security.Identity

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.security.Identity

public abstract class Identity
extends Object
implements Principal, Serializable

This class represents identities: real-world objects such as people, companies or organizations whose identities can be authenticated using their public keys. Identities may also be more abstract (or concrete) constructs, such as daemon threads or smart cards.

All Identity objects have a name and a public key. Names are immutable. Identities may also be scoped. That is, if an Identity is specified to have a particular scope, then the name and public key of the Identity are unique within that scope.

An Identity also has a set of certificates (all certifying its own public key). The Principal names specified in these certificates need not be the same, only the key.

An Identity can be subclassed, to include postal and email addresses, telephone numbers, images of faces and logos, and so on.

See Also:
IdentityScope, Signer, Principal


 Identity Members

Identity Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Identity() | Constructor for serialization only.
Identity(String) | Constructs an identity with the specified name and no scope.
Identity(String, IdentityScope) | Constructs an identity with the specified name and scope.

Methods
Name | Description
addCertificate(Certificate) | Adds a certificate for this identity.
certificates() | Returns a copy of all the certificates for this identity.
equals(Object) | Tests for equality between the specified object and this identity.
getInfo() | Returns general information previously specified for this identity.
getName() | Returns this identity's name.
getPublicKey() | Returns this identity's public key.
getScope() | Returns this identity's scope.
hashCode() | Returns a hashcode for this identity.
identityEquals(Identity) | Tests for equality between the specified identity and this identity.
removeCertificate(Certificate) | Removes a certificate from this identity.
setInfo(String) | Specifies a general information string for this identity.
setPublicKey(PublicKey) | Sets this identity's public key.
toString() | Returns a short string describing this identity, telling its name and its scope (if any).
toString(boolean) | Returns a string representation of this identity, with optionally more details than that provided by the toString method without any arguments.


 Identity.Identity

Identity.Identity

Syntax 1
protected Identity()
Description
Constructor for serialization only.

Syntax 2
public Identity( String name, IdentityScope scope ) throws KeyManagementException
Parameters
name
the identity name.
scope
the scope of the identity.
Description
Constructs an identity with the specified name and scope.

Exceptions
KeyManagementException if there is already an identity with the same name in the scope.

Syntax 3
public Identity( String name )
Parameters
name
the identity name.
Description
Constructs an identity with the specified name and no scope.


 Identity.addCertificate

Identity.addCertificate

Syntax
public void addCertificate( Certificate certificate ) throws KeyManagementException
Parameters
certificate
the certificate to be added.
Description
Adds a certificate for this identity. If the identity has a public key, the public key in the certificate must be the same, and if the identity does not have a public key, the identity's public key is set to be that specified in the certificate.

Exceptions
KeyManagementException if the certificate is not valid, if the public key in the certificate being added conflicts with this identity's public key, or if another exception occurs.


 Identity.certificates

Identity.certificates

Syntax
public Certificate[] certificates()
Returns
a copy of all the certificates for this identity.
Description
Returns a copy of all the certificates for this identity.


 Identity.equals

Identity.equals

Syntax
public final boolean equals( Object identity )
Parameters
identity
the object to test for equality with this identity.
Returns
true if the objects are considered equal, false otherwise.
Description
Tests for equality between the specified object and this identity. This first tests to see if the entities actually refer to the same object, in which case it returns true. Next, it checks to see if the entities have the same name and the same scope. If they do, the method returns true. Otherwise, it calls identityEquals, which subclasses should override.

Overrides
equals in class Object
See Also
identityEquals


 Identity.getInfo

Identity.getInfo

Syntax
public String getInfo()
Returns
general information about this identity.
Description
Returns general information previously specified for this identity.

See Also
setInfo


 Identity.getName

Identity.getName

Syntax
public final String getName()
Returns
the name of this identity.
Description
Returns this identity's name.


 Identity.getPublicKey

Identity.getPublicKey

Syntax
public PublicKey getPublicKey()
Returns
the public key for this identity.
Description
Returns this identity's public key.


 Identity.getScope

Identity.getScope

Syntax
public final IdentityScope getScope()
Returns
the scope of this identity.
Description
Returns this identity's scope.


 Identity.hashCode

Identity.hashCode

Syntax
public int hashCode()
Returns
a hashcode for this identity.
Description
Returns a hashcode for this identity.

Overrides
hashCode in class Object


 Identity.identityEquals

Identity.identityEquals

Syntax
protected boolean identityEquals( Identity identity )
Parameters
identity
the identity to test for equality with this identity.
Returns
true if the identities are considered equal, false otherwise.
Description
Tests for equality between the specified identity and this identity. This method should be overriden by subclasses to test for equality. The default behavior is to return true if the names and public keys are equal.

See Also
equals


 Identity.removeCertificate

Identity.removeCertificate

Syntax
public void removeCertificate( Certificate certificate ) throws KeyManagementException
Parameters
certificate
the certificate to be removed.
Description
Removes a certificate from this identity.

Exceptions
KeyManagementException if the certificate is missing, or if another exception occurs.


 Identity.setInfo

Identity.setInfo

Syntax
public void setInfo( String info )
Parameters
info
the information string.
Description
Specifies a general information string for this identity.

See Also
getInfo


 Identity.setPublicKey

Identity.setPublicKey

Syntax
public void setPublicKey( PublicKey key ) throws KeyManagementException
Parameters
key
the public key for this identity.
Description
Sets this identity's public key. The old key and all of this identity's certificates are removed by this operation.

Exceptions
KeyManagementException if another identity in the identity's scope has the same public key, or if another exception occurs.


 Identity.toString

Identity.toString

Syntax 1
public String toString()
Returns
information about this identity, such as its name and the name of its scope (if any).
Description
Returns a short string describing this identity, telling its name and its scope (if any).

Overrides
toString in class Object

Syntax 2
public String toString( boolean detailed )
Parameters
detailed
whether or not to provide detailed information.
Returns
information about this identity. If detailed is true, then this method returns more information than that provided by the toString method without any arguments.
Description
Returns a string representation of this identity, with optionally more details than that provided by the toString method without any arguments.

See Also
toString


 Class IdentityScope

Class java.security.IdentityScope

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.security.Identity
           |
           +----java.security.IdentityScope

public abstract class IdentityScope
extends Identity

This class represents a scope for identities. It is an Identity itself, and therefore has a name and can have a scope. It can also optionally have a public key and associated certificates.

An IdentityScope can contain Identity objects of all kinds, including Signers. All types of Identity objects can be retrieved, added, and removed using the same methods. Note that it is possible, and in fact expected, that different types of identity scopes will apply different policies for their various operations on the various types of Identities.

There is a one-to-one mapping between keys and identities, and there can only be one copy of one key per scope. For example, suppose Acme Software, Inc is a software publisher known to a user. Suppose it is an Identity, that is, it has a public key, and a set of associated certificates. It is named in the scope using the name "Acme Software". No other named Identity in the scope has the same public key. Of course, none has the same name as well.

See Also:
Identity, Signer, Principal, Key


 IdentityScope Members

IdentityScope Members

Class Overview | This Package | All Packages

Constructors
Name | Description
IdentityScope() | This constructor is used for serialization only and should not be used by subclasses.
IdentityScope(String) | Constructs a new identity scope with the specified name.
IdentityScope(String, IdentityScope) | Constructs a new identity scope with the specified name and scope.

Methods
Name | Description
addIdentity(Identity) | Adds an identity to this identity scope.
getIdentity(Principal) | Retrieves the identity whose name is the same as that of the specified principal.
getIdentity(PublicKey) | Retrieves the identity with the specified public key.
getIdentity(String) | Returns the identity in this scope with the specified name (if any).
getSystemScope() | Returns the system's identity scope.
identities() | Returns an enumeration of all identities in this identity scope.
removeIdentity(Identity) | Removes an identity from this identity scope.
setSystemScope(IdentityScope) | Sets the system's identity scope.
size() | Returns the number of identities within this identity scope.
toString() | Returns a string representation of this identity scope, including its name, its scope name, and the number of identities in this identity scope.


 IdentityScope.IdentityScope

IdentityScope.IdentityScope

Syntax 1
protected IdentityScope()
Description
This constructor is used for serialization only and should not be used by subclasses.

Syntax 2
public IdentityScope( String name )
Parameters
name
the scope name.
Description
Constructs a new identity scope with the specified name.

Syntax 3
public IdentityScope( String name, IdentityScope scope ) throws KeyManagementException
Parameters
name
the scope name.
scope
the scope for the new identity scope.
Description
Constructs a new identity scope with the specified name and scope.

Exceptions
KeyManagementException if there is already an identity with the same name in the scope.


 IdentityScope.addIdentity

IdentityScope.addIdentity

Syntax
public abstract void addIdentity( Identity identity ) throws KeyManagementException
Parameters
identity
the identity to be added.
Description
Adds an identity to this identity scope.

Exceptions
KeyManagementException if the identity is not valid, a name conflict occurs, another identity has the same public key as the identity being added, or another exception occurs.


 IdentityScope.getIdentity

IdentityScope.getIdentity

Syntax 1
public abstract Identity getIdentity( String name )
Parameters
name
the name of the identity to be retrieved.
Returns
the identity named name, or null if there are no identities named name in this scope.
Description
Returns the identity in this scope with the specified name (if any).

Syntax 2
public Identity getIdentity( Principal principal )
Parameters
principal
the principal corresponding to the identity to be retrieved.
Returns
the identity whose name is the same as that of the principal, or null if there are no identities of the same name in this scope.
Description
Retrieves the identity whose name is the same as that of the specified principal. (Note: Identity implements Principal.)

Syntax 3
public abstract Identity getIdentity( PublicKey key )
Parameters
key
the public key for the identity to be returned.
Returns
the identity with the given key, or null if there are no identities in this scope with that key.
Description
Retrieves the identity with the specified public key.


 IdentityScope.getSystemScope

IdentityScope.getSystemScope

Syntax
public static IdentityScope getSystemScope()
Returns
the system's identity scope.
Description
Returns the system's identity scope. See the "System Identity Scope" section in the Java Cryptography Architecture API Specification & Reference.


 IdentityScope.identities

IdentityScope.identities

Syntax
public abstract Enumeration identities()
Returns
an enumeration of all identities in this identity scope.
Description
Returns an enumeration of all identities in this identity scope.


 IdentityScope.removeIdentity

IdentityScope.removeIdentity

Syntax
public abstract void removeIdentity( Identity identity ) throws KeyManagementException
Parameters
identity
the identity to be removed.
Description
Removes an identity from this identity scope.

Exceptions
KeyManagementException if the identity is missing, or another exception occurs.


 IdentityScope.setSystemScope

IdentityScope.setSystemScope

Syntax
protected static void setSystemScope( IdentityScope scope )
Parameters
scope
the scope to set.
Description
Sets the system's identity scope. See the "System Identity Scope" section in the Java Cryptography Architecture API Specification & Reference.


 IdentityScope.size

IdentityScope.size

Syntax
public abstract int size()
Returns
the number of identities within this identity scope.
Description
Returns the number of identities within this identity scope.


 IdentityScope.toString

IdentityScope.toString

Syntax
public String toString()
Returns
a string representation of this identity scope.
Description
Returns a string representation of this identity scope, including its name, its scope name, and the number of identities in this identity scope.

Overrides
toString in class Identity


 Class InvalidKeyException

Class java.security.InvalidKeyException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.security.KeyException
                           |
                           +----java.security.InvalidKeyException

public class InvalidKeyException
extends KeyException

This is the exception for invalid Keys (invalid encoding, wrong length, uninitialized, etc).


 InvalidKeyException Members

InvalidKeyException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
InvalidKeyException() | Constructs an InvalidKeyException with no detail message.
InvalidKeyException(String) | Constructs an InvalidKeyException with the specified detail message.


 InvalidKeyException.InvalidKeyException

InvalidKeyException.InvalidKeyException

Syntax 1
public InvalidKeyException()
Description
Constructs an InvalidKeyException with no detail message. A detail message is a String that describes this particular exception.

Syntax 2
public InvalidKeyException( String msg )
Parameters
msg
the detail message.
Description
Constructs an InvalidKeyException with the specified detail message. A detail message is a String that describes this particular exception.


 Class InvalidParameterException

Class java.security.InvalidParameterException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.lang.IllegalArgumentException
                                   |
                                   +----java.security.InvalidParameterException

public class InvalidParameterException
extends IllegalArgumentException

This exception is thrown when an invalid parameter is passed to a method.


 InvalidParameterException Members

InvalidParameterException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
InvalidParameterException() | Constructs an InvalidParameterException with no detail message.
InvalidParameterException(String) | Constructs an InvalidParameterException with the specified detail message.


 InvalidParameterException.InvalidParameterException

InvalidParameterException.InvalidParameterException

Syntax 1
public InvalidParameterException()
Description
Constructs an InvalidParameterException with no detail message. A detail message is a String that describes this particular exception.

Syntax 2
public InvalidParameterException( String msg )
Parameters
msg
the detail message.
Description
Constructs an InvalidParameterException with the specified detail message. A detail message is a String that describes this particular exception.


 Interface Key

Interface java.security.Key

Interface Members | This Package | All Packages

public interface Key
extends Serializable

The Key interface is the top-level interface for all keys. It defines the functionality shared by all key objects. All keys have three characteristics:

  • An Algorithm

    This is the key algorithm for that key. The key algorithm is usually an encryption or asymmetric operation algorithm (such as DSA or RSA), which will work with those algorithms and with related algorithms (such as MD5 with RSA, SHA-1 with RSA, Raw DSA, etc.) The name of the algorithm of a key is obtained using the getAlgorithm method.

  • An Encoded Form

    This is an external encoded form for the key used when a standard representation of the key is needed outside the Java Virtual Machine, as when transmitting the key to some other party. The key is encoded according to a standard format (such as X.509 or PKCS#8), and is returned using the getEncoded method.

  • A Format

    This is the name of the format of the encoded key. It is returned by the getFormat method.

Keys are generally obtained through key generators, certificates, or various Identity classes used to manage keys. There are no provisions in this release for the parsing of encoded keys and certificates.

See Also:
PublicKey, PrivateKey, KeyPair, KeyPairGenerator, Identity, IdentityScope, Signer


 Key Members

Key Members

Interface Overview | This Package | All Packages

Methods
Name | Description
getAlgorithm() | Returns the standard algorithm name this key is for.
getEncoded() | Returns the encoded key.
getFormat() | Returns the format used to encode the key or null if the key does not support encoding.


 Key.getAlgorithm

Key.getAlgorithm

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getAlgorithm()
Returns
the name of the algorithm this key is for, or null if the algorithm this key is for is unknown.
Description
Returns the standard algorithm name this key is for. For example, "DSA" would indicate that this key is a DSA key. Note that this method may return null, when the algorithm this key is for is unknown.

See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard algorithm names.


 Key.getEncoded

Key.getEncoded

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract byte[] getEncoded()
Returns
the encoded key, or null if the key does not support encoding.
Description
Returns the encoded key.


 Key.getFormat

Key.getFormat

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getFormat()
Returns
the format used to encode the key.
Description
Returns the format used to encode the key or null if the key does not support encoding.


 Class KeyException

Class java.security.KeyException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.security.KeyException

public class KeyException
extends Exception

This is the basic key exception.

See Also:
Key, InvalidKeyException, KeyManagementException


 KeyException Members

KeyException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
KeyException() | Constructs a KeyException with no detail message.
KeyException(String) | Constructs a KeyException with the specified detail message.


 KeyException.KeyException

KeyException.KeyException

Syntax 1
public KeyException()
Description
Constructs a KeyException with no detail message. A detail message is a String that describes this particular exception.

Syntax 2
public KeyException( String msg )
Parameters
msg
the detail message.
Description
Constructs a KeyException with the specified detail message. A detail message is a String that describes this particular exception.


 Class KeyManagementException

Class java.security.KeyManagementException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.security.KeyException
                           |
                           +----java.security.KeyManagementException

public class KeyManagementException
extends KeyException

This is the general key management exception, for all operations dealing with key management. Subclasses could include:

  • KeyIDConflict
  • KeyAuthorizationFailureException
  • ExpiredKeyException

See Also:
Key, KeyException


 KeyManagementException Members

KeyManagementException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
KeyManagementException() | Constructs a KeyManagementException with no detail message.
KeyManagementException(String) | Constructs a KeyManagementException with the specified detail message.


 KeyManagementException.KeyManagementException

KeyManagementException.KeyManagementException

Syntax 1
public KeyManagementException()
Description
Constructs a KeyManagementException with no detail message. A detail message is a String that describes this particular exception.

Syntax 2
public KeyManagementException( String msg )
Parameters
msg
the detail message.
Description
Constructs a KeyManagementException with the specified detail message. A detail message is a String that describes this particular exception.


 Class KeyPair

Class java.security.KeyPair

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.security.KeyPair

public final class KeyPair
extends Object

This class is a simple holder for a key pair (a public key and a private key). It does not enforce any security, and, when initialized, should be treated like a PrivateKey.

See Also:
PublicKey, PrivateKey


 KeyPair Members

KeyPair Members

Class Overview | This Package | All Packages

Constructors
Name | Description
KeyPair(PublicKey, PrivateKey) | Constructs a key with the specified public key and private key.

Methods
Name | Description
getPrivate() | Returns the private key from this key pair.
getPublic() | Returns the public key from this key pair.


 KeyPair.KeyPair

KeyPair.KeyPair

Syntax
public KeyPair( PublicKey publicKey, PrivateKey privateKey )
Parameters
publicKey
the public key.
privateKey
the private key.
Description
Constructs a key with the specified public key and private key.


 KeyPair.getPrivate

KeyPair.getPrivate

Syntax
public PrivateKey getPrivate()
Returns
the private key.
Description
Returns the private key from this key pair.


 KeyPair.getPublic

KeyPair.getPublic

Syntax
public PublicKey getPublic()
Returns
the public key.
Description
Returns the public key from this key pair.


 Class KeyPairGenerator

Class java.security.KeyPairGenerator

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.security.KeyPairGenerator

public abstract class KeyPairGenerator
extends Object

The KeyPairGenerator class is used to generate pairs of public and private keys. Key generators are constructed using the getInstance factory methods (static methods that return instances of a given class).

Key generation is an area that sometimes does not lend itself well to algorithm independence. For example, it is possible to generate a DSA key pair specifying key family parameters (p, q and g), while it is not possible to do so for an RSA key pair. That is, those parameters are applicable to DSA but not to RSA.

There are therefore two ways to generate a key pair: in an algorithm-independent manner, and in an algorithm-specific manner. The only difference between the two is the initialization of the object.

All key pair generators share the concepts of a "strength" and a source of randomness. The measure of strength is universally shared by all algorithms, though it is interpreted differently for different algorithms. The initialize method in this KeyPairGenerator class takes these two universally shared types of arguments.

Since no other parameters are specified when you call this algorithm-independent initialize method, all other values, such as algorithm parameters, public exponent, etc., are defaulted to standard values.

It is sometimes desirable to initialize a key pair generator object using algorithm-specific semantics. For example, you may want to initialize a DSA key generator for a given set of parameters p, q and g, or an RSA key generator for a given public exponent.

This is done through algorithm-specific standard interfaces. Rather than calling the algorithm-independent KeyPairGenerator initialize method, the key pair generator is cast to an algorithm-specific interface so that one of its specialized parameter initialization methods can be called. An example is the DSAKeyPairGenerator interface (from java.security.interfaces).

See "The KeyPairGenerator Class" in the Java Cryptography Architecture API Specification & Reference for more information and examples.

See Also:
DSAKeyPairGenerator


 KeyPairGenerator Members

KeyPairGenerator Members

Class Overview | This Package | All Packages

Constructors
Name | Description
KeyPairGenerator(String) | Creates a KeyPairGenerator object for the specified algorithm.

Methods
Name | Description
generateKeyPair() | Generates a key pair.
getAlgorithm() | Returns the standard name of the algorithm for this key generator.
getInstance(String) | Generates a KeyPairGenerator object that implements the algorithm requested, as available in the environment.
getInstance(String, String) | Generates a KeyPairGenerator object implementing the specified algorithm, as supplied from the specified provider, if such an algorithm is available from the provider.
initialize(int) | Initializes the key pair generator for a certain strength using a system-provided source of randomness.
initialize(int, SecureRandom) | Initializes the key pair generator for a certain strength.


 KeyPairGenerator.KeyPairGenerator

KeyPairGenerator.KeyPairGenerator

Syntax
protected KeyPairGenerator( String algorithm )
Parameters
algorithm
the standard string name of the algorithm. See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard algorithm names.
Description
Creates a KeyPairGenerator object for the specified algorithm.


 KeyPairGenerator.generateKeyPair

KeyPairGenerator.generateKeyPair

Syntax
public abstract KeyPair generateKeyPair()
Description
Generates a key pair. Unless an initialization method is called using a KeyPairGenerator interface, algorithm-specific defaults will be used. This will generate a new key pair every time it is called.


 KeyPairGenerator.getAlgorithm

KeyPairGenerator.getAlgorithm

Syntax
public String getAlgorithm()
Returns
the standard string name of the algorithm.
Description
Returns the standard name of the algorithm for this key generator. See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard algorithm names.


 KeyPairGenerator.getInstance

KeyPairGenerator.getInstance

Syntax 1
public static KeyPairGenerator getInstance( String algorithm ) throws NoSuchAlgorithmException
Parameters
algorithm
the standard string name of the algorithm. See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard algorithm names.
Returns
the new KeyPairGenerator object.
Description
Generates a KeyPairGenerator object that implements the algorithm requested, as available in the environment.

Exceptions
NoSuchAlgorithmException if the algorithm is not available in the environment.

Syntax 2
public static KeyPairGenerator getInstance( String algorithm, String provider ) throws NoSuchAlgorithmException, NoSuchProviderException
Parameters
algorithm
the standard string name of the algorithm. See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard algorithm names.
provider
the string name of the provider.
Returns
the new KeyPairGenerator object.
Description
Generates a KeyPairGenerator object implementing the specified algorithm, as supplied from the specified provider, if such an algorithm is available from the provider.

Exceptions
NoSuchAlgorithmException if the algorithm is not available from the provider.
Exceptions
NoSuchProviderException if the provider is not available in the environment.
See Also
Provider


 KeyPairGenerator.initialize

KeyPairGenerator.initialize

Syntax 1
public abstract void initialize( int strength, SecureRandom random )
Parameters
strength
the strength of the key. This is an algorithm-specific metric, such as modulus length.
random
the source of randomness for this generator.
Description
Initializes the key pair generator for a certain strength.

Syntax 2
public void initialize( int strength )
Parameters
strength
the strength of the key. This is an algorithm-specific metric, such as modulus length.
Description
Initializes the key pair generator for a certain strength using a system-provided source of randomness.


 Class MessageDigest

Class java.security.MessageDigest

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.security.MessageDigest

public abstract class MessageDigest
extends Object

This MessageDigest class provides the functionality of a message digest algorithm, such as MD5 or SHA. Message digests are secure one-way hash functions that take arbitrary-sized data and output a fixed-length hash value.

Like other algorithm-based classes in Java Security, MessageDigest has two major components:

Message Digest API (Application Program Interface)
This is the interface of methods called by applications needing message digest services. The API consists of all public methods.
Message Digest SPI (Service Provider Interface)
This is the interface implemented by providers that supply specific algorithms. It consists of all methods whose names are prefixed by engine. Each such method is called by a correspondingly-named public API method. For example, the engineReset method is called by the reset method. The SPI methods are abstract; providers must supply a concrete implementation.

A MessageDigest object starts out initialized. The data is processed through it using the update methods. At any point reset can be called to reset the digest. Once all the data to be updated has been updated, one of the digest methods should be called to complete the hash computation.

The digest method can be called once for a given number of updates. After digest has been called, the MessageDigest object is reset to its initialized state.

Implementations are free to implement the Cloneable interface, and doing so will let client applications test cloneability using instanceof Cloneable before cloning:

 MessageDigest md = MessageDigest.getInstance("SHA");
 if (md instanceof Cloneable) {
     md.update(toChapter1);
     MessageDigest tc1 = md.clone();
     byte[] toChapter1Digest = tc1.digest;
     md.update(toChapter2);
     ...etc.
 } else {
     throw new DigestException("couldn't make digest of partial content");
 }

Note that if a given implementation is not cloneable, it is still possible to compute intermediate digests by instantiating several instances, if the number of digests is known in advance.

See Also:
DigestInputStream, DigestOutputStream


 MessageDigest Members

MessageDigest Members

Class Overview | This Package | All Packages

Constructors
Name | Description
MessageDigest(String) | Creates a message digest with the specified algorithm name.

Methods
Name | Description
clone() | Returns a clone if the implementation is cloneable.
digest() | Completes the hash computation by performing final operations such as padding.
digest(byte[]) | Performs a final update on the digest using the specified array of bytes, then completes the digest computation.
engineDigest() | SPI: Completes the hash computation by performing final operations such as padding.
engineReset() | SPI: Resets the digest for further use.
engineUpdate(byte) | SPI: Updates the digest using the specified byte.
engineUpdate(byte[], int, int) | SPI: Updates the digest using the specified array of bytes, starting at the specified offset.
getAlgorithm() | Returns a string that identifies the algorithm, independent of implementation details.
getInstance(String) | Generates a MessageDigest object that implements the specified digest algorithm.
getInstance(String, String) | Generates a MessageDigest object implementing the specified algorithm, as supplied from the specified provider, if such an algorithm is available from the provider.
isEqual(byte[], byte[]) | Compares two digests for equality.
reset() | Resets the digest for further use.
toString() | Returns a string representation of this message digest object.
update(byte) | Updates the digest using the specified byte.
update(byte[]) | Updates the digest using the specified array of bytes.
update(byte[], int, int) | Updates the digest using the specified array of bytes, starting at the specified offset.


 MessageDigest.MessageDigest

MessageDigest.MessageDigest

Syntax
protected MessageDigest( String algorithm )
Parameters
algorithm
the standard name of the digest algorithm. See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard algorithm names.
Description
Creates a message digest with the specified algorithm name.


 MessageDigest.clone

MessageDigest.clone

Syntax
public Object clone() throws CloneNotSupportedException
Returns
a clone if the implementation is cloneable.
Description
Returns a clone if the implementation is cloneable.

Exceptions
CloneNotSupportedException if this is called on an implementation that does not support Cloneable.
Overrides
clone in class Object


 MessageDigest.digest

MessageDigest.digest

Syntax 1
public byte[] digest()
Returns
the array of bytes for the resulting hash value.
Description
Completes the hash computation by performing final operations such as padding. The digest is reset after this call is made.

Syntax 2
public byte[] digest( byte input[] )
Parameters
input
the input to be updated before the digest is completed.
Returns
the array of bytes for the resulting hash value.
Description
Performs a final update on the digest using the specified array of bytes, then completes the digest computation. That is, this method first calls update on the array, then calls digest().


 MessageDigest.engineDigest

MessageDigest.engineDigest

Syntax
protected abstract byte[] engineDigest()
Returns
the array of bytes for the resulting hash value.
Description
SPI: Completes the hash computation by performing final operations such as padding. Once engineDigest has been called, the engine should be reset (see reset). Resetting is the responsibility of the engine implementor.


 MessageDigest.engineReset

MessageDigest.engineReset

Syntax
protected abstract void engineReset()
Description
SPI: Resets the digest for further use.


 MessageDigest.engineUpdate

MessageDigest.engineUpdate

Syntax 1
protected abstract void engineUpdate( byte input )
Parameters
input
the byte to use for the update.
Description
SPI: Updates the digest using the specified byte.

Syntax 2
protected abstract void engineUpdate( byte input[], int offset, int len )
Parameters
input
the array of bytes to use for the update.
offset
the offset to start from in the array of bytes.
len
the number of bytes to use, starting at offset.
Description
SPI: Updates the digest using the specified array of bytes, starting at the specified offset. This should be a no-op if the digest has been finalized.


 MessageDigest.getAlgorithm

MessageDigest.getAlgorithm

Syntax
public final String getAlgorithm()
Description
Returns a string that identifies the algorithm, independent of implementation details. The name should be a standard Java Security name (such as "SHA", "MD5", and so on). See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard algorithm names.


 MessageDigest.getInstance

MessageDigest.getInstance

Syntax 1
public static MessageDigest getInstance( String algorithm ) throws NoSuchAlgorithmException
Parameters
algorithm
the name of the algorithm requested. See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard algorithm names.
Returns
a Message Digest object implementing the specified algorithm.
Description
Generates a MessageDigest object that implements the specified digest algorithm. If the default provider package contains a MessageDigest subclass implementing the algorithm, an instance of that subclass is returned. If the algorithm is not available in the default package, other packages are searched.

Exceptions
NoSuchAlgorithmException if the algorithm is not available in the caller's environment.

Syntax 2
public static MessageDigest getInstance( String algorithm, String provider ) throws NoSuchAlgorithmException, NoSuchProviderException
Parameters
algorithm
the name of the algorithm requested. See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard algorithm names.
provider
the name of the provider.
Returns
a Message Digest object implementing the specified algorithm.
Description
Generates a MessageDigest object implementing the specified algorithm, as supplied from the specified provider, if such an algorithm is available from the provider.

Exceptions
NoSuchAlgorithmException if the algorithm is not available in the package supplied by the requested provider.
Exceptions
NoSuchProviderException if the provider is not available in the environment.
See Also
Provider


 MessageDigest.isEqual

MessageDigest.isEqual

Syntax
public static boolean isEqual( byte digesta[], byte digestb[] )
Parameters
digesta
one of the digests to compare.
digestb
the other digest to compare.
Returns
true if the digests are equal, false otherwise.
Description
Compares two digests for equality. Does a simple byte compare.


 MessageDigest.reset

MessageDigest.reset

Syntax
public void reset()
Description
Resets the digest for further use.


 MessageDigest.toString

MessageDigest.toString

Syntax
public String toString()
Description
Returns a string representation of this message digest object.

Overrides
toString in class Object


 MessageDigest.update

MessageDigest.update

Syntax 1
public void update( byte input )
Parameters
input
the byte with which to update the digest.
Description
Updates the digest using the specified byte.

Syntax 2
public void update( byte input[], int offset, int len )
Parameters
input
the array of bytes.
offset
the offset to start from in the array of bytes.
len
the number of bytes to use, starting at offset.
Description
Updates the digest using the specified array of bytes, starting at the specified offset.

Syntax 3
public void update( byte input[] )
Parameters
input
the array of bytes.
Description
Updates the digest using the specified array of bytes.


 Class NoSuchAlgorithmException

Class java.security.NoSuchAlgorithmException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.security.NoSuchAlgorithmException

public class NoSuchAlgorithmException
extends Exception

This exception is thrown when a particular cryptographic algorithm is requested but is not available in the environment.


 NoSuchAlgorithmException Members

NoSuchAlgorithmException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
NoSuchAlgorithmException() | Constructs a NoSuchAlgorithmException with no detail message.
NoSuchAlgorithmException(String) | Constructs a NoSuchAlgorithmException with the specified detail message.


 NoSuchAlgorithmException.NoSuchAlgorithmException

NoSuchAlgorithmException.NoSuchAlgorithmException

Syntax 1
public NoSuchAlgorithmException()
Description
Constructs a NoSuchAlgorithmException with no detail message. A detail message is a String that describes this particular exception.

Syntax 2
public NoSuchAlgorithmException( String msg )
Parameters
msg
the detail message.
Description
Constructs a NoSuchAlgorithmException with the specified detail message. A detail message is a String that describes this particular exception, which may, for example, specify which algorithm is not available.


 Class NoSuchProviderException

Class java.security.NoSuchProviderException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.security.NoSuchProviderException

public class NoSuchProviderException
extends Exception

This exception is thrown when a particular security provider is requested but is not available in the environment.


 NoSuchProviderException Members

NoSuchProviderException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
NoSuchProviderException() | Constructs a NoSuchProviderException with no detail message.
NoSuchProviderException(String) | Constructs a NoSuchProviderException with the specified detail message.


 NoSuchProviderException.NoSuchProviderException

NoSuchProviderException.NoSuchProviderException

Syntax 1
public NoSuchProviderException()
Description
Constructs a NoSuchProviderException with no detail message. A detail message is a String that describes this particular exception.

Syntax 2
public NoSuchProviderException( String msg )
Parameters
msg
the detail message.
Description
Constructs a NoSuchProviderException with the specified detail message. A detail message is a String that describes this particular exception.


 Interface Principal

Interface java.security.Principal

Interface Members | This Package | All Packages

public interface Principal

This interface represents a principal. A principal can be an individual, a corporation, a program thread; anything which can have an identity. See the ACL white paper for more information.

See Also:
Identity, Certificate, Acl, Group


 Principal Members

Principal Members

Interface Overview | This Package | All Packages

Methods
Name | Description
equals(Object) | Compares this principal to the specified object.
getName() | Returns the name of this principal.
hashCode() | Returns a hashcode for this principal.
toString() | Returns a string representation of this principal.


 Principal.equals

Principal.equals

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean equals( Object another )
Parameters
another
the principal to compare with.
Returns
true if the principal passed in is the same as that encapsulated by this principal, false otherwise.
Description
Compares this principal to the specified object. Returns true if the object passed in matches the principal represented by the implementation of this interface.

Overrides
equals in class Object


 Principal.getName

Principal.getName

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getName()
Returns
the name of this principal.
Description
Returns the name of this principal.


 Principal.hashCode

Principal.hashCode

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int hashCode()
Returns
a hashcode for this principal.
Description
Returns a hashcode for this principal.

Overrides
hashCode in class Object


 Principal.toString

Principal.toString

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String toString()
Returns
a string representation of this principal.
Description
Returns a string representation of this principal.

Overrides
toString in class Object


 Interface PrivateKey

Interface java.security.PrivateKey

This Package | All Packages

public interface PrivateKey
extends Key

A private key. This interface contains no methods or constants. It merely serves to group (and provide type safety for) all private key interfaces. Note: The specialized private key interfaces extend this interface. See, for example, the DSAPrivateKey interface in java.security.interfaces.

See Also:
Key, PublicKey, Certificate, initVerify, DSAPrivateKey


 Class Provider

Class java.security.Provider

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.Dictionary
           |
           +----java.util.Hashtable
                   |
                   +----java.util.Properties
                           |
                           +----java.security.Provider

public abstract class Provider
extends Properties

This class represents a "provider" for the Java Security API. A provider implements some or all parts of Java Security, including:

  • Algorithms (such as DSA, RSA, MD5 or SHA-1).
  • Key generation and management facilities (such as for algorithm-specific keys).

Each provider has a name and a version number, and is configured in each runtime it is installed in.

There is a default provider that comes standard with the JDK. It is called the SUN Provider. See "The Provider Class" in the Java Cryptography Architecture API Specification & Reference for information about how providers work and how to install them.


 Provider Members

Provider Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Provider(String, double, String) | Constructs a provider with the specified name, version number, and information.

Methods
Name | Description
getInfo() | Returns a human-readable description of the provider and its services.
getName() | Returns the name of this provider.
getVersion() | Returns the version number for this provider.
toString() | Returns a string with the name and the version number of this provider.


 Provider.Provider

Provider.Provider

Syntax
protected Provider( String name, double version, String info )
Parameters
name
the provider name.
version
the provider version number.
info
a description of the provider and its services.
Description
Constructs a provider with the specified name, version number, and information.


 Provider.getInfo

Provider.getInfo

Syntax
public String getInfo()
Returns
a description of the provider and its services.
Description
Returns a human-readable description of the provider and its services. This may return an HTML page, with relevant links.


 Provider.getName

Provider.getName

Syntax
public String getName()
Returns
the name of this provider.
Description
Returns the name of this provider.


 Provider.getVersion

Provider.getVersion

Syntax
public double getVersion()
Returns
the version number for this provider.
Description
Returns the version number for this provider.


 Provider.toString

Provider.toString

Syntax
public String toString()
Returns
the string with the name and the version number for this provider.
Description
Returns a string with the name and the version number of this provider.

Overrides
toString in class Hashtable


 Class ProviderException

Class java.security.ProviderException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.security.ProviderException

public class ProviderException
extends RuntimeException

A runtime exception for Provider exceptions (such as misconfiguration errors), which may be subclassed by Providers to throw specialized, provider-specific runtime errors.


 ProviderException Members

ProviderException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ProviderException() | Constructs a ProviderException with no detail message.
ProviderException(String) | Constructs a ProviderException with the specified detail message.


 ProviderException.ProviderException

ProviderException.ProviderException

Syntax 1
public ProviderException()
Description
Constructs a ProviderException with no detail message. A detail message is a String that describes this particular exception.

Syntax 2
public ProviderException( String s )
Parameters
s
the detail message.
Description
Constructs a ProviderException with the specified detail message. A detail message is a String that describes this particular exception.


 Interface PublicKey

Interface java.security.PublicKey

This Package | All Packages

public interface PublicKey
extends Key

A public key. This interface contains no methods or constants. It merely serves to group (and provide type safety for) all public key interfaces. Note: The specialized public key interfaces extend this interface. See, for example, the DSAPublicKey interface in java.security.interfaces.

See Also:
Key, PublicKey, Certificate, initVerify, DSAPublicKey


 Class SecureRandom

Class java.security.SecureRandom

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.Random
           |
           +----java.security.SecureRandom

public class SecureRandom
extends Random

This class provides a crytpographically strong pseudo-random number generator based on the SHA-1 hash algorithm.

The calls inherited from Random will be implemented in terms of the strengthened functionality.

See Also:
Random


 SecureRandom Members

SecureRandom Members

Class Overview | This Package | All Packages

Constructors
Name | Description
SecureRandom() | This empty constructor automatically seeds the generator.
SecureRandom(byte[]) | This constructor uses a user-provided seed in preference to the self-seeding algorithm referred to in the empty constructor description.

Methods
Name | Description
getSeed(int) | Returns the given number of seed bytes, computed using the seed generation algorithm that this class uses to seed itself.
next(int) | Generates an integer containing the user-specified number of pseudo-random bits (right justified, with leading zeros).
nextBytes(byte[]) | Generates a user-specified number of random bytes.
setSeed(byte[]) | Reseeds this random object.
setSeed(long) | Reseeds this random object, using the eight bytes contained in the given long seed.


 SecureRandom.SecureRandom

SecureRandom.SecureRandom

Syntax 1
public SecureRandom()
Description
This empty constructor automatically seeds the generator. We attempt to provide sufficient seed bytes to completely randomize the internal state of the generator (20 bytes). Note, however, that our seed generation algorithm has not been thoroughly studied or widely deployed. It relies on counting the number of times that the calling thread can yield while waiting for another thread to sleep for a specified interval.

The first time this constructor is called in a given Virtual Machine, it may take several seconds of CPU time to seed the generator, depending on the underlying hardware. Successive calls run quickly because they rely on the same (internal) pseudo-random number generator for their seed bits.

The seeding procedure implemented by this constructor ensures that the sequence of pseudo-random bytes produced by each SecureRandom instance yields no useful information about the byte-sequence produced by any other instance. If however, the user wishes to produce multiple instances with truly unrelated seeds, the following code yields the desired result (at substantial CPU cost per instance!):

 SecureRandom rnd = new SecureRandom(SecureRandom.getSeed(20));

Syntax 2
public SecureRandom( byte seed[] )
Parameters
seed
the seed.
Description
This constructor uses a user-provided seed in preference to the self-seeding algorithm referred to in the empty constructor description. It may be preferable to the empty constructor if the caller has access to high-quality random bytes from some physical device (for example, a radiation detector or a noisy diode).


 SecureRandom.getSeed

SecureRandom.getSeed

Syntax
public static byte[] getSeed( int numBytes )
Parameters
numBytes
the number of seed bytes to generate.
Returns
the seed bytes.
Description
Returns the given number of seed bytes, computed using the seed generation algorithm that this class uses to seed itself. This call may be used to seed other random number generators. While we attempt to return a "truly random" sequence of bytes, we do not know exactly how random the bytes returned by this call are. (See the empty constructor SecureRandom for a brief description of the underlying algorithm.) The prudent user will err on the side of caution and get extra seed bytes, although it should be noted that seed generation is somewhat costly.


 SecureRandom.next

SecureRandom.next

Syntax
protected final int next( int numBits )
Parameters
numBits
number of pseudo-random bits to be generated, where 0 <= numBits <= 32.
Description
Generates an integer containing the user-specified number of pseudo-random bits (right justified, with leading zeros). This method overrides a java.util.Random method, and serves to provide a source of random bits to all of the methods inherited from that class (for example, nextInt, nextLong, and nextFloat).

Overrides
next in class Random


 SecureRandom.nextBytes

SecureRandom.nextBytes

Syntax
public synchronized void nextBytes( byte bytes[] )
Parameters
bytes
the array to be filled in with random bytes.
Description
Generates a user-specified number of random bytes. This method is used as the basis of all random entities returned by this class (except seed bytes). Thus, it may be overridden to change the behavior of the class.

Overrides
nextBytes in class Random


 SecureRandom.setSeed

SecureRandom.setSeed

Syntax 1
public synchronized void setSeed( byte seed[] )
Parameters
seed
the seed.
Description
Reseeds this random object. The given seed supplements, rather than replaces, the existing seed. Thus, repeated calls are guaranteed never to reduce randomness.

Syntax 2
public void setSeed( long seed )
Parameters
seed
the seed.
Description
Reseeds this random object, using the eight bytes contained in the given long seed. The given seed supplements, rather than replaces, the existing seed. Thus, repeated calls are guaranteed never to reduce randomness.

This method is defined for compatibility with java.util.Random.

Overrides
setSeed in class Random


 Class Security

Class java.security.Security

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.security.Security

public final class Security
extends Object

This class centralizes all security properties and common security methods. One of its primary uses is to manage providers.


 Security Members

Security Members

Class Overview | This Package | All Packages

Methods
Name | Description
addProvider(Provider) | Adds a provider to the next position available.
getAlgorithmProperty(String, String) | Gets a specified property for an algorithm.
getProperty(String) | Gets a security property.
getProvider(String) | Returns the provider installed with the specified name, if any.
getProviders() | Returns all providers currently installed.
insertProviderAt(Provider, int) | Adds a new provider, at a specified position.
removeProvider(String) | Removes the provider with the specified name.
setProperty(String, String) | Sets a security property.


 Security.addProvider

Security.addProvider

Syntax
public static int addProvider( Provider provider )
Parameters
provider
the provider to be added.
Returns
the preference position in which the provider was added, or -1 if the provider was not added because it is already installed.
Description
Adds a provider to the next position available.

See Also
getProvider, removeProvider


 Security.getAlgorithmProperty

Security.getAlgorithmProperty

Syntax
public static String getAlgorithmProperty( String algName, String propName )
Parameters
algName
the algorithm name.
propName
the name of the property to get.
Returns
the value of the specified property.
Description
Gets a specified property for an algorithm. The algorithm name should be a standard name. See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard algorithm names. One possible use is by specialized algorithm parsers, which may map classes to algorithms which they understand (much like Key parsers do).


 Security.getProperty

Security.getProperty

Syntax
public static String getProperty( String key )
Parameters
key
the key of the property being retrieved.
Returns
the valeu of the security property corresponding to key.
Description
Gets a security property.


 Security.getProvider

Security.getProvider

Syntax
public static Provider getProvider( String name )
Parameters
name
the name of the provider to get.
Returns
the provider of the specified name.
Description
Returns the provider installed with the specified name, if any. Returns null if no provider with the speicified name is installed.

See Also
removeProvider, addProvider


 Security.getProviders

Security.getProviders

Syntax
public static Provider[] getProviders()
Returns
an array of all providers currently installed.
Description
Returns all providers currently installed.


 Security.insertProviderAt

Security.insertProviderAt

Syntax
public static int insertProviderAt( Provider provider, int position )
Parameters
provider
the provider to be added.
position
the preference position that the caller would like for this provider.
Returns
the actual preference position in which the provider was added, or -1 if the provider was not added because it is already installed.
Description
Adds a new provider, at a specified position. The position is the preference order in which providers are searched for requested algorithms. Note that it is not guaranteed that this preference will be respected. The position is 1-based, that is, 1 is most preferred, followed by 2, and so on. Sometimes it will be legal to add a provider, but only in the last position, in which case the position argument will be ignored.

A provider cannot be added if it is already installed.

See Also
getProvider, removeProvider


 Security.removeProvider

Security.removeProvider

Syntax
public static void removeProvider( String name )
Parameters
name
the name of the provider to remove.
Description
Removes the provider with the specified name. This method returns silently if the provider is not installed.

See Also
getProvider, addProvider


 Security.setProperty

Security.setProperty

Syntax
public static void setProperty( String key, String datum )
Parameters
key
the name of the property to be set.
datum
the value of the property to be set.
Description
Sets a security property.


 Class Signature

Class java.security.Signature

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.security.Signature

public abstract class Signature
extends Object

This Signature class is used to provide the functionality of a digital signature algorithm, such as RSA with MD5 or DSA. Digital signatures are used for authentication and integrity assurance of digital data.

Like other algorithm-based classes in Java Security, the Signature class has two major components:

Digital Signature API (Application Program Interface)
This is the interface of methods called by applications needing digital signature services. The API consists of all public methods.
Digital Signature SPI (Service Provider Interface)
This is the interface implemented by providers that supply specific algorithms. It consists of all methods whose names are prefixed by engine. Each such method is called by a correspondingly-named public API method. For example, the engineSign method is called by the sign method. The SPI methods are abstract; providers must supply a concrete implementation.

Also like other algorithm-based classes in Java Security, Signature provides implementation-independent algorithms, whereby a caller (application code) requests a particular signature algorithm and is handed back a properly initialized Signature object. It is also possible, if desired, to request a particular algorithm from a particular provider. See the getInstance methods.

Thus, there are two ways to request a Signature algorithm object: by specifying either just an algorithm name, or both an algorithm name and a package provider.

  • If just an algorithm name is specified, the system will determine if there is an implementation of the algorithm requested available in the environment, and if there is more than one, if there is a preferred one.
  • If both an algorithm name and a package provider are specified, the system will determine if there is an implementation of the algorithm in the package requested, and throw an exception if there is not.

A Signature object can be used to generate and verify digital signatures.

There are three phases to the use of a Signature object for either signing data or verifying a signature:

  1. Initialization, with either
    • a public key, which initializes the signature for verification (see initVerify), or
    • a private key, which initializes the signature for signing (see initSign).

  2. Updating

    Depending on the type of initialization, this will update the bytes to be signed or verified. See the update methods.

  3. Signing or Verifying

    a signature on all updated bytes. See sign and verify.


 Signature Members

Signature Members

Class Overview | This Package | All Packages

Fields
Name | Description
SIGN | Possible state value, signifying that this signature object has been initialized for signing.
state | Current state of this signature object.
UNINITIALIZED | Possible state value, signifying that this signature object has not yet been initialized.
VERIFY | Possible state value, signifying that this signature object has been initialized for verification.

Constructors
Name | Description
Signature(String) | Creates a Signature object for the specified algorithm.

Methods
Name | Description
clone() | Returns a clone if the implementation is cloneable.
engineGetParameter(String) | SPI: Gets the value of the specified algorithm parameter.
engineInitSign(PrivateKey) | SPI: Initializes this signature object with the specified private key for signing operations.
engineInitVerify(PublicKey) | SPI: Initializes this signature object with the specified public key for verification operations.
engineSetParameter(String, Object) | SPI: Sets the specified algorithm parameter to the specified value.
engineSign() | SPI: Returns the signature bytes of all the data updated so far.
engineUpdate(byte) | SPI: Updates the data to be signed or verified using the specified byte.
engineUpdate(byte[], int, int) | SPI: Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset.
engineVerify(byte[]) | SPI: Verifies the passed-in signature.
getAlgorithm() | Returns the name of the algorithm for this signature object.
getInstance(String) | Generates a Signature object that implements the specified algorithm.
getInstance(String, String) | Generates a Signature object implementing the specified algorithm, as supplied from the specified provider, if such an algorithm is available from the provider.
getParameter(String) | Gets the value of the specified algorithm parameter.
initSign(PrivateKey) | Initialize this object for signing.
initVerify(PublicKey) | Initializes this object for verification.
setParameter(String, Object) | Sets the specified algorithm parameter to the specified value.
sign() | Returns the signature bytes of all the data updated.
toString() | Returns a string representation of this signature object, providing information that includes the state of the object and the name of the algorithm used.
update(byte) | Updates the data to be signed or verified by a byte.
update(byte[]) | Updates the data to be signed or verified, using the specified array of bytes.
update(byte[], int, int) | Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset.
verify(byte[]) | Verifies the passed-in signature.


 Signature.SIGN

Signature.SIGN

Syntax
protected static final int SIGN
Description
Possible state value, signifying that this signature object has been initialized for signing.


 Signature.state

Signature.state

Syntax
protected int state
Description
Current state of this signature object.


 Signature.UNINITIALIZED

Signature.UNINITIALIZED

Syntax
protected static final int UNINITIALIZED
Description
Possible state value, signifying that this signature object has not yet been initialized.


 Signature.VERIFY

Signature.VERIFY

Syntax
protected static final int VERIFY
Description
Possible state value, signifying that this signature object has been initialized for verification.


 Signature.Signature

Signature.Signature

Syntax
protected Signature( String algorithm )
Parameters
algorithm
the standard string name of the algorithm. See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard algorithm names.
Description
Creates a Signature object for the specified algorithm.


 Signature.clone

Signature.clone

Syntax
public Object clone() throws CloneNotSupportedException
Returns
a clone if the implementation is cloneable.
Description
Returns a clone if the implementation is cloneable.

Exceptions
CloneNotSupportedException if this is called on an implementation that does not support Cloneable.
Overrides
clone in class Object


 Signature.engineGetParameter

Signature.engineGetParameter

Syntax
protected abstract Object engineGetParameter( String param ) throws InvalidParameterException
Parameters
param
the string name of the parameter.
Returns
the object that represents the parameter value, or null if there is none.
Description
SPI: Gets the value of the specified algorithm parameter. This method supplies a general-purpose mechanism through which it is possible to get the various parameters of this object. A parameter may be any settable parameter for the algorithm, such as a parameter size, or a source of random bits for signature generation (if appropriate), or an indication of whether or not to perform a specific but optional computation. A uniform algorithm-specific naming scheme for each parameter is desirable but left unspecified at this time.

Exceptions
InvalidParameterException if param is an invalid parameter for this engine, or another exception occurs while trying to get this parameter.


 Signature.engineInitSign

Signature.engineInitSign

Syntax
protected abstract void engineInitSign( PrivateKey privateKey ) throws InvalidKeyException
Parameters
privateKey
the private key of the identity whose signature will be generated.
Description
SPI: Initializes this signature object with the specified private key for signing operations.

Exceptions
InvalidKeyException if the key is improperly encoded, parameters are missing, and so on.


 Signature.engineInitVerify

Signature.engineInitVerify

Syntax
protected abstract void engineInitVerify( PublicKey publicKey ) throws InvalidKeyException
Parameters
publicKey
the public key of the identity whose signature is going to be verified.
Description
SPI: Initializes this signature object with the specified public key for verification operations.

Exceptions
InvalidKeyException if the key is improperly encoded, parameters are missing, and so on.


 Signature.engineSetParameter

Signature.engineSetParameter

Syntax
protected abstract void engineSetParameter( String param, Object value ) throws InvalidParameterException
Parameters
param
the string identifier of the parameter.
value
the parameter value.
Description
SPI: Sets the specified algorithm parameter to the specified value. This method supplies a general-purpose mechanism through which it is possible to set the various parameters of this object. A parameter may be any settable parameter for the algorithm, such as a parameter size, or a source of random bits for signature generation (if appropriate), or an indication of whether or not to perform a specific but optional computation. A uniform algorithm-specific naming scheme for each parameter is desirable but left unspecified at this time.

Exceptions
InvalidParameterException if param is an invalid parameter for this signature algorithm engine, the parameter is already set and cannot be set again, a security exception occurs, and so on.


 Signature.engineSign

Signature.engineSign

Syntax
protected abstract byte[] engineSign() throws SignatureException
Returns
the signature bytes of the signing operation's result.
Description
SPI: Returns the signature bytes of all the data updated so far. The signature returned is X.509-encoded. For more information about the X.509 encoding, see "Why should I care about X.509 certificates?"

Exceptions
SignatureException if the engine is not initialized properly.


 Signature.engineUpdate

Signature.engineUpdate

Syntax 1
protected abstract void engineUpdate( byte b ) throws SignatureException
Parameters
b
the byte to use for the update.
Description
SPI: Updates the data to be signed or verified using the specified byte.

Exceptions
SignatureException if the engine is not initialized properly.

Syntax 2
protected abstract void engineUpdate( byte b[], int off, int len ) throws SignatureException
Parameters
data
the array of bytes.
off
the offset to start from in the array of bytes.
len
the number of bytes to use, starting at offset.
Description
SPI: Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset.

Exceptions
SignatureException if the engine is not initialized properly.


 Signature.engineVerify

Signature.engineVerify

Syntax
protected abstract boolean engineVerify( byte sigBytes[] ) throws SignatureException
Parameters
sigBytes
the signature bytes to be verified.
Returns
true if the signature was verified, false if not.
Description
SPI: Verifies the passed-in signature. The signature bytes are expected to be X.509-encoded. For more information about the X.509 encoding, see "Why should I care about X.509 certificates?"

Exceptions
SignatureException if the engine is not initialized properly, or the passed-in signature is improperly encoded or of the wrong type, etc.


 Signature.getAlgorithm

Signature.getAlgorithm

Syntax
public final String getAlgorithm()
Returns
the name of the algorithm for this signature object.
Description
Returns the name of the algorithm for this signature object.


 Signature.getInstance

Signature.getInstance

Syntax 1
public static Signature getInstance( String algorithm ) throws NoSuchAlgorithmException
Parameters
algorithm
the standard name of the algorithm requested. See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard algorithm names.
Returns
the new Signature object.
Description
Generates a Signature object that implements the specified algorithm. If the default provider package contains a Signature subclass implementing the algorithm, an instance of that subclass is returned. If the algorithm is not available in the default package, other packages are searched.

Exceptions
NoSuchAlgorithmException if the algorithm is not available in the environment.

Syntax 2
public static Signature getInstance( String algorithm, String provider ) throws NoSuchAlgorithmException, NoSuchProviderException
Parameters
algorithm
the name of the algorithm requested. See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard algorithm names.
provider
the name of the provider.
Returns
the new Signature object.
Description
Generates a Signature object implementing the specified algorithm, as supplied from the specified provider, if such an algorithm is available from the provider.

Exceptions
NoSuchAlgorithmException if the algorithm is not available in the package supplied by the requested provider.
Exceptions
NoSuchProviderException if the provider is not available in the environment.
See Also
Provider


 Signature.getParameter

Signature.getParameter

Syntax
public final Object getParameter( String param ) throws InvalidParameterException
Parameters
param
the string name of the parameter.
Returns
the object that represents the parameter value, or null if there is none.
Description
Gets the value of the specified algorithm parameter. This method supplies a general-purpose mechanism through which it is possible to get the various parameters of this object. A parameter may be any settable parameter for the algorithm, such as a parameter size, or a source of random bits for signature generation (if appropriate), or an indication of whether or not to perform a specific but optional computation. A uniform algorithm-specific naming scheme for each parameter is desirable but left unspecified at this time.

Exceptions
InvalidParameterException if param is an invalid parameter for this engine, or another exception occurs while trying to get this parameter.


 Signature.initSign

Signature.initSign

Syntax
public final void initSign( PrivateKey privateKey ) throws InvalidKeyException
Parameters
privateKey
the private key of the identity whose signature is going to be generated.
Description
Initialize this object for signing. If this method is called again with a different argument, it negates the effect of this call.

Exceptions
InvalidKeyException if the key is invalid.


 Signature.initVerify

Signature.initVerify

Syntax
public final void initVerify( PublicKey publicKey ) throws InvalidKeyException
Parameters
publicKey
the public key of the identity whose signature is going to be verified.
Description
Initializes this object for verification. If this method is called again with a different argument, it negates the effect of this call.

Exceptions
InvalidKeyException if the key is invalid.


 Signature.setParameter

Signature.setParameter

Syntax
public final void setParameter( String param, Object value ) throws InvalidParameterException
Parameters
param
the string identifier of the parameter.
value
the parameter value.
Description
Sets the specified algorithm parameter to the specified value. This method supplies a general-purpose mechanism through which it is possible to set the various parameters of this object. A parameter may be any settable parameter for the algorithm, such as a parameter size, or a source of random bits for signature generation (if appropriate), or an indication of whether or not to perform a specific but optional computation. A uniform algorithm-specific naming scheme for each parameter is desirable but left unspecified at this time.

Exceptions
InvalidParameterException if param is an invalid parameter for this signature algorithm engine, the parameter is already set and cannot be set again, a security exception occurs, and so on.


 Signature.sign

Signature.sign

Syntax
public final byte[] sign() throws SignatureException
Returns
the signature bytes of the signing operation's result.
Description
Returns the signature bytes of all the data updated. The signature returned is X.509-encoded.

A call to this method resets this signature object to the state it was in when previously initialized for signing via a call to initSign(PrivateKey). That is, the object is reset and available to generate another signature from the same signer, if desired, via new calls to update and sign.

Exceptions
SignatureException if this signature object is not initialized properly.


 Signature.toString

Signature.toString

Syntax
public String toString()
Returns
a string representation of this signature object.
Description
Returns a string representation of this signature object, providing information that includes the state of the object and the name of the algorithm used.

Overrides
toString in class Object


 Signature.update

Signature.update

Syntax 1
public final void update( byte b ) throws SignatureException
Parameters
b
the byte to use for the update.
Description
Updates the data to be signed or verified by a byte.

Exceptions
SignatureException if this signature object is not initialized properly.

Syntax 2
public final void update( byte data[] ) throws SignatureException
Parameters
data
the byte array to use for the update.
Description
Updates the data to be signed or verified, using the specified array of bytes.

Exceptions
SignatureException if this signature object is not initialized properly.

Syntax 3
public final void update( byte data[], int off, int len ) throws SignatureException
Parameters
data
the array of bytes.
off
the offset to start from in the array of bytes.
len
the number of bytes to use, starting at offset.
Description
Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset.

Exceptions
SignatureException if this signature object is not initialized properly.


 Signature.verify

Signature.verify

Syntax
public final boolean verify( byte signature[] ) throws SignatureException
Parameters
signature
the signature bytes to be verified.
Returns
true if the signature was verified, false if not.
Description
Verifies the passed-in signature. The signature bytes are expected to be X.509-encoded.

A call to this method resets this signature object to the state it was in when previously initialized for verification via a call to initVerify(PublicKey). That is, the object is reset and available to verify another signature from the identity whose public key was specified in the call to initVerify.

Exceptions
SignatureException if this signature object is not initialized properly, or the passed-in signature is improperly encoded or of the wrong type, etc.


 Class SignatureException

Class java.security.SignatureException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.security.SignatureException

public class SignatureException
extends Exception

This is the generic Signature exception.


 SignatureException Members

SignatureException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
SignatureException() | Constructs a SignatureException with no detail message.
SignatureException(String) | Constructs a SignatureException with the specified detail message.


 SignatureException.SignatureException

SignatureException.SignatureException

Syntax 1
public SignatureException()
Description
Constructs a SignatureException with no detail message. A detail message is a String that describes this particular exception.

Syntax 2
public SignatureException( String msg )
Parameters
msg
the detail message.
Description
Constructs a SignatureException with the specified detail message. A detail message is a String that describes this particular exception.


 Class Signer

Class java.security.Signer

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.security.Identity
           |
           +----java.security.Signer

public abstract class Signer
extends Identity

This class is used to represent an Identity that can also digitally sign data.

The management of a signer's private keys is an important and sensitive issue that should be handled by subclasses as appropriate to their intended use.

See Also:
Identity


 Signer Members

Signer Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Signer() | Creates a signer.
Signer(String) | Creates a signer with the specified identity name.
Signer(String, IdentityScope) | Creates a signer with the specified identity name and scope.

Methods
Name | Description
getPrivateKey() | Returns this signer's private key.
setKeyPair(KeyPair) | Sets the key pair (public key and private key) for this signer.
toString() | Returns a string of information about the signer.


 Signer.Signer

Signer.Signer

Syntax 1
protected Signer()
Description
Creates a signer. This constructor should only be used for serialization.

Syntax 2
public Signer( String name )
Parameters
name
the identity name.
Description
Creates a signer with the specified identity name.

Syntax 3
public Signer( String name, IdentityScope scope ) throws KeyManagementException
Parameters
name
the identity name.
scope
the scope of the identity.
Description
Creates a signer with the specified identity name and scope.

Exceptions
KeyManagementException if there is already an identity with the same name in the scope.


 Signer.getPrivateKey

Signer.getPrivateKey

Syntax
public PrivateKey getPrivateKey()
Returns
this signer's private key, or null if the private key has not yet been set.
Description
Returns this signer's private key.


 Signer.setKeyPair

Signer.setKeyPair

Syntax
public final void setKeyPair( KeyPair pair ) throws InvalidParameterException, KeyException
Parameters
pair
an initialized key pair.
Description
Sets the key pair (public key and private key) for this signer.

Exceptions
InvalidParameterException if the key pair is not properly initialized.
Exceptions
KeyException if the key pair cannot be set for any other reason.


 Signer.toString

Signer.toString

Syntax
public String toString()
Returns
a string of information about the signer.
Description
Returns a string of information about the signer.

Overrides
toString in class Identity


 Package java.security.acl

Package java.security.acl

All Packages

Interfaces

  • Acl
  • AclEntry
  • Group
  • Owner
  • Permission

    • Exceptions

  • AclNotFoundException
  • LastOwnerException
  • NotOwnerException


 Interface Acl

Interface java.security.acl.Acl

Interface Members | This Package | All Packages

public interface Acl
extends Owner

Interface representing an Access Control List (ACL). An Access Control List is a data structure used to guard access to resources.

An ACL can be thought of as a data structure with multiple ACL entries. Each ACL entry, of interface type AclEntry, contains a set of permissions associated with a particular principal. (A principal represents an entity such as an individual user or a group). Additionally, each ACL entry is specified as being either positive or negative. If positive, the permissions are to be granted to the associated principal. If negative, the permissions are to be denied.

The ACL Entries in each ACL observe the following rules:

  • Each principal can have at most one positive ACL entry and one negative entry; that is, multiple positive or negative ACL entries are not allowed for any principal. Each entry specifies the set of permissions that are to be granted (if positive) or denied (if negative).

  • If there is no entry for a particular principal, then the principal is considered to have a null (empty) permission set.

  • If there is a positive entry that grants a principal a particular permission, and a negative entry that denies the principal the same permission, the result is as though the permission was never granted or denied.

  • Individual permissions always override permissions of the group(s) to which the individual belongs. That is, individual negative permissions (specific denial of permissions) override the groups' positive permissions. And individual positive permissions override the groups' negative permissions.

The java.security.acl package provides the interfaces to the ACL and related data structures (ACL entries, groups, permissions, etc.), and the sun.security.acl classes provide a default implementation of the interfaces. For example, java.security.acl.Acl provides the interface to an ACL and the sun.security.acl.AclImpl class provides the default implementation of the interface.

The java.security.acl.Acl interface extends the java.security.acl.Owner interface. The Owner interface is used to maintain a list of owners for each ACL. Only owners are allowed to modify an ACL. For example, only an owner can call the ACL's addEntry method to add a new ACL entry to the ACL.

See Also:
AclEntry, Owner, getPermissions


 Acl Members

Acl Members

Interface Overview | This Package | All Packages

Methods
Name | Description
addEntry(Principal, AclEntry) | Adds an ACL entry to this ACL.
checkPermission(Principal, Permission) | Checks whether or not the specified principal has the specified permission.
entries() | Returns an enumeration of the entries in this ACL.
getName() | Returns the name of this ACL.
getPermissions(Principal) | Returns an enumeration for the set of allowed permissions for the specified principal (representing an entity such as an individual or a group).
removeEntry(Principal, AclEntry) | Removes an ACL entry from this ACL.
setName(Principal, String) | Sets the name of this ACL.
toString() | Returns a string representation of the ACL contents.


 Acl.addEntry

Acl.addEntry

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean addEntry( Principal caller, AclEntry entry ) throws NotOwnerException
Parameters
caller
the principal invoking this method. It must be an owner of this ACL.
entry
the ACL entry to be added to this ACL.
Returns
true on success, false if an entry of the same type (positive or negative) for the same principal is already present in this ACL.
Description
Adds an ACL entry to this ACL. An entry associates a principal (e.g., an individual or a group) with a set of permissions. Each principal can have at most one positive ACL entry (specifying permissions to be granted to the principal) and one negative ACL entry (specifying permissions to be denied). If there is already an ACL entry of the same type (negative or positive) already in the ACL, false is returned.

Exceptions
NotOwnerException if the caller principal is not an owner of this ACL.


 Acl.checkPermission

Acl.checkPermission

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean checkPermission( Principal principal, Permission permission )
Parameters
principal
the principal, assumed to be a valid authenticated Principal.
permission
the permission to be checked for.
Returns
true if the principal has the specified permission, false otherwise.
Description
Checks whether or not the specified principal has the specified permission. If it does, true is returned, otherwise false is returned. More specifically, this method checks whether the passed permission is a member of the allowed permission set of the specified principal. The allowed permission set is determined by the same algorithm as is used by the getPermissions method.

See Also
getPermissions


 Acl.entries

Acl.entries

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Enumeration entries()
Returns
an enumeration of the entries in this ACL.
Description
Returns an enumeration of the entries in this ACL. Each element in the enumeration is of type AclEntry.


 Acl.getName

Acl.getName

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getName()
Returns
the name of this ACL.
Description
Returns the name of this ACL.


 Acl.getPermissions

Acl.getPermissions

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Enumeration getPermissions( Principal user )
Parameters
user
the principal whose permission set is to be returned.
Returns
the permission set specifying the permissions the principal is allowed.
Description
Returns an enumeration for the set of allowed permissions for the specified principal (representing an entity such as an individual or a group). This set of allowed permissions is calculated as follows:

  • If there is no entry in this Access Control List for the specified principal, an empty permission set is returned.

  • Otherwise, the principal's group permission sets are determined. (A principal can belong to one or more groups, where a group is a group of principals, represented by the Group interface.) The group positive permission set is the union of all the positive permissions of each group that the principal belongs to. The group negative permission set is the union of all the negative permissions of each group that the principal belongs to. If there is a specific permission that occurs in both the positive permission set and the negative permission set, it is removed from both.

    The individual positive and negative permission sets are also determined. The positive permission set contains the permissions specified in the positive ACL entry (if any) for the principal. Similarly, the negative permission set contains the permissions specified in the negative ACL entry (if any) for the principal. The individual positive (or negative) permission set is considered to be null if there is not a positive (negative) ACL entry for the principal in this ACL.

    The set of permissions granted to the principal is then calculated using the simple rule that individual permissions always override the group permissions. That is, the principal's individual negative permission set (specific denial of permissions) overrides the group positive permission set, and the principal's individual positive permission set overrides the group negative permission set.


 Acl.removeEntry

Acl.removeEntry

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean removeEntry( Principal caller, AclEntry entry ) throws NotOwnerException
Parameters
caller
the principal invoking this method. It must be an owner of this ACL.
entry
the ACL entry to be removed from this ACL.
Returns
true on success, false if the entry is not part of this ACL.
Description
Removes an ACL entry from this ACL.

Exceptions
NotOwnerException if the caller principal is not an owner of this Acl.


 Acl.setName

Acl.setName

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setName( Principal caller, String name ) throws NotOwnerException
Parameters
caller
the principal invoking this method. It must be an owner of this ACL.
name
the name to be given to this ACL.
Description
Sets the name of this ACL.

Exceptions
NotOwnerException if the caller principal is not an owner of this ACL.


 Acl.toString

Acl.toString

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String toString()
Returns
a string representation of the ACL contents.
Description
Returns a string representation of the ACL contents.

Overrides
toString in class Object


 Interface AclEntry

Interface java.security.acl.AclEntry

Interface Members | This Package | All Packages

public interface AclEntry
extends Cloneable

This is the interface used for representing one entry in an Access Control List (ACL).

An ACL can be thought of as a data structure with multiple ACL entry objects. Each ACL entry object contains a set of permissions associated with a particular principal. (A principal represents an entity such as an individual user or a group). Additionally, each ACL entry is specified as being either positive or negative. If positive, the permissions are to be granted to the associated principal. If negative, the permissions are to be denied. Each principal can have at most one positive ACL entry and one negative entry; that is, multiple positive or negative ACL entries are not allowed for any principal. Note: ACL entries are by default positive. An entry becomes a negative entry only if the setNegativePermissions method is called on it.

See Also:
Acl


 AclEntry Members

AclEntry Members

Interface Overview | This Package | All Packages

Methods
Name | Description
addPermission(Permission) | Adds the specified permission to this ACL entry.
checkPermission(Permission) | Checks if the specified permission is part of the permission set in this entry.
clone() | Clones this ACL entry.
getPrincipal() | Returns the principal for which permissions are granted or denied by this ACL entry.
isNegative() | Returns true if this is a negative ACL entry (one denying the associated principal the set of permissions in the entry), false otherwise.
permissions() | Returns an enumeration of the permissions in this ACL entry.
removePermission(Permission) | Removes the specified permission from this ACL entry.
setNegativePermissions() | Sets this ACL entry to be a negative one.
setPrincipal(Principal) | Specifies the principal for which permissions are granted or denied by this ACL entry.
toString() | Returns a string representation of the contents of this ACL entry.


 AclEntry.addPermission

AclEntry.addPermission

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean addPermission( Permission permission )
Parameters
permission
the permission to be associated with the principal in this entry.
Returns
true if the permission was added, false if the permission was already part of this entry's permission set.
Description
Adds the specified permission to this ACL entry. Note: An entry can have multiple permissions.


 AclEntry.checkPermission

AclEntry.checkPermission

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean checkPermission( Permission permission )
Parameters
permission
the permission to be checked for.
Returns
true if the permission is part of the permission set in this entry, false otherwise.
Description
Checks if the specified permission is part of the permission set in this entry.


 AclEntry.clone

AclEntry.clone

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Object clone()
Returns
a clone of this ACL entry.
Description
Clones this ACL entry.

Overrides
clone in class Object


 AclEntry.getPrincipal

AclEntry.getPrincipal

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Principal getPrincipal()
Returns
the principal associated with this entry.
Description
Returns the principal for which permissions are granted or denied by this ACL entry. Returns null if there is no principal set for this entry yet.


 AclEntry.isNegative

AclEntry.isNegative

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isNegative()
Returns
true if this is a negative ACL entry, false if it's not.
Description
Returns true if this is a negative ACL entry (one denying the associated principal the set of permissions in the entry), false otherwise.


 AclEntry.permissions

AclEntry.permissions

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Enumeration permissions()
Returns
an enumeration of the permissions in this ACL entry.
Description
Returns an enumeration of the permissions in this ACL entry.


 AclEntry.removePermission

AclEntry.removePermission

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean removePermission( Permission permission )
Parameters
permission
the permission to be removed from this entry.
Returns
true if the permission is removed, false if the permission was not part of this entry's permission set.
Description
Removes the specified permission from this ACL entry.


 AclEntry.setNegativePermissions

AclEntry.setNegativePermissions

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setNegativePermissions()
Description
Sets this ACL entry to be a negative one. That is, the associated principal (e.g., a user or a group) will be denied the permission set specified in the entry. Note: ACL entries are by default positive. An entry becomes a negative entry only if this setNegativePermissions method is called on it.


 AclEntry.setPrincipal

AclEntry.setPrincipal

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean setPrincipal( Principal user )
Parameters
user
the principal to be set for this entry.
Returns
true if the principal is set, false if there was already a principal set for this entry.
Description
Specifies the principal for which permissions are granted or denied by this ACL entry. If a principal was already set for this ACL entry, false is returned, otherwise true is returned.


 AclEntry.toString

AclEntry.toString

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String toString()
Returns
a string representation of the contents.
Description
Returns a string representation of the contents of this ACL entry.

Overrides
toString in class Object


 Class AclNotFoundException

Class java.security.acl.AclNotFoundException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.security.acl.AclNotFoundException

public class AclNotFoundException
extends Exception

This is an exception that is thrown whenever a reference is made to a non-existent ACL (Access Control List).


 AclNotFoundException Members

AclNotFoundException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
AclNotFoundException() | Constructs an AclNotFoundException.


 AclNotFoundException.AclNotFoundException

AclNotFoundException.AclNotFoundException

Syntax
public AclNotFoundException()
Description
Constructs an AclNotFoundException.


 Interface Group

Interface java.security.acl.Group

Interface Members | This Package | All Packages

public interface Group
extends Principal

This interface is used to represent a group of principals. (A principal represents an entity such as an individual user or a company).

Note that Group extends Principal. Thus, either a Principal or a Group can be passed as an argument to methods containing a Principal parameter. For example, you can add either a Principal or a Group to a Group object by calling the object's addMember method, passing it the Principal or Group.


 Group Members

Group Members

Interface Overview | This Package | All Packages

Methods
Name | Description
addMember(Principal) | Adds the specified member to the group.
isMember(Principal) | Returns true if the passed principal is a member of the group.
members() | Returns an enumeration of the members in the group.
removeMember(Principal) | Removes the specified member from the group.


 Group.addMember

Group.addMember

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean addMember( Principal user )
Parameters
user
the principal to add to this group.
Returns
true if the member was successfully added, false if the principal was already a member.
Description
Adds the specified member to the group.


 Group.isMember

Group.isMember

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isMember( Principal member )
Parameters
member
the principal whose membership is to be checked.
Returns
true if the principal is a member of this group, false otherwise.
Description
Returns true if the passed principal is a member of the group. This method does a recursive search, so if a principal belongs to a group which is a member of this group, true is returned.


 Group.members

Group.members

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Enumeration members()
Returns
an enumeration of the group members.
Description
Returns an enumeration of the members in the group. The returned objects can be instances of either Principal or Group (which is a subclass of Principal).


 Group.removeMember

Group.removeMember

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean removeMember( Principal user )
Parameters
user
the principal to remove from this group.
Returns
true if the principal was removed, or false if the principal was not a member.
Description
Removes the specified member from the group.


 Class LastOwnerException

Class java.security.acl.LastOwnerException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.security.acl.LastOwnerException

public class LastOwnerException
extends Exception

This is an exception that is thrown whenever an attempt is made to delete the last owner of an Access Control List.

See Also:
deleteOwner


 LastOwnerException Members

LastOwnerException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
LastOwnerException() | Constructs a LastOwnerException.


 LastOwnerException.LastOwnerException

LastOwnerException.LastOwnerException

Syntax
public LastOwnerException()
Description
Constructs a LastOwnerException.


 Class NotOwnerException

Class java.security.acl.NotOwnerException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.security.acl.NotOwnerException

public class NotOwnerException
extends Exception

This is an exception that is thrown whenever the modification of an object (such as an Access Control List) is only allowed to be done by an owner of the object, but the Principal attempting the modification is not an owner.


 NotOwnerException Members

NotOwnerException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
NotOwnerException() | Constructs a NotOwnerException.


 NotOwnerException.NotOwnerException

NotOwnerException.NotOwnerException

Syntax
public NotOwnerException()
Description
Constructs a NotOwnerException.


 Interface Owner

Interface java.security.acl.Owner

Interface Members | This Package | All Packages

public interface Owner

Interface for managing owners of Access Control Lists (ACLs) or ACL configurations. (Note that the Acl interface in the java.security.acl package extends this Owner interface.) The initial owner Principal should be specified as an argument to the constructor of the class implementing this interface.

See Also:
Acl


 Owner Members

Owner Members

Interface Overview | This Package | All Packages

Methods
Name | Description
addOwner(Principal, Principal) | Adds an owner.
deleteOwner(Principal, Principal) | Deletes an owner.
isOwner(Principal) | Returns true if the given principal is an owner of the ACL.


 Owner.addOwner

Owner.addOwner

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean addOwner( Principal caller, Principal owner ) throws NotOwnerException
Parameters
caller
the principal invoking this method. It must be an owner of the ACL.
owner
the owner that should be added to the list of owners.
Returns
true if successful, false if owner is already an owner.
Description
Adds an owner. Only owners can modify ACL contents. The caller principal must be an owner of the ACL in order to invoke this method. That is, only an owner can add another owner. The initial owner is configured at ACL construction time.

Exceptions
NotOwnerException if the caller principal is not an owner of the ACL.


 Owner.deleteOwner

Owner.deleteOwner

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean deleteOwner( Principal caller, Principal owner ) throws NotOwnerException, LastOwnerException
Parameters
caller
the principal invoking this method. It must be an owner of the ACL.
owner
the owner to be removed from the list of owners.
Returns
true if the owner is removed, false if the owner is not part of the list of owners.
Description
Deletes an owner. If this is the last owner in the ACL, an exception is raised.

The caller principal must be an owner of the ACL in order to invoke this method.

Exceptions
NotOwnerException if the caller principal is not an owner of the ACL.
Exceptions
LastOwnerException if there is only one owner left, so that deleteOwner would leave the ACL owner-less.


 Owner.isOwner

Owner.isOwner

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isOwner( Principal owner )
Parameters
owner
the principal to be checked to determine whether or not it is an owner.
Returns
true if the passed principal is in the list of owners, false if not.
Description
Returns true if the given principal is an owner of the ACL.


 Interface Permission

Interface java.security.acl.Permission

Interface Members | This Package | All Packages

public interface Permission

This interface represents a permission, such as that used to grant a particular type of access to a resource.


 Permission Members

Permission Members

Interface Overview | This Package | All Packages

Methods
Name | Description
equals(Object) | Returns true if the object passed matches the permission represented in this interface.
toString() | Prints a string representation of this permission.


 Permission.equals

Permission.equals

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean equals( Object another )
Parameters
another
the Permission object to compare with.
Returns
true if the Permission objects are equal, false otherwise
Description
Returns true if the object passed matches the permission represented in this interface.

Overrides
equals in class Object


 Permission.toString

Permission.toString

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String toString()
Returns
the string representation of the permission.
Description
Prints a string representation of this permission.

Overrides
toString in class Object


 Package java.security.interfaces

Package java.security.interfaces

All Packages

Interfaces

  • DSAKey
  • DSAKeyPairGenerator
  • DSAParams
  • DSAPrivateKey
  • DSAPublicKey


 Interface DSAKey

Interface java.security.interfaces.DSAKey

Interface Members | This Package | All Packages

public interface DSAKey

The interface to a DSA public or private key. DSA (Digital Signature Algorithm) is defined in NIST's FIPS-186.

See Also:
DSAParams, Key, Signature


 DSAKey Members

DSAKey Members

Interface Overview | This Package | All Packages

Methods
Name | Description
getParams() | Returns the DSA-specific key parameters.


 DSAKey.getParams

DSAKey.getParams

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract DSAParams getParams()
Returns
the DSA-specific key parameters.
Description
Returns the DSA-specific key parameters. These parameters are never secret.

See Also
DSAParams


 Interface DSAKeyPairGenerator

Interface java.security.interfaces.DSAKeyPairGenerator

Interface Members | This Package | All Packages

public interface DSAKeyPairGenerator

An interface to an object capable of generating DSA key pairs.

The initialize methods may each be called any number of times. If no initialize method is called on a DSAKeyPairGenerator, the default is to generate 1024-bit keys, using precomputed p, q and g parameters and an instance of SecureRandom as the random bit source.

Users wishing to indicate DSA-specific parameters, and to generate a key pair suitable for use with the DSA algorithm typically

  1. Get a key pair generator for the DSA algorithm by calling the KeyPairGenerator getInstance method with "DSA" as its argument.

  2. Initialize the generator by casting the result to a DSAKeyPairGenerator and calling one of the initialize methods from this DSAKeyPairGenerator interface.

  3. Generate a key pair by calling the generateKeyPair method from the KeyPairGenerator class.

Note: it is not always necessary to do do algorithm-specific initialization for a DSA key pair generator. That is, it is not always necessary to call an initialize method in this interface. Algorithm-independent initialization using the initialize method in the KeyPairGenerator interface is all that is needed when you accept defaults for algorithm-specific parameters.

See Also:
KeyPairGenerator


 DSAKeyPairGenerator Members

DSAKeyPairGenerator Members

Interface Overview | This Package | All Packages

Methods
Name | Description
initialize(DSAParams, SecureRandom) | Initializes the key pair generator using p, q and g, the DSA family parameters.
initialize(int, boolean, SecureRandom) | Initializes the key pair generator for a given modulus length, without parameters.


 DSAKeyPairGenerator.initialize

DSAKeyPairGenerator.initialize

Interface Overview | Interface Members | This Package | All Packages

Syntax 1
public abstract void initialize( DSAParams params, SecureRandom random ) throws InvalidParameterException
Parameters
params
the parameters to use to generate the keys.
random
the random bit source to use to generate key bits.
Description
Initializes the key pair generator using p, q and g, the DSA family parameters.

Exceptions
InvalidParameterException if the parameters passed are invalid or null.

Syntax 2
public abstract void initialize( int modlen, boolean genParams, SecureRandom random ) throws InvalidParameterException
Parameters
modlen
the modulus length, in bits. Valid values are any multiple of 8 between 512 and 1024, inclusive.
random
the random bit source to use to generate key bits.
genParams
whether or not to generate new parameters for the modulus length requested.
Description
Initializes the key pair generator for a given modulus length, without parameters.

If genParams is true, this method will generate new p, q and g parameters. If it is false, the method will use precomputed parameters for the modulus length requested. If there are no precomputed parameters for that modulus length, an exception will be thrown. It is guaranteed that there will always be default parameters for modulus lengths of 512 and 1024 bits.

Exceptions
InvalidParameterException if the modulus length is not between 512 and 1024, or if genParams is false and there are not precomputed parameters for the modulus length requested.


 Interface DSAParams

Interface java.security.interfaces.DSAParams

Interface Members | This Package | All Packages

public interface DSAParams

Interface to a DSA-specific set of key parameters, which defines a DSA key family. DSA (Digital Signature Algorithm) is defined in NIST's FIPS-186.

See Also:
DSAKey, Key, Signature


 DSAParams Members

DSAParams Members

Interface Overview | This Package | All Packages

Methods
Name | Description
getG() | Returns the base, g.
getP() | Returns the prime, p.
getQ() | Returns the subprime, q.


 DSAParams.getG

DSAParams.getG

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract BigInteger getG()
Returns
the base, g.
Description
Returns the base, g.


 DSAParams.getP

DSAParams.getP

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract BigInteger getP()
Returns
the prime, p.
Description
Returns the prime, p.


 DSAParams.getQ

DSAParams.getQ

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract BigInteger getQ()
Returns
the subprime, q.
Description
Returns the subprime, q.


 Interface DSAPrivateKey

Interface java.security.interfaces.DSAPrivateKey

Interface Members | This Package | All Packages

public interface DSAPrivateKey
extends DSAKey, PrivateKey

The standard interface to a DSA private key. DSA (Digital Signature Algorithm) is defined in NIST's FIPS-186.

See Also:
Key, Signature, DSAKey, DSAPublicKey


 DSAPrivateKey Members

DSAPrivateKey Members

Interface Overview | This Package | All Packages

Methods
Name | Description
getX() | Returns the value of the private key, x.


 DSAPrivateKey.getX

DSAPrivateKey.getX

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract BigInteger getX()
Returns
the value of the private key, x.
Description
Returns the value of the private key, x.


 Interface DSAPublicKey

Interface java.security.interfaces.DSAPublicKey

Interface Members | This Package | All Packages

public interface DSAPublicKey
extends DSAKey, PublicKey

The interface to a DSA public key. DSA (Digital Signature Algorithm) is defined in NIST's FIPS-186.

See Also:
Key, KeyParams, Signature


 DSAPublicKey Members

DSAPublicKey Members

Interface Overview | This Package | All Packages

Methods
Name | Description
getY() | Returns the value of the public key, y.


 DSAPublicKey.getY

DSAPublicKey.getY

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract BigInteger getY()
Returns
the value of the public key, y.
Description
Returns the value of the public key, y.


 Package java.sql

Package java.sql

All Packages

Interfaces

  • CallableStatement
  • Connection
  • DatabaseMetaData
  • Driver
  • PreparedStatement
  • ResultSet
  • ResultSetMetaData
  • Statement

    • Classes

  • Date
  • DriverManager
  • DriverPropertyInfo
  • Time
  • Timestamp
  • Types

    • Exceptions

  • DataTruncation
  • SQLException
  • SQLWarning


 Interface CallableStatement

Interface java.sql.CallableStatement

Interface Members | This Package | All Packages

public interface CallableStatement
extends PreparedStatement

CallableStatement is used to execute SQL stored procedures.

JDBC provides a stored procedure SQL escape that allows stored procedures to be called in a standard way for all RDBMS's. This escape syntax has one form that includes a result parameter and one that does not. If used, the result parameter must be registered as an OUT parameter. The other parameters may be used for input, output or both. Parameters are refered to sequentially, by number. The first parameter is 1.

{?= call [,, ...]}
{call [,, ...]}

IN parameter values are set using the set methods inherited from PreparedStatement. The type of all OUT parameters must be registered prior to executing the stored procedure; their values are retrieved after execution via the get methods provided here.

A Callable statement may return a ResultSet or multiple ResultSets. Multiple ResultSets are handled using operations inherited from Statement.

For maximum portability, a call's ResultSets and update counts should be processed prior to getting the values of output parameters.

See Also:
prepareCall, ResultSet


 CallableStatement Members

CallableStatement Members

Interface Overview | This Package | All Packages

Methods
Name | Description
getBigDecimal(int, int) | Get the value of a NUMERIC parameter as a java.math.BigDecimal object.
getBoolean(int) | Get the value of a BIT parameter as a Java boolean.
getByte(int) | Get the value of a TINYINT parameter as a Java byte.
getBytes(int) | Get the value of a SQL BINARY or VARBINARY parameter as a Java byte[]
getDate(int) | Get the value of a SQL DATE parameter as a java.sql.Date object
getDouble(int) | Get the value of a DOUBLE parameter as a Java double.
getFloat(int) | Get the value of a FLOAT parameter as a Java float.
getInt(int) | Get the value of an INTEGER parameter as a Java int.
getLong(int) | Get the value of a BIGINT parameter as a Java long.
getObject(int) | Get the value of a parameter as a Java object.
getShort(int) | Get the value of a SMALLINT parameter as a Java short.
getString(int) | Get the value of a CHAR, VARCHAR, or LONGVARCHAR parameter as a Java String.
getTime(int) | Get the value of a SQL TIME parameter as a java.sql.Time object.
getTimestamp(int) | Get the value of a SQL TIMESTAMP parameter as a java.sql.Timestamp object.
registerOutParameter(int, int) | Before executing a stored procedure call, you must explicitly call registerOutParameter to register the java.sql.Type of each out parameter.
registerOutParameter(int, int, int) | Use this version of registerOutParameter for registering Numeric or Decimal out parameters.
wasNull() | An OUT parameter may have the value of SQL NULL; wasNull reports whether the last value read has this special value.


 CallableStatement.getBigDecimal

CallableStatement.getBigDecimal

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract BigDecimal getBigDecimal( int parameterIndex, int scale ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
scale
a value greater than or equal to zero representing the desired number of digits to the right of the decimal point
Returns
the parameter value; if the value is SQL NULL, the result is null
Description
Get the value of a NUMERIC parameter as a java.math.BigDecimal object.

Exceptions
SQLException if a database-access error occurs.


 CallableStatement.getBoolean

CallableStatement.getBoolean

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean getBoolean( int parameterIndex ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
Returns
the parameter value; if the value is SQL NULL, the result is false
Description
Get the value of a BIT parameter as a Java boolean.

Exceptions
SQLException if a database-access error occurs.


 CallableStatement.getByte

CallableStatement.getByte

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract byte getByte( int parameterIndex ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
Returns
the parameter value; if the value is SQL NULL, the result is 0
Description
Get the value of a TINYINT parameter as a Java byte.

Exceptions
SQLException if a database-access error occurs.


 CallableStatement.getBytes

CallableStatement.getBytes

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract byte[] getBytes( int parameterIndex ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
Returns
the parameter value; if the value is SQL NULL, the result is null
Description
Get the value of a SQL BINARY or VARBINARY parameter as a Java byte[]

Exceptions
SQLException if a database-access error occurs.


 CallableStatement.getDate

CallableStatement.getDate

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Date getDate( int parameterIndex ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
Returns
the parameter value; if the value is SQL NULL, the result is null
Description
Get the value of a SQL DATE parameter as a java.sql.Date object

Exceptions
SQLException if a database-access error occurs.


 CallableStatement.getDouble

CallableStatement.getDouble

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract double getDouble( int parameterIndex ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
Returns
the parameter value; if the value is SQL NULL, the result is 0
Description
Get the value of a DOUBLE parameter as a Java double.

Exceptions
SQLException if a database-access error occurs.


 CallableStatement.getFloat

CallableStatement.getFloat

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract float getFloat( int parameterIndex ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
Returns
the parameter value; if the value is SQL NULL, the result is 0
Description
Get the value of a FLOAT parameter as a Java float.

Exceptions
SQLException if a database-access error occurs.


 CallableStatement.getInt

CallableStatement.getInt

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getInt( int parameterIndex ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
Returns
the parameter value; if the value is SQL NULL, the result is 0
Description
Get the value of an INTEGER parameter as a Java int.

Exceptions
SQLException if a database-access error occurs.


 CallableStatement.getLong

CallableStatement.getLong

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract long getLong( int parameterIndex ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
Returns
the parameter value; if the value is SQL NULL, the result is 0
Description
Get the value of a BIGINT parameter as a Java long.

Exceptions
SQLException if a database-access error occurs.


 CallableStatement.getObject

CallableStatement.getObject

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Object getObject( int parameterIndex ) throws SQLException
Parameters
parameterIndex
The first parameter is 1, the second is 2, ...
Returns
A java.lang.Object holding the OUT parameter value.
Description
Get the value of a parameter as a Java object.

This method returns a Java object whose type coresponds to the SQL type that was registered for this parameter using registerOutParameter.

Note that this method may be used to read datatabase-specific, abstract data types. This is done by specifying a targetSqlType of java.sql.types.OTHER, which allows the driver to return a database-specific Java type.

Exceptions
SQLException if a database-access error occurs.
See Also
Types


 CallableStatement.getShort

CallableStatement.getShort

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract short getShort( int parameterIndex ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
Returns
the parameter value; if the value is SQL NULL, the result is 0
Description
Get the value of a SMALLINT parameter as a Java short.

Exceptions
SQLException if a database-access error occurs.


 CallableStatement.getString

CallableStatement.getString

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getString( int parameterIndex ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
Returns
the parameter value; if the value is SQL NULL, the result is null
Description
Get the value of a CHAR, VARCHAR, or LONGVARCHAR parameter as a Java String.

Exceptions
SQLException if a database-access error occurs.


 CallableStatement.getTime

CallableStatement.getTime

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Time getTime( int parameterIndex ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
Returns
the parameter value; if the value is SQL NULL, the result is null
Description
Get the value of a SQL TIME parameter as a java.sql.Time object.

Exceptions
SQLException if a database-access error occurs.


 CallableStatement.getTimestamp

CallableStatement.getTimestamp

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Timestamp getTimestamp( int parameterIndex ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
Returns
the parameter value; if the value is SQL NULL, the result is null
Description
Get the value of a SQL TIMESTAMP parameter as a java.sql.Timestamp object.

Exceptions
SQLException if a database-access error occurs.


 CallableStatement.registerOutParameter

CallableStatement.registerOutParameter

Interface Overview | Interface Members | This Package | All Packages

Syntax 1
public abstract void registerOutParameter( int parameterIndex, int sqlType ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2,...
sqlType
SQL type code defined by java.sql.Types; for parameters of type Numeric or Decimal use the version of registerOutParameter that accepts a scale value
Description
Before executing a stored procedure call, you must explicitly call registerOutParameter to register the java.sql.Type of each out parameter.

Note: When reading the value of an out parameter, you must use the getXXX method whose Java type XXX corresponds to the parameter's registered SQL type.

Exceptions
SQLException if a database-access error occurs.
See Also
Type

Syntax 2
public abstract void registerOutParameter( int parameterIndex, int sqlType, int scale ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
sqlType
use either java.sql.Type.NUMERIC or java.sql.Type.DECIMAL
scale
a value greater than or equal to zero representing the desired number of digits to the right of the decimal point
Description
Use this version of registerOutParameter for registering Numeric or Decimal out parameters.

Note: When reading the value of an out parameter, you must use the getXXX method whose Java type XXX corresponds to the parameter's registered SQL type.

Exceptions
SQLException if a database-access error occurs.
See Also
Type


 CallableStatement.wasNull

CallableStatement.wasNull

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean wasNull() throws SQLException
Returns
true if the last parameter read was SQL NULL
Description
An OUT parameter may have the value of SQL NULL; wasNull reports whether the last value read has this special value.

Note: You must first call getXXX on a parameter to read its value and then call wasNull() to see if the value was SQL NULL.

Exceptions
SQLException if a database-access error occurs.


 Interface Connection

Interface java.sql.Connection

Interface Members | This Package | All Packages

public interface Connection

A Connection represents a session with a specific database. Within the context of a Connection, SQL statements are executed and results are returned.

A Connection's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, etc. This information is obtained with the getMetaData method.

Note: By default the Connection automatically commits changes after executing each statement. If auto commit has been disabled, an explicit commit must be done or database changes will not be saved.

See Also:
getConnection, Statement, ResultSet, DatabaseMetaData


 Connection Members

Connection Members

Interface Overview | This Package | All Packages

Fields
Name | Description
TRANSACTION_NONE | Transactions are not supported.
TRANSACTION_READ_COMMITTED | Dirty reads are prevented; non-repeatable reads and phantom reads can occur.
TRANSACTION_READ_UNCOMMITTED | Dirty reads, non-repeatable reads and phantom reads can occur.
TRANSACTION_REPEATABLE_READ | Dirty reads and non-repeatable reads are prevented; phantom reads can occur.
TRANSACTION_SERIALIZABLE | Dirty reads, non-repeatable reads and phantom reads are prevented.

Methods
Name | Description
clearWarnings() | After this call, getWarnings returns null until a new warning is reported for this Connection.
close() | In some cases, it is desirable to immediately release a Connection's database and JDBC resources instead of waiting for them to be automatically released; the close method provides this immediate release.
commit() | Commit makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection.
createStatement() | SQL statements without parameters are normally executed using Statement objects.
getAutoCommit() | Get the current auto-commit state.
getCatalog() | Return the Connection's current catalog name.
getMetaData() | A Connection's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, etc.
getTransactionIsolation() | Get this Connection's current transaction isolation mode.
getWarnings() | The first warning reported by calls on this Connection is returned.
isClosed() | Tests to see if a Connection is closed.
isReadOnly() | Tests to see if the connection is in read-only mode.
nativeSQL(String) | A driver may convert the JDBC sql grammar into its system's native SQL grammar prior to sending it; nativeSQL returns the native form of the statement that the driver would have sent.
prepareCall(String) | A SQL stored procedure call statement is handled by creating a CallableStatement for it.
prepareStatement(String) | A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object.
rollback() | Rollback drops all changes made since the previous commit/rollback and releases any database locks currently held by the Connection.
setAutoCommit(boolean) | If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions.
setCatalog(String) | A sub-space of this Connection's database may be selected by setting a catalog name.
setReadOnly(boolean) | You can put a connection in read-only mode as a hint to enable database optimizations.
setTransactionIsolation(int) | You can call this method to try to change the transaction isolation level using one of the TRANSACTION_* values.


 Connection.TRANSACTION_NONE

Connection.TRANSACTION_NONE

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int TRANSACTION_NONE
Description
Transactions are not supported.


 Connection.TRANSACTION_READ_COMMITTED

Connection.TRANSACTION_READ_COMMITTED

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int TRANSACTION_READ_COMMITTED
Description
Dirty reads are prevented; non-repeatable reads and phantom reads can occur.


 Connection.TRANSACTION_READ_UNCOMMITTED

Connection.TRANSACTION_READ_UNCOMMITTED

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int TRANSACTION_READ_UNCOMMITTED
Description
Dirty reads, non-repeatable reads and phantom reads can occur.


 Connection.TRANSACTION_REPEATABLE_READ

Connection.TRANSACTION_REPEATABLE_READ

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int TRANSACTION_REPEATABLE_READ
Description
Dirty reads and non-repeatable reads are prevented; phantom reads can occur.


 Connection.TRANSACTION_SERIALIZABLE

Connection.TRANSACTION_SERIALIZABLE

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int TRANSACTION_SERIALIZABLE
Description
Dirty reads, non-repeatable reads and phantom reads are prevented.


 Connection.clearWarnings

Connection.clearWarnings

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void clearWarnings() throws SQLException
Description
After this call, getWarnings returns null until a new warning is reported for this Connection.

Exceptions
SQLException if a database-access error occurs.


 Connection.close

Connection.close

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void close() throws SQLException
Description
In some cases, it is desirable to immediately release a Connection's database and JDBC resources instead of waiting for them to be automatically released; the close method provides this immediate release.

Note: A Connection is automatically closed when it is garbage collected. Certain fatal errors also result in a closed Connection.

Exceptions
SQLException if a database-access error occurs.


 Connection.commit

Connection.commit

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void commit() throws SQLException
Description
Commit makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection. This method should only be used when auto commit has been disabled.

Exceptions
SQLException if a database-access error occurs.
See Also
setAutoCommit


 Connection.createStatement

Connection.createStatement

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Statement createStatement() throws SQLException
Returns
a new Statement object
Description
SQL statements without parameters are normally executed using Statement objects. If the same SQL statement is executed many times, it is more efficient to use a PreparedStatement

Exceptions
SQLException if a database-access error occurs.


 Connection.getAutoCommit

Connection.getAutoCommit

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean getAutoCommit() throws SQLException
Returns
Current state of auto-commit mode.
Description
Get the current auto-commit state.

Exceptions
SQLException if a database-access error occurs.
See Also
setAutoCommit


 Connection.getCatalog

Connection.getCatalog

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getCatalog() throws SQLException
Returns
the current catalog name or null
Description
Return the Connection's current catalog name.

Exceptions
SQLException if a database-access error occurs.


 Connection.getMetaData

Connection.getMetaData

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract DatabaseMetaData getMetaData() throws SQLException
Returns
a DatabaseMetaData object for this Connection
Description
A Connection's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, etc. This information is made available through a DatabaseMetaData object.

Exceptions
SQLException if a database-access error occurs.


 Connection.getTransactionIsolation

Connection.getTransactionIsolation

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getTransactionIsolation() throws SQLException
Returns
the current TRANSACTION_* mode value
Description
Get this Connection's current transaction isolation mode.

Exceptions
SQLException if a database-access error occurs.


 Connection.getWarnings

Connection.getWarnings

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract SQLWarning getWarnings() throws SQLException
Returns
the first SQLWarning or null
Description
The first warning reported by calls on this Connection is returned.

Note: Subsequent warnings will be chained to this SQLWarning.

Exceptions
SQLException if a database-access error occurs.


 Connection.isClosed

Connection.isClosed

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isClosed() throws SQLException
Returns
true if the connection is closed; false if it's still open
Description
Tests to see if a Connection is closed.

Exceptions
SQLException if a database-access error occurs.


 Connection.isReadOnly

Connection.isReadOnly

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isReadOnly() throws SQLException
Returns
true if connection is read-only
Description
Tests to see if the connection is in read-only mode.

Exceptions
SQLException if a database-access error occurs.


 Connection.nativeSQL

Connection.nativeSQL

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String nativeSQL( String sql ) throws SQLException
Parameters
sql
a SQL statement that may contain one or more '?' parameter placeholders
Returns
the native form of this statement
Description
A driver may convert the JDBC sql grammar into its system's native SQL grammar prior to sending it; nativeSQL returns the native form of the statement that the driver would have sent.

Exceptions
SQLException if a database-access error occurs.


 Connection.prepareCall

Connection.prepareCall

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract CallableStatement prepareCall( String sql ) throws SQLException
Parameters
sql
a SQL statement that may contain one or more '?' parameter placeholders. Typically this statement is a JDBC function call escape string.
Returns
a new CallableStatement object containing the pre-compiled SQL statement
Description
A SQL stored procedure call statement is handled by creating a CallableStatement for it. The CallableStatement provides methods for setting up its IN and OUT parameters, and methods for executing it.

Note: This method is optimized for handling stored procedure call statements. Some drivers may send the call statement to the database when the prepareCall is done; others may wait until the CallableStatement is executed. This has no direct affect on users; however, it does affect which method throws certain SQLExceptions.

Exceptions
SQLException if a database-access error occurs.


 Connection.prepareStatement

Connection.prepareStatement

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract PreparedStatement prepareStatement( String sql ) throws SQLException
Parameters
sql
a SQL statement that may contain one or more '?' IN parameter placeholders
Returns
a new PreparedStatement object containing the pre-compiled statement
Description
A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.

Note: This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports precompilation, prepareStatement will send the statement to the database for precompilation. Some drivers may not support precompilation. In this case, the statement may not be sent to the database until the PreparedStatement is executed. This has no direct affect on users; however, it does affect which method throws certain SQLExceptions.

Exceptions
SQLException if a database-access error occurs.


 Connection.rollback

Connection.rollback

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void rollback() throws SQLException
Description
Rollback drops all changes made since the previous commit/rollback and releases any database locks currently held by the Connection. This method should only be used when auto commit has been disabled.

Exceptions
SQLException if a database-access error occurs.
See Also
setAutoCommit


 Connection.setAutoCommit

Connection.setAutoCommit

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setAutoCommit( boolean autoCommit ) throws SQLException
Parameters
autoCommit
true enables auto-commit; false disables auto-commit.
Description
If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by either commit() or rollback(). By default, new connections are in auto-commit mode. The commit occurs when the statement completes or the next execute occurs, whichever comes first. In the case of statements returning a ResultSet, the statement completes when the last row of the ResultSet has been retrieved or the ResultSet has been closed. In advanced cases, a single statement may return multiple results as well as output parameter values. Here the commit occurs when all results and output param values have been retrieved.

Exceptions
SQLException if a database-access error occurs.


 Connection.setCatalog

Connection.setCatalog

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setCatalog( String catalog ) throws SQLException
Description
A sub-space of this Connection's database may be selected by setting a catalog name. If the driver does not support catalogs it will silently ignore this request.

Exceptions
SQLException if a database-access error occurs.


 Connection.setReadOnly

Connection.setReadOnly

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setReadOnly( boolean readOnly ) throws SQLException
Parameters
readOnly
true enables read-only mode; false disables read-only mode.
Description
You can put a connection in read-only mode as a hint to enable database optimizations.

Note: setReadOnly cannot be called while in the middle of a transaction.

Exceptions
SQLException if a database-access error occurs.


 Connection.setTransactionIsolation

Connection.setTransactionIsolation

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setTransactionIsolation( int level ) throws SQLException
Parameters
level
one of the TRANSACTION_* isolation values with the exception of TRANSACTION_NONE; some databases may not support other values
Description
You can call this method to try to change the transaction isolation level using one of the TRANSACTION_* values.

Note: setTransactionIsolation cannot be called while in the middle of a transaction.

Exceptions
SQLException if a database-access error occurs.
See Also
supportsTransactionIsolationLevel


 Class DataTruncation

Class java.sql.DataTruncation

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.sql.SQLException
                           |
                           +----java.sql.SQLWarning
                                   |
                                   +----java.sql.DataTruncation

public class DataTruncation
extends SQLWarning

When JDBC unexpectedly truncates a data value, it reports a DataTruncation warning (on reads) or throws a DataTruncation exception (on writes).

The SQLstate for a DataTruncation is "01004".


 DataTruncation Members

DataTruncation Members

Class Overview | This Package | All Packages

Constructors
Name | Description
DataTruncation(int, boolean, boolean, int, int) | Create a DataTruncation object.

Methods
Name | Description
getDataSize() | Get the number of bytes of data that should have been transferred.
getIndex() | Get the index of the column or parameter that was truncated.
getParameter() | Is this a truncated parameter value?
getRead() | Was this a read truncation?
getTransferSize() | Get the number of bytes of data actually transferred.


 DataTruncation.DataTruncation

DataTruncation.DataTruncation

Syntax
public DataTruncation( int index, boolean parameter, boolean read, int dataSize, int transferSize )
Parameters
index
The index of the parameter or column value
parameter
true if a parameter value was truncated
read
true if a read was truncated
dataSize
the original size of the data
transferSize
the size after truncation
Description

Create a DataTruncation object. The SQLState is initialized to 01004, the reason is set to "Data truncation" and the vendorCode is set to the SQLException default.


 DataTruncation.getDataSize

DataTruncation.getDataSize

Syntax
public int getDataSize()
Returns
the number of bytes of data that should have been transferred
Description
Get the number of bytes of data that should have been transferred. This number may be approximate if data conversions were being performed. The value may be "-1" if the size is unknown.


 DataTruncation.getIndex

DataTruncation.getIndex

Syntax
public int getIndex()
Returns
the index of the truncated paramter or column value.
Description
Get the index of the column or parameter that was truncated.

This may be -1 if the column or parameter index is unknown, in which case the "parameter" and "read" fields should be ignored.


 DataTruncation.getParameter

DataTruncation.getParameter

Syntax
public boolean getParameter()
Returns
True if the value was a parameter; false if it was a column value.
Description
Is this a truncated parameter value?


 DataTruncation.getRead

DataTruncation.getRead

Syntax
public boolean getRead()
Returns
True if the value was truncated when read from the database; false if the data was truncated on a write.
Description
Was this a read truncation?


 DataTruncation.getTransferSize

DataTruncation.getTransferSize

Syntax
public int getTransferSize()
Returns
the number of bytes of data actually transferred
Description
Get the number of bytes of data actually transferred. The value may be "-1" if the size is unknown.


 Interface DatabaseMetaData

Interface java.sql.DatabaseMetaData

Interface Members | This Package | All Packages

public interface DatabaseMetaData

This class provides information about the database as a whole.

Many of the methods here return lists of information in ResultSets. You can use the normal ResultSet methods such as getString and getInt to retrieve the data from these ResultSets. If a given form of metadata is not available, these methods should throw a SQLException.

Some of these methods take arguments that are String patterns. These arguments all have names such as fooPattern. Within a pattern String, "%" means match any substring of 0 or more characters, and "_" means match any one character. Only metadata entries matching the search pattern are returned. If a search pattern argument is set to a null ref, it means that argument's criteria should be dropped from the search.

A SQLException will be thrown if a driver does not support a meta data method. In the case of methods that return a ResultSet, either a ResultSet (which may be empty) is returned or a SQLException is thrown.


 DatabaseMetaData Members

DatabaseMetaData Members

Interface Overview | This Package | All Packages

Fields
Name | Description
bestRowNotPseudo | BEST ROW PSEUDO_COLUMN - is NOT a pseudo column.
bestRowPseudo | BEST ROW PSEUDO_COLUMN - is a pseudo column.
bestRowSession | BEST ROW SCOPE - valid for remainder of current session.
bestRowTemporary | BEST ROW SCOPE - very temporary, while using row.
bestRowTransaction | BEST ROW SCOPE - valid for remainder of current transaction.
bestRowUnknown | BEST ROW PSEUDO_COLUMN - may or may not be pseudo column.
columnNoNulls | COLUMN NULLABLE - might not allow NULL values.
columnNullable | COLUMN NULLABLE - definitely allows NULL values.
columnNullableUnknown | COLUMN NULLABLE - nullability unknown.
importedKeyCascade | IMPORT KEY UPDATE_RULE and DELETE_RULE - for update, change imported key to agree with primary key update; for delete, delete rows that import a deleted key.
importedKeyInitiallyDeferred | IMPORT KEY DEFERRABILITY - see SQL92 for definition
importedKeyInitiallyImmediate | IMPORT KEY DEFERRABILITY - see SQL92 for definition
importedKeyNoAction | IMPORT KEY UPDATE_RULE and DELETE_RULE - do not allow update or delete of primary key if it has been imported.
importedKeyNotDeferrable | IMPORT KEY DEFERRABILITY - see SQL92 for definition
importedKeyRestrict | IMPORT KEY UPDATE_RULE and DELETE_RULE - do not allow update or delete of primary key if it has been imported.
importedKeySetDefault | IMPORT KEY UPDATE_RULE and DELETE_RULE - change imported key to default values if its primary key has been updated or deleted.
importedKeySetNull | IMPORT KEY UPDATE_RULE and DELETE_RULE - change imported key to NULL if its primary key has been updated or deleted.
procedureColumnIn | COLUMN_TYPE - IN parameter.
procedureColumnInOut | COLUMN_TYPE - INOUT parameter.
procedureColumnOut | COLUMN_TYPE - OUT parameter.
procedureColumnResult | COLUMN_TYPE - result column in ResultSet.
procedureColumnReturn | COLUMN_TYPE - procedure return value.
procedureColumnUnknown | COLUMN_TYPE - nobody knows.
procedureNoNulls | TYPE NULLABLE - does not allow NULL values.
procedureNoResult | PROCEDURE_TYPE - Does not return a result.
procedureNullable | TYPE NULLABLE - allows NULL values.
procedureNullableUnknown | TYPE NULLABLE - nullability unknown.
procedureResultUnknown | PROCEDURE_TYPE - May return a result.
procedureReturnsResult | PROCEDURE_TYPE - Returns a result.
tableIndexClustered | INDEX INFO TYPE - this identifies a clustered index
tableIndexHashed | INDEX INFO TYPE - this identifies a hashed index
tableIndexOther | INDEX INFO TYPE - this identifies some other form of index
tableIndexStatistic | INDEX INFO TYPE - this identifies table statistics that are returned in conjuction with a table's index descriptions
typeNoNulls | TYPE NULLABLE - does not allow NULL values.
typeNullable | TYPE NULLABLE - allows NULL values.
typeNullableUnknown | TYPE NULLABLE - nullability unknown.
typePredBasic | TYPE INFO SEARCHABLE - Supported except for WHERE ..
typePredChar | TYPE INFO SEARCHABLE - Only supported with WHERE ..
typePredNone | TYPE INFO SEARCHABLE - No support.
typeSearchable | TYPE INFO SEARCHABLE - Supported for all WHERE ...
versionColumnNotPseudo | VERSION COLUMNS PSEUDO_COLUMN - is NOT a pseudo column.
versionColumnPseudo | VERSION COLUMNS PSEUDO_COLUMN - is a pseudo column.
versionColumnUnknown | VERSION COLUMNS PSEUDO_COLUMN - may or may not be pseudo column.

Methods
Name | Description
allProceduresAreCallable() | Can all the procedures returned by getProcedures be called by the current user?
allTablesAreSelectable() | Can all the tables returned by getTable be SELECTed by the current user?
dataDefinitionCausesTransactionCommit() | Does a data definition statement within a transaction force the transaction to commit?
dataDefinitionIgnoredInTransactions() | Is a data definition statement within a transaction ignored?
doesMaxRowSizeIncludeBlobs() | Did getMaxRowSize() include LONGVARCHAR and LONGVARBINARY blobs?
getBestRowIdentifier(String, String, String, int, boolean) | Get a description of a table's optimal set of columns that uniquely identifies a row.
getCatalogs() | Get the catalog names available in this database.
getCatalogSeparator() | What's the separator between catalog and table name?
getCatalogTerm() | What's the database vendor's preferred term for "catalog"?
getColumnPrivileges(String, String, String, String) | Get a description of the access rights for a table's columns.
getColumns(String, String, String, String) | Get a description of table columns available in a catalog.
getCrossReference(String, String, String, String, String, String) | Get a description of the foreign key columns in the foreign key table that reference the primary key columns of the primary key table (describe how one table imports another's key.) This should normally return a single foreign key/primary key pair (most tables only import a foreign key from a table once.) They are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and KEY_SEQ.
getDatabaseProductName() | What's the name of this database product?
getDatabaseProductVersion() | What's the version of this database product?
getDefaultTransactionIsolation() | What's the database's default transaction isolation level? The values are defined in java.sql.Connection.
getDriverMajorVersion() | What's this JDBC driver's major version number?
getDriverMinorVersion() | What's this JDBC driver's minor version number?
getDriverName() | What's the name of this JDBC driver?
getDriverVersion() | What's the version of this JDBC driver?
getExportedKeys(String, String, String) | Get a description of the foreign key columns that reference a table's primary key columns (the foreign keys exported by a table).
getExtraNameCharacters() | Get all the "extra" characters that can be used in unquoted identifier names (those beyond a-z, A-Z, 0-9 and _).
getIdentifierQuoteString() | What's the string used to quote SQL identifiers? This returns a space " " if identifier quoting isn't supported.
getImportedKeys(String, String, String) | Get a description of the primary key columns that are referenced by a table's foreign key columns (the primary keys imported by a table).
getIndexInfo(String, String, String, boolean, boolean) | Get a description of a table's indices and statistics.
getMaxBinaryLiteralLength() | How many hex characters can you have in an inline binary literal?
getMaxCatalogNameLength() | What's the maximum length of a catalog name?
getMaxCharLiteralLength() | What's the max length for a character literal?
getMaxColumnNameLength() | What's the limit on column name length?
getMaxColumnsInGroupBy() | What's the maximum number of columns in a "GROUP BY" clause?
getMaxColumnsInIndex() | What's the maximum number of columns allowed in an index?
getMaxColumnsInOrderBy() | What's the maximum number of columns in an "ORDER BY" clause?
getMaxColumnsInSelect() | What's the maximum number of columns in a "SELECT" list?
getMaxColumnsInTable() | What's the maximum number of columns in a table?
getMaxConnections() | How many active connections can we have at a time to this database?
getMaxCursorNameLength() | What's the maximum cursor name length?
getMaxIndexLength() | What's the maximum length of an index (in bytes)?
getMaxProcedureNameLength() | What's the maximum length of a procedure name?
getMaxRowSize() | What's the maximum length of a single row?
getMaxSchemaNameLength() | What's the maximum length allowed for a schema name?
getMaxStatementLength() | What's the maximum length of a SQL statement?
getMaxStatements() | How many active statements can we have open at one time to this database?
getMaxTableNameLength() | What's the maximum length of a table name?
getMaxTablesInSelect() | What's the maximum number of tables in a SELECT?
getMaxUserNameLength() | What's the maximum length of a user name?
getNumericFunctions() | Get a comma separated list of math functions.
getPrimaryKeys(String, String, String) | Get a description of a table's primary key columns.
getProcedureColumns(String, String, String, String) | Get a description of a catalog's stored procedure parameters and result columns.
getProcedures(String, String, String) | Get a description of stored procedures available in a catalog.
getProcedureTerm() | What's the database vendor's preferred term for "procedure"?
getSchemas() | Get the schema names available in this database.
getSchemaTerm() | What's the database vendor's preferred term for "schema"?
getSearchStringEscape() | This is the string that can be used to escape '_' or '%' in the string pattern style catalog search parameters.
getSQLKeywords() | Get a comma separated list of all a database's SQL keywords that are NOT also SQL92 keywords.
getStringFunctions() | Get a comma separated list of string functions.
getSystemFunctions() | Get a comma separated list of system functions.
getTablePrivileges(String, String, String) | Get a description of the access rights for each table available in a catalog.
getTables(String, String, String, String[]) | Get a description of tables available in a catalog.
getTableTypes() | Get the table types available in this database.
getTimeDateFunctions() | Get a comma separated list of time and date functions.
getTypeInfo() | Get a description of all the standard SQL types supported by this database.
getURL() | What's the url for this database?
getUserName() | What's our user name as known to the database?
getVersionColumns(String, String, String) | Get a description of a table's columns that are automatically updated when any value in a row is updated.
isCatalogAtStart() | Does a catalog appear at the start of a qualified table name? (Otherwise it appears at the end)
isReadOnly() | Is the database in read-only mode?
nullPlusNonNullIsNull() | Are concatenations between NULL and non-NULL values NULL? A JDBC-Compliant driver always returns true.
nullsAreSortedAtEnd() | Are NULL values sorted at the end regardless of sort order?
nullsAreSortedAtStart() | Are NULL values sorted at the start regardless of sort order?
nullsAreSortedHigh() | Are NULL values sorted high?
nullsAreSortedLow() | Are NULL values sorted low?
storesLowerCaseIdentifiers() | Does the database treat mixed case unquoted SQL identifiers as case insensitive and store them in lower case?
storesLowerCaseQuotedIdentifiers() | Does the database treat mixed case quoted SQL identifiers as case insensitive and store them in lower case?
storesMixedCaseIdentifiers() | Does the database treat mixed case unquoted SQL identifiers as case insensitive and store them in mixed case?
storesMixedCaseQuotedIdentifiers() | Does the database treat mixed case quoted SQL identifiers as case insensitive and store them in mixed case?
storesUpperCaseIdentifiers() | Does the database treat mixed case unquoted SQL identifiers as case insensitive and store them in upper case?
storesUpperCaseQuotedIdentifiers() | Does the database treat mixed case quoted SQL identifiers as case insensitive and store them in upper case?
supportsAlterTableWithAddColumn() | Is "ALTER TABLE" with add column supported?
supportsAlterTableWithDropColumn() | Is "ALTER TABLE" with drop column supported?
supportsANSI92EntryLevelSQL() | Is the ANSI92 entry level SQL grammar supported? All JDBC-Compliant drivers must return true.
supportsANSI92FullSQL() | Is the ANSI92 full SQL grammar supported?
supportsANSI92IntermediateSQL() | Is the ANSI92 intermediate SQL grammar supported?
supportsCatalogsInDataManipulation() | Can a catalog name be used in a data manipulation statement?
supportsCatalogsInIndexDefinitions() | Can a catalog name be used in an index definition statement?
supportsCatalogsInPrivilegeDefinitions() | Can a catalog name be used in a privilege definition statement?
supportsCatalogsInProcedureCalls() | Can a catalog name be used in a procedure call statement?
supportsCatalogsInTableDefinitions() | Can a catalog name be used in a table definition statement?
supportsColumnAliasing() | Is column aliasing supported? If so, the SQL AS clause can be used to provide names for computed columns or to provide alias names for columns as required.
supportsConvert() | Is the CONVERT function between SQL types supported?
supportsConvert(int, int) | Is CONVERT between the given SQL types supported?
supportsCoreSQLGrammar() | Is the ODBC Core SQL grammar supported?
supportsCorrelatedSubqueries() | Are correlated subqueries supported? A JDBC-Compliant driver always returns true.
supportsDataDefinitionAndDataManipulationTransactions() | Are both data definition and data manipulation statements within a transaction supported?
supportsDataManipulationTransactionsOnly() | Are only data manipulation statements within a transaction supported?
supportsDifferentTableCorrelationNames() | If table correlation names are supported, are they restricted to be different from the names of the tables?
supportsExpressionsInOrderBy() | Are expressions in "ORDER BY" lists supported?
supportsExtendedSQLGrammar() | Is the ODBC Extended SQL grammar supported?
supportsFullOuterJoins() | Are full nested outer joins supported?
supportsGroupBy() | Is some form of "GROUP BY" clause supported?
supportsGroupByBeyondSelect() | Can a "GROUP BY" clause add columns not in the SELECT provided it specifies all the columns in the SELECT?
supportsGroupByUnrelated() | Can a "GROUP BY" clause use columns not in the SELECT?
supportsIntegrityEnhancementFacility() | Is the SQL Integrity Enhancement Facility supported?
supportsLikeEscapeClause() | Is the escape character in "LIKE" clauses supported? A JDBC-Compliant driver always returns true.
supportsLimitedOuterJoins() | Is there limited support for outer joins? (This will be true if supportFullOuterJoins is true.)
supportsMinimumSQLGrammar() | Is the ODBC Minimum SQL grammar supported? All JDBC-Compliant drivers must return true.
supportsMixedCaseIdentifiers() | Does the database treat mixed case unquoted SQL identifiers as case sensitive and as a result store them in mixed case? A JDBC-Compliant driver will always return false.
supportsMixedCaseQuotedIdentifiers() | Does the database treat mixed case quoted SQL identifiers as case sensitive and as a result store them in mixed case? A JDBC-Compliant driver will always return true.
supportsMultipleResultSets() | Are multiple ResultSets from a single execute supported?
supportsMultipleTransactions() | Can we have multiple transactions open at once (on different connections)?
supportsNonNullableColumns() | Can columns be defined as non-nullable? A JDBC-Compliant driver always returns true.
supportsOpenCursorsAcrossCommit() | Can cursors remain open across commits?
supportsOpenCursorsAcrossRollback() | Can cursors remain open across rollbacks?
supportsOpenStatementsAcrossCommit() | Can statements remain open across commits?
supportsOpenStatementsAcrossRollback() | Can statements remain open across rollbacks?
supportsOrderByUnrelated() | Can an "ORDER BY" clause use columns not in the SELECT?
supportsOuterJoins() | Is some form of outer join supported?
supportsPositionedDelete() | Is positioned DELETE supported?
supportsPositionedUpdate() | Is positioned UPDATE supported?
supportsSchemasInDataManipulation() | Can a schema name be used in a data manipulation statement?
supportsSchemasInIndexDefinitions() | Can a schema name be used in an index definition statement?
supportsSchemasInPrivilegeDefinitions() | Can a schema name be used in a privilege definition statement?
supportsSchemasInProcedureCalls() | Can a schema name be used in a procedure call statement?
supportsSchemasInTableDefinitions() | Can a schema name be used in a table definition statement?
supportsSelectForUpdate() | Is SELECT for UPDATE supported?
supportsStoredProcedures() | Are stored procedure calls using the stored procedure escape syntax supported?
supportsSubqueriesInComparisons() | Are subqueries in comparison expressions supported? A JDBC-Compliant driver always returns true.
supportsSubqueriesInExists() | Are subqueries in 'exists' expressions supported? A JDBC-Compliant driver always returns true.
supportsSubqueriesInIns() | Are subqueries in 'in' statements supported? A JDBC-Compliant driver always returns true.
supportsSubqueriesInQuantifieds() | Are subqueries in quantified expressions supported? A JDBC-Compliant driver always returns true.
supportsTableCorrelationNames() | Are table correlation names supported? A JDBC-Compliant driver always returns true.
supportsTransactionIsolationLevel(int) | Does the database support the given transaction isolation level?
supportsTransactions() | Are transactions supported? If not, commit is a noop and the isolation level is TRANSACTION_NONE.
supportsUnion() | Is SQL UNION supported?
supportsUnionAll() | Is SQL UNION ALL supported?
usesLocalFilePerTable() | Does the database use a file for each table?
usesLocalFiles() | Does the database store tables in a local file?


 DatabaseMetaData.bestRowNotPseudo

DatabaseMetaData.bestRowNotPseudo

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int bestRowNotPseudo
Description
BEST ROW PSEUDO_COLUMN - is NOT a pseudo column.


 DatabaseMetaData.bestRowPseudo

DatabaseMetaData.bestRowPseudo

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int bestRowPseudo
Description
BEST ROW PSEUDO_COLUMN - is a pseudo column.


 DatabaseMetaData.bestRowSession

DatabaseMetaData.bestRowSession

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int bestRowSession
Description
BEST ROW SCOPE - valid for remainder of current session.


 DatabaseMetaData.bestRowTemporary

DatabaseMetaData.bestRowTemporary

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int bestRowTemporary
Description
BEST ROW SCOPE - very temporary, while using row.


 DatabaseMetaData.bestRowTransaction

DatabaseMetaData.bestRowTransaction

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int bestRowTransaction
Description
BEST ROW SCOPE - valid for remainder of current transaction.


 DatabaseMetaData.bestRowUnknown

DatabaseMetaData.bestRowUnknown

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int bestRowUnknown
Description
BEST ROW PSEUDO_COLUMN - may or may not be pseudo column.


 DatabaseMetaData.columnNoNulls

DatabaseMetaData.columnNoNulls

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int columnNoNulls
Description
COLUMN NULLABLE - might not allow NULL values.


 DatabaseMetaData.columnNullable

DatabaseMetaData.columnNullable

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int columnNullable
Description
COLUMN NULLABLE - definitely allows NULL values.


 DatabaseMetaData.columnNullableUnknown

DatabaseMetaData.columnNullableUnknown

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int columnNullableUnknown
Description
COLUMN NULLABLE - nullability unknown.


 DatabaseMetaData.importedKeyCascade

DatabaseMetaData.importedKeyCascade

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int importedKeyCascade
Description
IMPORT KEY UPDATE_RULE and DELETE_RULE - for update, change imported key to agree with primary key update; for delete, delete rows that import a deleted key.


 DatabaseMetaData.importedKeyInitiallyDeferred

DatabaseMetaData.importedKeyInitiallyDeferred

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int importedKeyInitiallyDeferred
Description
IMPORT KEY DEFERRABILITY - see SQL92 for definition


 DatabaseMetaData.importedKeyInitiallyImmediate

DatabaseMetaData.importedKeyInitiallyImmediate

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int importedKeyInitiallyImmediate
Description
IMPORT KEY DEFERRABILITY - see SQL92 for definition


 DatabaseMetaData.importedKeyNoAction

DatabaseMetaData.importedKeyNoAction

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int importedKeyNoAction
Description
IMPORT KEY UPDATE_RULE and DELETE_RULE - do not allow update or delete of primary key if it has been imported.


 DatabaseMetaData.importedKeyNotDeferrable

DatabaseMetaData.importedKeyNotDeferrable

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int importedKeyNotDeferrable
Description
IMPORT KEY DEFERRABILITY - see SQL92 for definition


 DatabaseMetaData.importedKeyRestrict

DatabaseMetaData.importedKeyRestrict

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int importedKeyRestrict
Description
IMPORT KEY UPDATE_RULE and DELETE_RULE - do not allow update or delete of primary key if it has been imported.


 DatabaseMetaData.importedKeySetDefault

DatabaseMetaData.importedKeySetDefault

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int importedKeySetDefault
Description
IMPORT KEY UPDATE_RULE and DELETE_RULE - change imported key to default values if its primary key has been updated or deleted.


 DatabaseMetaData.importedKeySetNull

DatabaseMetaData.importedKeySetNull

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int importedKeySetNull
Description
IMPORT KEY UPDATE_RULE and DELETE_RULE - change imported key to NULL if its primary key has been updated or deleted.


 DatabaseMetaData.procedureColumnIn

DatabaseMetaData.procedureColumnIn

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int procedureColumnIn
Description
COLUMN_TYPE - IN parameter.


 DatabaseMetaData.procedureColumnInOut

DatabaseMetaData.procedureColumnInOut

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int procedureColumnInOut
Description
COLUMN_TYPE - INOUT parameter.


 DatabaseMetaData.procedureColumnOut

DatabaseMetaData.procedureColumnOut

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int procedureColumnOut
Description
COLUMN_TYPE - OUT parameter.


 DatabaseMetaData.procedureColumnResult

DatabaseMetaData.procedureColumnResult

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int procedureColumnResult
Description
COLUMN_TYPE - result column in ResultSet.


 DatabaseMetaData.procedureColumnReturn

DatabaseMetaData.procedureColumnReturn

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int procedureColumnReturn
Description
COLUMN_TYPE - procedure return value.


 DatabaseMetaData.procedureColumnUnknown

DatabaseMetaData.procedureColumnUnknown

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int procedureColumnUnknown
Description
COLUMN_TYPE - nobody knows.


 DatabaseMetaData.procedureNoNulls

DatabaseMetaData.procedureNoNulls

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int procedureNoNulls
Description
TYPE NULLABLE - does not allow NULL values.


 DatabaseMetaData.procedureNoResult

DatabaseMetaData.procedureNoResult

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int procedureNoResult
Description
PROCEDURE_TYPE - Does not return a result.


 DatabaseMetaData.procedureNullable

DatabaseMetaData.procedureNullable

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int procedureNullable
Description
TYPE NULLABLE - allows NULL values.


 DatabaseMetaData.procedureNullableUnknown

DatabaseMetaData.procedureNullableUnknown

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int procedureNullableUnknown
Description
TYPE NULLABLE - nullability unknown.


 DatabaseMetaData.procedureResultUnknown

DatabaseMetaData.procedureResultUnknown

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int procedureResultUnknown
Description
PROCEDURE_TYPE - May return a result.


 DatabaseMetaData.procedureReturnsResult

DatabaseMetaData.procedureReturnsResult

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int procedureReturnsResult
Description
PROCEDURE_TYPE - Returns a result.


 DatabaseMetaData.tableIndexClustered

DatabaseMetaData.tableIndexClustered

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final short tableIndexClustered
Description
INDEX INFO TYPE - this identifies a clustered index


 DatabaseMetaData.tableIndexHashed

DatabaseMetaData.tableIndexHashed

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final short tableIndexHashed
Description
INDEX INFO TYPE - this identifies a hashed index


 DatabaseMetaData.tableIndexOther

DatabaseMetaData.tableIndexOther

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final short tableIndexOther
Description
INDEX INFO TYPE - this identifies some other form of index


 DatabaseMetaData.tableIndexStatistic

DatabaseMetaData.tableIndexStatistic

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final short tableIndexStatistic
Description
INDEX INFO TYPE - this identifies table statistics that are returned in conjuction with a table's index descriptions


 DatabaseMetaData.typeNoNulls

DatabaseMetaData.typeNoNulls

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int typeNoNulls
Description
TYPE NULLABLE - does not allow NULL values.


 DatabaseMetaData.typeNullable

DatabaseMetaData.typeNullable

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int typeNullable
Description
TYPE NULLABLE - allows NULL values.


 DatabaseMetaData.typeNullableUnknown

DatabaseMetaData.typeNullableUnknown

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int typeNullableUnknown
Description
TYPE NULLABLE - nullability unknown.


 DatabaseMetaData.typePredBasic

DatabaseMetaData.typePredBasic

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int typePredBasic
Description
TYPE INFO SEARCHABLE - Supported except for WHERE .. LIKE.


 DatabaseMetaData.typePredChar

DatabaseMetaData.typePredChar

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int typePredChar
Description
TYPE INFO SEARCHABLE - Only supported with WHERE .. LIKE.


 DatabaseMetaData.typePredNone

DatabaseMetaData.typePredNone

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int typePredNone
Description
TYPE INFO SEARCHABLE - No support.


 DatabaseMetaData.typeSearchable

DatabaseMetaData.typeSearchable

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int typeSearchable
Description
TYPE INFO SEARCHABLE - Supported for all WHERE ...


 DatabaseMetaData.versionColumnNotPseudo

DatabaseMetaData.versionColumnNotPseudo

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int versionColumnNotPseudo
Description
VERSION COLUMNS PSEUDO_COLUMN - is NOT a pseudo column.


 DatabaseMetaData.versionColumnPseudo

DatabaseMetaData.versionColumnPseudo

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int versionColumnPseudo
Description
VERSION COLUMNS PSEUDO_COLUMN - is a pseudo column.


 DatabaseMetaData.versionColumnUnknown

DatabaseMetaData.versionColumnUnknown

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int versionColumnUnknown
Description
VERSION COLUMNS PSEUDO_COLUMN - may or may not be pseudo column.


 DatabaseMetaData.allProceduresAreCallable

DatabaseMetaData.allProceduresAreCallable

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean allProceduresAreCallable() throws SQLException
Returns
true if so
Description
Can all the procedures returned by getProcedures be called by the current user?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.allTablesAreSelectable

DatabaseMetaData.allTablesAreSelectable

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean allTablesAreSelectable() throws SQLException
Returns
true if so
Description
Can all the tables returned by getTable be SELECTed by the current user?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.dataDefinitionCausesTransactionCommit

DatabaseMetaData.dataDefinitionCausesTransactionCommit

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean dataDefinitionCausesTransactionCommit() throws SQLException
Returns
true if so
Description
Does a data definition statement within a transaction force the transaction to commit?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.dataDefinitionIgnoredInTransactions

DatabaseMetaData.dataDefinitionIgnoredInTransactions

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean dataDefinitionIgnoredInTransactions() throws SQLException
Returns
true if so
Description
Is a data definition statement within a transaction ignored?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.doesMaxRowSizeIncludeBlobs

DatabaseMetaData.doesMaxRowSizeIncludeBlobs

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean doesMaxRowSizeIncludeBlobs() throws SQLException
Returns
true if so
Description
Did getMaxRowSize() include LONGVARCHAR and LONGVARBINARY blobs?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getBestRowIdentifier

DatabaseMetaData.getBestRowIdentifier

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getBestRowIdentifier( String catalog, String schema, String table, int scope, boolean nullable ) throws SQLException
Parameters
catalog
a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria
schema
a schema name; "" retrieves those without a schema
table
a table name
scope
the scope of interest; use same values as SCOPE
nullable
include columns that are nullable?
Returns
ResultSet - each row is a column description
Description
Get a description of a table's optimal set of columns that uniquely identifies a row. They are ordered by SCOPE.

Each column description has the following columns:

  1. SCOPE short => actual scope of result
    • bestRowTemporary - very temporary, while using row
    • bestRowTransaction - valid for remainder of current transaction
    • bestRowSession - valid for remainder of current session
  2. COLUMN_NAME String => column name
  3. DATA_TYPE short => SQL data type from java.sql.Types
  4. TYPE_NAME String => Data source dependent type name
  5. COLUMN_SIZE int => precision
  6. BUFFER_LENGTH int => not used
  7. DECIMAL_DIGITS short => scale
  8. PSEUDO_COLUMN short => is this a pseudo column like an Oracle ROWID
    • bestRowUnknown - may or may not be pseudo column
    • bestRowNotPseudo - is NOT a pseudo column
    • bestRowPseudo - is a pseudo column

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getCatalogs

DatabaseMetaData.getCatalogs

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getCatalogs() throws SQLException
Returns
ResultSet - each row has a single String column that is a catalog name
Description
Get the catalog names available in this database. The results are ordered by catalog name.

The catalog column is:

  1. TABLE_CAT String => catalog name

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getCatalogSeparator

DatabaseMetaData.getCatalogSeparator

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getCatalogSeparator() throws SQLException
Returns
the separator string
Description
What's the separator between catalog and table name?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getCatalogTerm

DatabaseMetaData.getCatalogTerm

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getCatalogTerm() throws SQLException
Returns
the vendor term
Description
What's the database vendor's preferred term for "catalog"?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getColumnPrivileges

DatabaseMetaData.getColumnPrivileges

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getColumnPrivileges( String catalog, String schema, String table, String columnNamePattern ) throws SQLException
Parameters
catalog
a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria
schema
a schema name; "" retrieves those without a schema
table
a table name
columnNamePattern
a column name pattern
Returns
ResultSet - each row is a column privilege description
Description
Get a description of the access rights for a table's columns.

Only privileges matching the column name criteria are returned. They are ordered by COLUMN_NAME and PRIVILEGE.

Each privilige description has the following columns:

  1. TABLE_CAT String => table catalog (may be null)
  2. TABLE_SCHEM String => table schema (may be null)
  3. TABLE_NAME String => table name
  4. COLUMN_NAME String => column name
  5. GRANTOR => grantor of access (may be null)
  6. GRANTEE String => grantee of access
  7. PRIVILEGE String => name of access (SELECT, INSERT, UPDATE, REFRENCES, ...)
  8. IS_GRANTABLE String => "YES" if grantee is permitted to grant to others; "NO" if not; null if unknown

Exceptions
SQLException if a database-access error occurs.
See Also
getSearchStringEscape


 DatabaseMetaData.getColumns

DatabaseMetaData.getColumns

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getColumns( String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern ) throws SQLException
Parameters
catalog
a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria
schemaPattern
a schema name pattern; "" retrieves those without a schema
tableNamePattern
a table name pattern
columnNamePattern
a column name pattern
Returns
ResultSet - each row is a column description
Description
Get a description of table columns available in a catalog.

Only column descriptions matching the catalog, schema, table and column name criteria are returned. They are ordered by TABLE_SCHEM, TABLE_NAME and ORDINAL_POSITION.

Each column description has the following columns:

  1. TABLE_CAT String => table catalog (may be null)
  2. TABLE_SCHEM String => table schema (may be null)
  3. TABLE_NAME String => table name
  4. COLUMN_NAME String => column name
  5. DATA_TYPE short => SQL type from java.sql.Types
  6. TYPE_NAME String => Data source dependent type name
  7. COLUMN_SIZE int => column size. For char or date types this is the maximum number of characters, for numeric or decimal types this is precision.
  8. BUFFER_LENGTH is not used.
  9. DECIMAL_DIGITS int => the number of fractional digits
  10. NUM_PREC_RADIX int => Radix (typically either 10 or 2)
  11. NULLABLE int => is NULL allowed?
    • columnNoNulls - might not allow NULL values
    • columnNullable - definitely allows NULL values
    • columnNullableUnknown - nullability unknown
  12. REMARKS String => comment describing column (may be null)
  13. COLUMN_DEF String => default value (may be null)
  14. SQL_DATA_TYPE int => unused
  15. SQL_DATETIME_SUB int => unused
  16. CHAR_OCTET_LENGTH int => for char types the maximum number of bytes in the column
  17. ORDINAL_POSITION int => index of column in table (starting at 1)
  18. IS_NULLABLE String => "NO" means column definitely does not allow NULL values; "YES" means the column might allow NULL values. An empty string means nobody knows.

Exceptions
SQLException if a database-access error occurs.
See Also
getSearchStringEscape


 DatabaseMetaData.getCrossReference

DatabaseMetaData.getCrossReference

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getCrossReference( String primaryCatalog, String primarySchema, String primaryTable, String foreignCatalog, String foreignSchema, String foreignTable ) throws SQLException
Parameters
primaryCatalog
a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria
primarySchema
a schema name pattern; "" retrieves those without a schema
primaryTable
the table name that exports the key
foreignCatalog
a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria
foreignSchema
a schema name pattern; "" retrieves those without a schema
foreignTable
the table name that imports the key
Returns
ResultSet - each row is a foreign key column description
Description
Get a description of the foreign key columns in the foreign key table that reference the primary key columns of the primary key table (describe how one table imports another's key.) This should normally return a single foreign key/primary key pair (most tables only import a foreign key from a table once.) They are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and KEY_SEQ.

Each foreign key column description has the following columns:

  1. PKTABLE_CAT String => primary key table catalog (may be null)
  2. PKTABLE_SCHEM String => primary key table schema (may be null)
  3. PKTABLE_NAME String => primary key table name
  4. PKCOLUMN_NAME String => primary key column name
  5. FKTABLE_CAT String => foreign key table catalog (may be null) being exported (may be null)
  6. FKTABLE_SCHEM String => foreign key table schema (may be null) being exported (may be null)
  7. FKTABLE_NAME String => foreign key table name being exported
  8. FKCOLUMN_NAME String => foreign key column name being exported
  9. KEY_SEQ short => sequence number within foreign key
  10. UPDATE_RULE short => What happens to foreign key when primary is updated:
    • importedNoAction - do not allow update of primary key if it has been imported
    • importedKeyCascade - change imported key to agree with primary key update
    • importedKeySetNull - change imported key to NULL if its primary key has been updated
    • importedKeySetDefault - change imported key to default values if its primary key has been updated
    • importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility)
  11. DELETE_RULE short => What happens to the foreign key when primary is deleted.
    • importedKeyNoAction - do not allow delete of primary key if it has been imported
    • importedKeyCascade - delete rows that import a deleted key
    • importedKeySetNull - change imported key to NULL if its primary key has been deleted
    • importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility)
    • importedKeySetDefault - change imported key to default if its primary key has been deleted
  12. FK_NAME String => foreign key name (may be null)
  13. PK_NAME String => primary key name (may be null)
  14. DEFERRABILITY short => can the evaluation of foreign key constraints be deferred until commit
    • importedKeyInitiallyDeferred - see SQL92 for definition
    • importedKeyInitiallyImmediate - see SQL92 for definition
    • importedKeyNotDeferrable - see SQL92 for definition

Exceptions
SQLException if a database-access error occurs.
See Also
getImportedKeys


 DatabaseMetaData.getDatabaseProductName

DatabaseMetaData.getDatabaseProductName

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getDatabaseProductName() throws SQLException
Returns
database product name
Description
What's the name of this database product?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getDatabaseProductVersion

DatabaseMetaData.getDatabaseProductVersion

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getDatabaseProductVersion() throws SQLException
Returns
database version
Description
What's the version of this database product?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getDefaultTransactionIsolation

DatabaseMetaData.getDefaultTransactionIsolation

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getDefaultTransactionIsolation() throws SQLException
Returns
the default isolation level
Description
What's the database's default transaction isolation level? The values are defined in java.sql.Connection.

Exceptions
SQLException if a database-access error occurs.
See Also
Connection


 DatabaseMetaData.getDriverMajorVersion

DatabaseMetaData.getDriverMajorVersion

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getDriverMajorVersion()
Returns
JDBC driver major version
Description
What's this JDBC driver's major version number?


 DatabaseMetaData.getDriverMinorVersion

DatabaseMetaData.getDriverMinorVersion

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getDriverMinorVersion()
Returns
JDBC driver minor version number
Description
What's this JDBC driver's minor version number?


 DatabaseMetaData.getDriverName

DatabaseMetaData.getDriverName

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getDriverName() throws SQLException
Returns
JDBC driver name
Description
What's the name of this JDBC driver?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getDriverVersion

DatabaseMetaData.getDriverVersion

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getDriverVersion() throws SQLException
Returns
JDBC driver version
Description
What's the version of this JDBC driver?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getExportedKeys

DatabaseMetaData.getExportedKeys

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getExportedKeys( String catalog, String schema, String table ) throws SQLException
Parameters
catalog
a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria
schema
a schema name pattern; "" retrieves those without a schema
table
a table name
Returns
ResultSet - each row is a foreign key column description
Description
Get a description of the foreign key columns that reference a table's primary key columns (the foreign keys exported by a table). They are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and KEY_SEQ.

Each foreign key column description has the following columns:

  1. PKTABLE_CAT String => primary key table catalog (may be null)
  2. PKTABLE_SCHEM String => primary key table schema (may be null)
  3. PKTABLE_NAME String => primary key table name
  4. PKCOLUMN_NAME String => primary key column name
  5. FKTABLE_CAT String => foreign key table catalog (may be null) being exported (may be null)
  6. FKTABLE_SCHEM String => foreign key table schema (may be null) being exported (may be null)
  7. FKTABLE_NAME String => foreign key table name being exported
  8. FKCOLUMN_NAME String => foreign key column name being exported
  9. KEY_SEQ short => sequence number within foreign key
  10. UPDATE_RULE short => What happens to foreign key when primary is updated:
    • importedNoAction - do not allow update of primary key if it has been imported
    • importedKeyCascade - change imported key to agree with primary key update
    • importedKeySetNull - change imported key to NULL if its primary key has been updated
    • importedKeySetDefault - change imported key to default values if its primary key has been updated
    • importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility)
  11. DELETE_RULE short => What happens to the foreign key when primary is deleted.
    • importedKeyNoAction - do not allow delete of primary key if it has been imported
    • importedKeyCascade - delete rows that import a deleted key
    • importedKeySetNull - change imported key to NULL if its primary key has been deleted
    • importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility)
    • importedKeySetDefault - change imported key to default if its primary key has been deleted
  12. FK_NAME String => foreign key name (may be null)
  13. PK_NAME String => primary key name (may be null)
  14. DEFERRABILITY short => can the evaluation of foreign key constraints be deferred until commit
    • importedKeyInitiallyDeferred - see SQL92 for definition
    • importedKeyInitiallyImmediate - see SQL92 for definition
    • importedKeyNotDeferrable - see SQL92 for definition

Exceptions
SQLException if a database-access error occurs.
See Also
getImportedKeys


 DatabaseMetaData.getExtraNameCharacters

DatabaseMetaData.getExtraNameCharacters

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getExtraNameCharacters() throws SQLException
Returns
the string containing the extra characters
Description
Get all the "extra" characters that can be used in unquoted identifier names (those beyond a-z, A-Z, 0-9 and _).

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getIdentifierQuoteString

DatabaseMetaData.getIdentifierQuoteString

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getIdentifierQuoteString() throws SQLException
Returns
the quoting string
Description
What's the string used to quote SQL identifiers? This returns a space " " if identifier quoting isn't supported. A JDBC-Compliant driver always uses a double quote character.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getImportedKeys

DatabaseMetaData.getImportedKeys

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getImportedKeys( String catalog, String schema, String table ) throws SQLException
Parameters
catalog
a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria
schema
a schema name pattern; "" retrieves those without a schema
table
a table name
Returns
ResultSet - each row is a primary key column description
Description
Get a description of the primary key columns that are referenced by a table's foreign key columns (the primary keys imported by a table). They are ordered by PKTABLE_CAT, PKTABLE_SCHEM, PKTABLE_NAME, and KEY_SEQ.

Each primary key column description has the following columns:

  1. PKTABLE_CAT String => primary key table catalog being imported (may be null)
  2. PKTABLE_SCHEM String => primary key table schema being imported (may be null)
  3. PKTABLE_NAME String => primary key table name being imported
  4. PKCOLUMN_NAME String => primary key column name being imported
  5. FKTABLE_CAT String => foreign key table catalog (may be null)
  6. FKTABLE_SCHEM String => foreign key table schema (may be null)
  7. FKTABLE_NAME String => foreign key table name
  8. FKCOLUMN_NAME String => foreign key column name
  9. KEY_SEQ short => sequence number within foreign key
  10. UPDATE_RULE short => What happens to foreign key when primary is updated:
    • importedNoAction - do not allow update of primary key if it has been imported
    • importedKeyCascade - change imported key to agree with primary key update
    • importedKeySetNull - change imported key to NULL if its primary key has been updated
    • importedKeySetDefault - change imported key to default values if its primary key has been updated
    • importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility)
  11. DELETE_RULE short => What happens to the foreign key when primary is deleted.
    • importedKeyNoAction - do not allow delete of primary key if it has been imported
    • importedKeyCascade - delete rows that import a deleted key
    • importedKeySetNull - change imported key to NULL if its primary key has been deleted
    • importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility)
    • importedKeySetDefault - change imported key to default if its primary key has been deleted
  12. FK_NAME String => foreign key name (may be null)
  13. PK_NAME String => primary key name (may be null)
  14. DEFERRABILITY short => can the evaluation of foreign key constraints be deferred until commit
    • importedKeyInitiallyDeferred - see SQL92 for definition
    • importedKeyInitiallyImmediate - see SQL92 for definition
    • importedKeyNotDeferrable - see SQL92 for definition

Exceptions
SQLException if a database-access error occurs.
See Also
getExportedKeys


 DatabaseMetaData.getIndexInfo

DatabaseMetaData.getIndexInfo

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getIndexInfo( String catalog, String schema, String table, boolean unique, boolean approximate ) throws SQLException
Parameters
catalog
a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria
schema
a schema name pattern; "" retrieves those without a schema
table
a table name
unique
when true, return only indices for unique values; when false, return indices regardless of whether unique or not
approximate
when true, result is allowed to reflect approximate or out of data values; when false, results are requested to be accurate
Returns
ResultSet - each row is an index column description
Description
Get a description of a table's indices and statistics. They are ordered by NON_UNIQUE, TYPE, INDEX_NAME, and ORDINAL_POSITION.

Each index column description has the following columns:

  1. TABLE_CAT String => table catalog (may be null)
  2. TABLE_SCHEM String => table schema (may be null)
  3. TABLE_NAME String => table name
  4. NON_UNIQUE boolean => Can index values be non-unique? false when TYPE is tableIndexStatistic
  5. INDEX_QUALIFIER String => index catalog (may be null); null when TYPE is tableIndexStatistic
  6. INDEX_NAME String => index name; null when TYPE is tableIndexStatistic
  7. TYPE short => index type:
    • tableIndexStatistic - this identifies table statistics that are returned in conjuction with a table's index descriptions
    • tableIndexClustered - this is a clustered index
    • tableIndexHashed - this is a hashed index
    • tableIndexOther - this is some other style of index
  8. ORDINAL_POSITION short => column sequence number within index; zero when TYPE is tableIndexStatistic
  9. COLUMN_NAME String => column name; null when TYPE is tableIndexStatistic
  10. ASC_OR_DESC String => column sort sequence, "A" => ascending, "D" => descending, may be null if sort sequence is not supported; null when TYPE is tableIndexStatistic
  11. CARDINALITY int => When TYPE is tableIndexStatistic, then this is the number of rows in the table; otherwise, it is the number of unique values in the index.
  12. PAGES int => When TYPE is tableIndexStatisic then this is the number of pages used for the table, otherwise it is the number of pages used for the current index.
  13. FILTER_CONDITION String => Filter condition, if any. (may be null)

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxBinaryLiteralLength

DatabaseMetaData.getMaxBinaryLiteralLength

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxBinaryLiteralLength() throws SQLException
Returns
max literal length
Description
How many hex characters can you have in an inline binary literal?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxCatalogNameLength

DatabaseMetaData.getMaxCatalogNameLength

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxCatalogNameLength() throws SQLException
Returns
max name length in bytes
Description
What's the maximum length of a catalog name?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxCharLiteralLength

DatabaseMetaData.getMaxCharLiteralLength

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxCharLiteralLength() throws SQLException
Returns
max literal length
Description
What's the max length for a character literal?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxColumnNameLength

DatabaseMetaData.getMaxColumnNameLength

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxColumnNameLength() throws SQLException
Returns
max literal length
Description
What's the limit on column name length?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxColumnsInGroupBy

DatabaseMetaData.getMaxColumnsInGroupBy

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxColumnsInGroupBy() throws SQLException
Returns
max number of columns
Description
What's the maximum number of columns in a "GROUP BY" clause?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxColumnsInIndex

DatabaseMetaData.getMaxColumnsInIndex

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxColumnsInIndex() throws SQLException
Returns
max columns
Description
What's the maximum number of columns allowed in an index?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxColumnsInOrderBy

DatabaseMetaData.getMaxColumnsInOrderBy

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxColumnsInOrderBy() throws SQLException
Returns
max columns
Description
What's the maximum number of columns in an "ORDER BY" clause?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxColumnsInSelect

DatabaseMetaData.getMaxColumnsInSelect

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxColumnsInSelect() throws SQLException
Returns
max columns
Description
What's the maximum number of columns in a "SELECT" list?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxColumnsInTable

DatabaseMetaData.getMaxColumnsInTable

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxColumnsInTable() throws SQLException
Returns
max columns
Description
What's the maximum number of columns in a table?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxConnections

DatabaseMetaData.getMaxConnections

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxConnections() throws SQLException
Returns
max connections
Description
How many active connections can we have at a time to this database?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxCursorNameLength

DatabaseMetaData.getMaxCursorNameLength

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxCursorNameLength() throws SQLException
Returns
max cursor name length in bytes
Description
What's the maximum cursor name length?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxIndexLength

DatabaseMetaData.getMaxIndexLength

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxIndexLength() throws SQLException
Returns
max index length in bytes
Description
What's the maximum length of an index (in bytes)?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxProcedureNameLength

DatabaseMetaData.getMaxProcedureNameLength

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxProcedureNameLength() throws SQLException
Returns
max name length in bytes
Description
What's the maximum length of a procedure name?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxRowSize

DatabaseMetaData.getMaxRowSize

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxRowSize() throws SQLException
Returns
max row size in bytes
Description
What's the maximum length of a single row?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxSchemaNameLength

DatabaseMetaData.getMaxSchemaNameLength

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxSchemaNameLength() throws SQLException
Returns
max name length in bytes
Description
What's the maximum length allowed for a schema name?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxStatementLength

DatabaseMetaData.getMaxStatementLength

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxStatementLength() throws SQLException
Returns
max length in bytes
Description
What's the maximum length of a SQL statement?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxStatements

DatabaseMetaData.getMaxStatements

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxStatements() throws SQLException
Returns
the maximum
Description
How many active statements can we have open at one time to this database?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxTableNameLength

DatabaseMetaData.getMaxTableNameLength

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxTableNameLength() throws SQLException
Returns
max name length in bytes
Description
What's the maximum length of a table name?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxTablesInSelect

DatabaseMetaData.getMaxTablesInSelect

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxTablesInSelect() throws SQLException
Returns
the maximum
Description
What's the maximum number of tables in a SELECT?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getMaxUserNameLength

DatabaseMetaData.getMaxUserNameLength

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxUserNameLength() throws SQLException
Returns
max name length in bytes
Description
What's the maximum length of a user name?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getNumericFunctions

DatabaseMetaData.getNumericFunctions

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getNumericFunctions() throws SQLException
Returns
the list
Description
Get a comma separated list of math functions.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getPrimaryKeys

DatabaseMetaData.getPrimaryKeys

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getPrimaryKeys( String catalog, String schema, String table ) throws SQLException
Parameters
catalog
a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria
schema
a schema name pattern; "" retrieves those without a schema
table
a table name
Returns
ResultSet - each row is a primary key column description
Description
Get a description of a table's primary key columns. They are ordered by COLUMN_NAME.

Each primary key column description has the following columns:

  1. TABLE_CAT String => table catalog (may be null)
  2. TABLE_SCHEM String => table schema (may be null)
  3. TABLE_NAME String => table name
  4. COLUMN_NAME String => column name
  5. KEY_SEQ short => sequence number within primary key
  6. PK_NAME String => primary key name (may be null)

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getProcedureColumns

DatabaseMetaData.getProcedureColumns

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getProcedureColumns( String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern ) throws SQLException
Parameters
catalog
a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria
schemaPattern
a schema name pattern; "" retrieves those without a schema
procedureNamePattern
a procedure name pattern
columnNamePattern
a column name pattern
Returns
ResultSet - each row is a stored procedure parameter or column description
Description
Get a description of a catalog's stored procedure parameters and result columns.

Only descriptions matching the schema, procedure and parameter name criteria are returned. They are ordered by PROCEDURE_SCHEM and PROCEDURE_NAME. Within this, the return value, if any, is first. Next are the parameter descriptions in call order. The column descriptions follow in column number order.

Each row in the ResultSet is a parameter description or column description with the following fields:

  1. PROCEDURE_CAT String => procedure catalog (may be null)
  2. PROCEDURE_SCHEM String => procedure schema (may be null)
  3. PROCEDURE_NAME String => procedure name
  4. COLUMN_NAME String => column/parameter name
  5. COLUMN_TYPE Short => kind of column/parameter:
    • procedureColumnUnknown - nobody knows
    • procedureColumnIn - IN parameter
    • procedureColumnInOut - INOUT parameter
    • procedureColumnOut - OUT parameter
    • procedureColumnReturn - procedure return value
    • procedureColumnResult - result column in ResultSet
  6. DATA_TYPE short => SQL type from java.sql.Types
  7. TYPE_NAME String => SQL type name
  8. PRECISION int => precision
  9. LENGTH int => length in bytes of data
  10. SCALE short => scale
  11. RADIX short => radix
  12. NULLABLE short => can it contain NULL?
    • procedureNoNulls - does not allow NULL values
    • procedureNullable - allows NULL values
    • procedureNullableUnknown - nullability unknown
  13. REMARKS String => comment describing parameter/column

Note: Some databases may not return the column descriptions for a procedure. Additional columns beyond REMARKS can be defined by the database.

Exceptions
SQLException if a database-access error occurs.
See Also
getSearchStringEscape


 DatabaseMetaData.getProcedures

DatabaseMetaData.getProcedures

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getProcedures( String catalog, String schemaPattern, String procedureNamePattern ) throws SQLException
Parameters
catalog
a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria
schemaPattern
a schema name pattern; "" retrieves those without a schema
procedureNamePattern
a procedure name pattern
Returns
ResultSet - each row is a procedure description
Description
Get a description of stored procedures available in a catalog.

Only procedure descriptions matching the schema and procedure name criteria are returned. They are ordered by PROCEDURE_SCHEM, and PROCEDURE_NAME.

Each procedure description has the the following columns:

  1. PROCEDURE_CAT String => procedure catalog (may be null)
  2. PROCEDURE_SCHEM String => procedure schema (may be null)
  3. PROCEDURE_NAME String => procedure name
  4. reserved for future use
  5. reserved for future use
  6. reserved for future use
  7. REMARKS String => explanatory comment on the procedure
  8. PROCEDURE_TYPE short => kind of procedure:
    • procedureResultUnknown - May return a result
    • procedureNoResult - Does not return a result
    • procedureReturnsResult - Returns a result

Exceptions
SQLException if a database-access error occurs.
See Also
getSearchStringEscape


 DatabaseMetaData.getProcedureTerm

DatabaseMetaData.getProcedureTerm

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getProcedureTerm() throws SQLException
Returns
the vendor term
Description
What's the database vendor's preferred term for "procedure"?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getSchemas

DatabaseMetaData.getSchemas

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getSchemas() throws SQLException
Returns
ResultSet - each row has a single String column that is a schema name
Description
Get the schema names available in this database. The results are ordered by schema name.

The schema column is:

  1. TABLE_SCHEM String => schema name

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getSchemaTerm

DatabaseMetaData.getSchemaTerm

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getSchemaTerm() throws SQLException
Returns
the vendor term
Description
What's the database vendor's preferred term for "schema"?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getSearchStringEscape

DatabaseMetaData.getSearchStringEscape

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getSearchStringEscape() throws SQLException
Returns
the string used to escape wildcard characters
Description
This is the string that can be used to escape '_' or '%' in the string pattern style catalog search parameters.

The '_' character represents any single character.

The '%' character represents any sequence of zero or more characters.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getSQLKeywords

DatabaseMetaData.getSQLKeywords

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getSQLKeywords() throws SQLException
Returns
the list
Description
Get a comma separated list of all a database's SQL keywords that are NOT also SQL92 keywords.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getStringFunctions

DatabaseMetaData.getStringFunctions

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getStringFunctions() throws SQLException
Returns
the list
Description
Get a comma separated list of string functions.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getSystemFunctions

DatabaseMetaData.getSystemFunctions

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getSystemFunctions() throws SQLException
Returns
the list
Description
Get a comma separated list of system functions.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getTablePrivileges

DatabaseMetaData.getTablePrivileges

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getTablePrivileges( String catalog, String schemaPattern, String tableNamePattern ) throws SQLException
Parameters
catalog
a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria
schemaPattern
a schema name pattern; "" retrieves those without a schema
tableNamePattern
a table name pattern
Returns
ResultSet - each row is a table privilege description
Description
Get a description of the access rights for each table available in a catalog. Note that a table privilege applies to one or more columns in the table. It would be wrong to assume that this priviledge applies to all columns (this may be true for some systems but is not true for all.)

Only privileges matching the schema and table name criteria are returned. They are ordered by TABLE_SCHEM, TABLE_NAME, and PRIVILEGE.

Each privilige description has the following columns:

  1. TABLE_CAT String => table catalog (may be null)
  2. TABLE_SCHEM String => table schema (may be null)
  3. TABLE_NAME String => table name
  4. GRANTOR => grantor of access (may be null)
  5. GRANTEE String => grantee of access
  6. PRIVILEGE String => name of access (SELECT, INSERT, UPDATE, REFRENCES, ...)
  7. IS_GRANTABLE String => "YES" if grantee is permitted to grant to others; "NO" if not; null if unknown

Exceptions
SQLException if a database-access error occurs.
See Also
getSearchStringEscape


 DatabaseMetaData.getTables

DatabaseMetaData.getTables

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getTables( String catalog, String schemaPattern, String tableNamePattern, String types[] ) throws SQLException
Parameters
catalog
a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria
schemaPattern
a schema name pattern; "" retrieves those without a schema
tableNamePattern
a table name pattern
types
a list of table types to include; null returns all types
Returns
ResultSet - each row is a table description
Description
Get a description of tables available in a catalog.

Only table descriptions matching the catalog, schema, table name and type criteria are returned. They are ordered by TABLE_TYPE, TABLE_SCHEM and TABLE_NAME.

Each table description has the following columns:

  1. TABLE_CAT String => table catalog (may be null)
  2. TABLE_SCHEM String => table schema (may be null)
  3. TABLE_NAME String => table name
  4. TABLE_TYPE String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
  5. REMARKS String => explanatory comment on the table

Note: Some databases may not return information for all tables.

Exceptions
SQLException if a database-access error occurs.
See Also
getSearchStringEscape


 DatabaseMetaData.getTableTypes

DatabaseMetaData.getTableTypes

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getTableTypes() throws SQLException
Returns
ResultSet - each row has a single String column that is a table type
Description
Get the table types available in this database. The results are ordered by table type.

The table type is:

  1. TABLE_TYPE String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getTimeDateFunctions

DatabaseMetaData.getTimeDateFunctions

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getTimeDateFunctions() throws SQLException
Returns
the list
Description
Get a comma separated list of time and date functions.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getTypeInfo

DatabaseMetaData.getTypeInfo

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getTypeInfo() throws SQLException
Returns
ResultSet - each row is a SQL type description
Description
Get a description of all the standard SQL types supported by this database. They are ordered by DATA_TYPE and then by how closely the data type maps to the corresponding JDBC SQL type.

Each type description has the following columns:

  1. TYPE_NAME String => Type name
  2. DATA_TYPE short => SQL data type from java.sql.Types
  3. PRECISION int => maximum precision
  4. LITERAL_PREFIX String => prefix used to quote a literal (may be null)
  5. LITERAL_SUFFIX String => suffix used to quote a literal (may be null)
  6. CREATE_PARAMS String => parameters used in creating the type (may be null)
  7. NULLABLE short => can you use NULL for this type?
    • typeNoNulls - does not allow NULL values
    • typeNullable - allows NULL values
    • typeNullableUnknown - nullability unknown
  8. CASE_SENSITIVE boolean=> is it case sensitive?
  9. SEARCHABLE short => can you use "WHERE" based on this type:
    • typePredNone - No support
    • typePredChar - Only supported with WHERE .. LIKE
    • typePredBasic - Supported except for WHERE .. LIKE
    • typeSearchable - Supported for all WHERE ..
  10. UNSIGNED_ATTRIBUTE boolean => is it unsigned?
  11. FIXED_PREC_SCALE boolean => can it be a money value?
  12. AUTO_INCREMENT boolean => can it be used for an auto-increment value?
  13. LOCAL_TYPE_NAME String => localized version of type name (may be null)
  14. MINIMUM_SCALE short => minimum scale supported
  15. MAXIMUM_SCALE short => maximum scale supported
  16. SQL_DATA_TYPE int => unused
  17. SQL_DATETIME_SUB int => unused
  18. NUM_PREC_RADIX int => usually 2 or 10

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getURL

DatabaseMetaData.getURL

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getURL() throws SQLException
Returns
the url or null if it can't be generated
Description
What's the url for this database?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getUserName

DatabaseMetaData.getUserName

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getUserName() throws SQLException
Returns
our database user name
Description
What's our user name as known to the database?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.getVersionColumns

DatabaseMetaData.getVersionColumns

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getVersionColumns( String catalog, String schema, String table ) throws SQLException
Parameters
catalog
a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria
schema
a schema name; "" retrieves those without a schema
table
a table name
Returns
ResultSet - each row is a column description
Description
Get a description of a table's columns that are automatically updated when any value in a row is updated. They are unordered.

Each column description has the following columns:

  1. SCOPE short => is not used
  2. COLUMN_NAME String => column name
  3. DATA_TYPE short => SQL data type from java.sql.Types
  4. TYPE_NAME String => Data source dependent type name
  5. COLUMN_SIZE int => precision
  6. BUFFER_LENGTH int => length of column value in bytes
  7. DECIMAL_DIGITS short => scale
  8. PSEUDO_COLUMN short => is this a pseudo column like an Oracle ROWID
    • versionColumnUnknown - may or may not be pseudo column
    • versionColumnNotPseudo - is NOT a pseudo column
    • versionColumnPseudo - is a pseudo column

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.isCatalogAtStart

DatabaseMetaData.isCatalogAtStart

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isCatalogAtStart() throws SQLException
Returns
true if it appears at the start
Description
Does a catalog appear at the start of a qualified table name? (Otherwise it appears at the end)

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.isReadOnly

DatabaseMetaData.isReadOnly

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isReadOnly() throws SQLException
Returns
true if so
Description
Is the database in read-only mode?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.nullPlusNonNullIsNull

DatabaseMetaData.nullPlusNonNullIsNull

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean nullPlusNonNullIsNull() throws SQLException
Returns
true if so
Description
Are concatenations between NULL and non-NULL values NULL? A JDBC-Compliant driver always returns true.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.nullsAreSortedAtEnd

DatabaseMetaData.nullsAreSortedAtEnd

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean nullsAreSortedAtEnd() throws SQLException
Returns
true if so
Description
Are NULL values sorted at the end regardless of sort order?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.nullsAreSortedAtStart

DatabaseMetaData.nullsAreSortedAtStart

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean nullsAreSortedAtStart() throws SQLException
Returns
true if so
Description
Are NULL values sorted at the start regardless of sort order?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.nullsAreSortedHigh

DatabaseMetaData.nullsAreSortedHigh

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean nullsAreSortedHigh() throws SQLException
Returns
true if so
Description
Are NULL values sorted high?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.nullsAreSortedLow

DatabaseMetaData.nullsAreSortedLow

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean nullsAreSortedLow() throws SQLException
Returns
true if so
Description
Are NULL values sorted low?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.storesLowerCaseIdentifiers

DatabaseMetaData.storesLowerCaseIdentifiers

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean storesLowerCaseIdentifiers() throws SQLException
Returns
true if so
Description
Does the database treat mixed case unquoted SQL identifiers as case insensitive and store them in lower case?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.storesLowerCaseQuotedIdentifiers

DatabaseMetaData.storesLowerCaseQuotedIdentifiers

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean storesLowerCaseQuotedIdentifiers() throws SQLException
Returns
true if so
Description
Does the database treat mixed case quoted SQL identifiers as case insensitive and store them in lower case?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.storesMixedCaseIdentifiers

DatabaseMetaData.storesMixedCaseIdentifiers

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean storesMixedCaseIdentifiers() throws SQLException
Returns
true if so
Description
Does the database treat mixed case unquoted SQL identifiers as case insensitive and store them in mixed case?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.storesMixedCaseQuotedIdentifiers

DatabaseMetaData.storesMixedCaseQuotedIdentifiers

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean storesMixedCaseQuotedIdentifiers() throws SQLException
Returns
true if so
Description
Does the database treat mixed case quoted SQL identifiers as case insensitive and store them in mixed case?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.storesUpperCaseIdentifiers

DatabaseMetaData.storesUpperCaseIdentifiers

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean storesUpperCaseIdentifiers() throws SQLException
Returns
true if so
Description
Does the database treat mixed case unquoted SQL identifiers as case insensitive and store them in upper case?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.storesUpperCaseQuotedIdentifiers

DatabaseMetaData.storesUpperCaseQuotedIdentifiers

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean storesUpperCaseQuotedIdentifiers() throws SQLException
Returns
true if so
Description
Does the database treat mixed case quoted SQL identifiers as case insensitive and store them in upper case?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsAlterTableWithAddColumn

DatabaseMetaData.supportsAlterTableWithAddColumn

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsAlterTableWithAddColumn() throws SQLException
Returns
true if so
Description
Is "ALTER TABLE" with add column supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsAlterTableWithDropColumn

DatabaseMetaData.supportsAlterTableWithDropColumn

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsAlterTableWithDropColumn() throws SQLException
Returns
true if so
Description
Is "ALTER TABLE" with drop column supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsANSI92EntryLevelSQL

DatabaseMetaData.supportsANSI92EntryLevelSQL

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsANSI92EntryLevelSQL() throws SQLException
Returns
true if so
Description
Is the ANSI92 entry level SQL grammar supported? All JDBC-Compliant drivers must return true.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsANSI92FullSQL

DatabaseMetaData.supportsANSI92FullSQL

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsANSI92FullSQL() throws SQLException
Returns
true if so
Description
Is the ANSI92 full SQL grammar supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsANSI92IntermediateSQL

DatabaseMetaData.supportsANSI92IntermediateSQL

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsANSI92IntermediateSQL() throws SQLException
Returns
true if so
Description
Is the ANSI92 intermediate SQL grammar supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsCatalogsInDataManipulation

DatabaseMetaData.supportsCatalogsInDataManipulation

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsCatalogsInDataManipulation() throws SQLException
Returns
true if so
Description
Can a catalog name be used in a data manipulation statement?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsCatalogsInIndexDefinitions

DatabaseMetaData.supportsCatalogsInIndexDefinitions

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsCatalogsInIndexDefinitions() throws SQLException
Returns
true if so
Description
Can a catalog name be used in an index definition statement?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsCatalogsInPrivilegeDefinitions

DatabaseMetaData.supportsCatalogsInPrivilegeDefinitions

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException
Returns
true if so
Description
Can a catalog name be used in a privilege definition statement?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsCatalogsInProcedureCalls

DatabaseMetaData.supportsCatalogsInProcedureCalls

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsCatalogsInProcedureCalls() throws SQLException
Returns
true if so
Description
Can a catalog name be used in a procedure call statement?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsCatalogsInTableDefinitions

DatabaseMetaData.supportsCatalogsInTableDefinitions

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsCatalogsInTableDefinitions() throws SQLException
Returns
true if so
Description
Can a catalog name be used in a table definition statement?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsColumnAliasing

DatabaseMetaData.supportsColumnAliasing

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsColumnAliasing() throws SQLException
Returns
true if so
Description
Is column aliasing supported?

If so, the SQL AS clause can be used to provide names for computed columns or to provide alias names for columns as required. A JDBC-Compliant driver always returns true.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsConvert

DatabaseMetaData.supportsConvert

Interface Overview | Interface Members | This Package | All Packages

Syntax 1
public abstract boolean supportsConvert() throws SQLException
Returns
true if so
Description
Is the CONVERT function between SQL types supported?

Exceptions
SQLException if a database-access error occurs.

Syntax 2
public abstract boolean supportsConvert( int fromType, int toType ) throws SQLException
Parameters
fromType
the type to convert from
toType
the type to convert to
Returns
true if so
Description
Is CONVERT between the given SQL types supported?

Exceptions
SQLException if a database-access error occurs.
See Also
Types


 DatabaseMetaData.supportsCoreSQLGrammar

DatabaseMetaData.supportsCoreSQLGrammar

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsCoreSQLGrammar() throws SQLException
Returns
true if so
Description
Is the ODBC Core SQL grammar supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsCorrelatedSubqueries

DatabaseMetaData.supportsCorrelatedSubqueries

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsCorrelatedSubqueries() throws SQLException
Returns
true if so
Description
Are correlated subqueries supported? A JDBC-Compliant driver always returns true.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsDataDefinitionAndDataManipulationTransactions

DatabaseMetaData.supportsDataDefinitionAndDataManipulationTransactions

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException
Returns
true if so
Description
Are both data definition and data manipulation statements within a transaction supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsDataManipulationTransactionsOnly

DatabaseMetaData.supportsDataManipulationTransactionsOnly

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsDataManipulationTransactionsOnly() throws SQLException
Returns
true if so
Description
Are only data manipulation statements within a transaction supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsDifferentTableCorrelationNames

DatabaseMetaData.supportsDifferentTableCorrelationNames

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsDifferentTableCorrelationNames() throws SQLException
Returns
true if so
Description
If table correlation names are supported, are they restricted to be different from the names of the tables?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsExpressionsInOrderBy

DatabaseMetaData.supportsExpressionsInOrderBy

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsExpressionsInOrderBy() throws SQLException
Returns
true if so
Description
Are expressions in "ORDER BY" lists supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsExtendedSQLGrammar

DatabaseMetaData.supportsExtendedSQLGrammar

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsExtendedSQLGrammar() throws SQLException
Returns
true if so
Description
Is the ODBC Extended SQL grammar supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsFullOuterJoins

DatabaseMetaData.supportsFullOuterJoins

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsFullOuterJoins() throws SQLException
Returns
true if so
Description
Are full nested outer joins supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsGroupBy

DatabaseMetaData.supportsGroupBy

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsGroupBy() throws SQLException
Returns
true if so
Description
Is some form of "GROUP BY" clause supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsGroupByBeyondSelect

DatabaseMetaData.supportsGroupByBeyondSelect

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsGroupByBeyondSelect() throws SQLException
Returns
true if so
Description
Can a "GROUP BY" clause add columns not in the SELECT provided it specifies all the columns in the SELECT?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsGroupByUnrelated

DatabaseMetaData.supportsGroupByUnrelated

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsGroupByUnrelated() throws SQLException
Returns
true if so
Description
Can a "GROUP BY" clause use columns not in the SELECT?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsIntegrityEnhancementFacility

DatabaseMetaData.supportsIntegrityEnhancementFacility

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsIntegrityEnhancementFacility() throws SQLException
Returns
true if so
Description
Is the SQL Integrity Enhancement Facility supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsLikeEscapeClause

DatabaseMetaData.supportsLikeEscapeClause

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsLikeEscapeClause() throws SQLException
Returns
true if so
Description
Is the escape character in "LIKE" clauses supported? A JDBC-Compliant driver always returns true.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsLimitedOuterJoins

DatabaseMetaData.supportsLimitedOuterJoins

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsLimitedOuterJoins() throws SQLException
Returns
true if so
Description
Is there limited support for outer joins? (This will be true if supportFullOuterJoins is true.)

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsMinimumSQLGrammar

DatabaseMetaData.supportsMinimumSQLGrammar

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsMinimumSQLGrammar() throws SQLException
Returns
true if so
Description
Is the ODBC Minimum SQL grammar supported? All JDBC-Compliant drivers must return true.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsMixedCaseIdentifiers

DatabaseMetaData.supportsMixedCaseIdentifiers

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsMixedCaseIdentifiers() throws SQLException
Returns
true if so
Description
Does the database treat mixed case unquoted SQL identifiers as case sensitive and as a result store them in mixed case? A JDBC-Compliant driver will always return false.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsMixedCaseQuotedIdentifiers

DatabaseMetaData.supportsMixedCaseQuotedIdentifiers

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsMixedCaseQuotedIdentifiers() throws SQLException
Returns
true if so
Description
Does the database treat mixed case quoted SQL identifiers as case sensitive and as a result store them in mixed case? A JDBC-Compliant driver will always return true.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsMultipleResultSets

DatabaseMetaData.supportsMultipleResultSets

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsMultipleResultSets() throws SQLException
Returns
true if so
Description
Are multiple ResultSets from a single execute supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsMultipleTransactions

DatabaseMetaData.supportsMultipleTransactions

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsMultipleTransactions() throws SQLException
Returns
true if so
Description
Can we have multiple transactions open at once (on different connections)?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsNonNullableColumns

DatabaseMetaData.supportsNonNullableColumns

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsNonNullableColumns() throws SQLException
Returns
true if so
Description
Can columns be defined as non-nullable? A JDBC-Compliant driver always returns true.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsOpenCursorsAcrossCommit

DatabaseMetaData.supportsOpenCursorsAcrossCommit

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsOpenCursorsAcrossCommit() throws SQLException
Returns
true if cursors always remain open; false if they might not remain open
Description
Can cursors remain open across commits?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsOpenCursorsAcrossRollback

DatabaseMetaData.supportsOpenCursorsAcrossRollback

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsOpenCursorsAcrossRollback() throws SQLException
Returns
true if cursors always remain open; false if they might not remain open
Description
Can cursors remain open across rollbacks?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsOpenStatementsAcrossCommit

DatabaseMetaData.supportsOpenStatementsAcrossCommit

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsOpenStatementsAcrossCommit() throws SQLException
Returns
true if statements always remain open; false if they might not remain open
Description
Can statements remain open across commits?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsOpenStatementsAcrossRollback

DatabaseMetaData.supportsOpenStatementsAcrossRollback

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsOpenStatementsAcrossRollback() throws SQLException
Returns
true if statements always remain open; false if they might not remain open
Description
Can statements remain open across rollbacks?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsOrderByUnrelated

DatabaseMetaData.supportsOrderByUnrelated

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsOrderByUnrelated() throws SQLException
Returns
true if so
Description
Can an "ORDER BY" clause use columns not in the SELECT?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsOuterJoins

DatabaseMetaData.supportsOuterJoins

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsOuterJoins() throws SQLException
Returns
true if so
Description
Is some form of outer join supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsPositionedDelete

DatabaseMetaData.supportsPositionedDelete

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsPositionedDelete() throws SQLException
Returns
true if so
Description
Is positioned DELETE supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsPositionedUpdate

DatabaseMetaData.supportsPositionedUpdate

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsPositionedUpdate() throws SQLException
Returns
true if so
Description
Is positioned UPDATE supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsSchemasInDataManipulation

DatabaseMetaData.supportsSchemasInDataManipulation

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsSchemasInDataManipulation() throws SQLException
Returns
true if so
Description
Can a schema name be used in a data manipulation statement?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsSchemasInIndexDefinitions

DatabaseMetaData.supportsSchemasInIndexDefinitions

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsSchemasInIndexDefinitions() throws SQLException
Returns
true if so
Description
Can a schema name be used in an index definition statement?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsSchemasInPrivilegeDefinitions

DatabaseMetaData.supportsSchemasInPrivilegeDefinitions

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsSchemasInPrivilegeDefinitions() throws SQLException
Returns
true if so
Description
Can a schema name be used in a privilege definition statement?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsSchemasInProcedureCalls

DatabaseMetaData.supportsSchemasInProcedureCalls

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsSchemasInProcedureCalls() throws SQLException
Returns
true if so
Description
Can a schema name be used in a procedure call statement?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsSchemasInTableDefinitions

DatabaseMetaData.supportsSchemasInTableDefinitions

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsSchemasInTableDefinitions() throws SQLException
Returns
true if so
Description
Can a schema name be used in a table definition statement?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsSelectForUpdate

DatabaseMetaData.supportsSelectForUpdate

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsSelectForUpdate() throws SQLException
Returns
true if so
Description
Is SELECT for UPDATE supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsStoredProcedures

DatabaseMetaData.supportsStoredProcedures

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsStoredProcedures() throws SQLException
Returns
true if so
Description
Are stored procedure calls using the stored procedure escape syntax supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsSubqueriesInComparisons

DatabaseMetaData.supportsSubqueriesInComparisons

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsSubqueriesInComparisons() throws SQLException
Returns
true if so
Description
Are subqueries in comparison expressions supported? A JDBC-Compliant driver always returns true.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsSubqueriesInExists

DatabaseMetaData.supportsSubqueriesInExists

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsSubqueriesInExists() throws SQLException
Returns
true if so
Description
Are subqueries in 'exists' expressions supported? A JDBC-Compliant driver always returns true.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsSubqueriesInIns

DatabaseMetaData.supportsSubqueriesInIns

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsSubqueriesInIns() throws SQLException
Returns
true if so
Description
Are subqueries in 'in' statements supported? A JDBC-Compliant driver always returns true.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsSubqueriesInQuantifieds

DatabaseMetaData.supportsSubqueriesInQuantifieds

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsSubqueriesInQuantifieds() throws SQLException
Returns
true if so
Description
Are subqueries in quantified expressions supported? A JDBC-Compliant driver always returns true.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsTableCorrelationNames

DatabaseMetaData.supportsTableCorrelationNames

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsTableCorrelationNames() throws SQLException
Returns
true if so
Description
Are table correlation names supported? A JDBC-Compliant driver always returns true.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsTransactionIsolationLevel

DatabaseMetaData.supportsTransactionIsolationLevel

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsTransactionIsolationLevel( int level ) throws SQLException
Parameters
level
the values are defined in java.sql.Connection
Returns
true if so
Description
Does the database support the given transaction isolation level?

Exceptions
SQLException if a database-access error occurs.
See Also
Connection


 DatabaseMetaData.supportsTransactions

DatabaseMetaData.supportsTransactions

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsTransactions() throws SQLException
Returns
true if transactions are supported
Description
Are transactions supported? If not, commit is a noop and the isolation level is TRANSACTION_NONE.

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsUnion

DatabaseMetaData.supportsUnion

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsUnion() throws SQLException
Returns
true if so
Description
Is SQL UNION supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.supportsUnionAll

DatabaseMetaData.supportsUnionAll

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean supportsUnionAll() throws SQLException
Returns
true if so
Description
Is SQL UNION ALL supported?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.usesLocalFilePerTable

DatabaseMetaData.usesLocalFilePerTable

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean usesLocalFilePerTable() throws SQLException
Returns
true if the database uses a local file for each table
Description
Does the database use a file for each table?

Exceptions
SQLException if a database-access error occurs.


 DatabaseMetaData.usesLocalFiles

DatabaseMetaData.usesLocalFiles

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean usesLocalFiles() throws SQLException
Returns
true if so
Description
Does the database store tables in a local file?

Exceptions
SQLException if a database-access error occurs.


 Class Date

Class java.sql.Date

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.Date
           |
           +----java.sql.Date

public class Date
extends Date

This class is a thin wrapper around java.util.Date that allows JDBC to identify this as a SQL DATE value. It adds formatting and parsing operations to support the JDBC escape syntax for date values.


 Date Members

Date Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Date(int, int, int) | Construct a Date
Date(long) | Construct a Date using a milliseconds time value

Methods
Name | Description
getHours() | Returns the hour represented by this date.
getMinutes() | Returns the number of minutes past the hour represented by this date.
getSeconds() | Returns the number of seconds past the minute represented by this date.
setHours(int) | Sets the hour of this date to the specified value.
setMinutes(int) | Sets the minutes of this date to the specified value.
setSeconds(int) | Sets the seconds of this date to the specified value.
setTime(long) | Set a Date using a milliseconds time value
toString() | Format a date in JDBC date escape format
valueOf(String) | Convert a string in JDBC date escape format to a Date value


 Date.Date

Date.Date

Syntax 1
public Date( int year, int month, int day )
Parameters
year
year-1900
month
0 to 11
day
1 to 31
Description
Construct a Date

Syntax 2
public Date( long date )
Parameters
date
milliseconds since January 1, 1970, 00:00:00 GMT
Description
Construct a Date using a milliseconds time value


 Date.getHours

Date.getHours

Syntax
public int getHours()
Description
Returns the hour represented by this date.

Overrides
getHours in class Date


 Date.getMinutes

Date.getMinutes

Syntax
public int getMinutes()
Description
Returns the number of minutes past the hour represented by this date.

Overrides
getMinutes in class Date


 Date.getSeconds

Date.getSeconds

Syntax
public int getSeconds()
Description
Returns the number of seconds past the minute represented by this date.

Overrides
getSeconds in class Date


 Date.setHours

Date.setHours

Syntax
public void setHours( int i )
Description
Sets the hour of this date to the specified value.

Overrides
setHours in class Date


 Date.setMinutes

Date.setMinutes

Syntax
public void setMinutes( int i )
Description
Sets the minutes of this date to the specified value.

Overrides
setMinutes in class Date


 Date.setSeconds

Date.setSeconds

Syntax
public void setSeconds( int i )
Description
Sets the seconds of this date to the specified value.

Overrides
setSeconds in class Date


 Date.setTime

Date.setTime

Syntax
public void setTime( long date )
Parameters
date
milliseconds since January 1, 1970, 00:00:00 GMT
Description
Set a Date using a milliseconds time value

Overrides
setTime in class Date


 Date.toString

Date.toString

Syntax
public String toString()
Returns
a String in yyyy-mm-dd format
Description
Format a date in JDBC date escape format

Overrides
toString in class Date


 Date.valueOf

Date.valueOf

Syntax
public static Date valueOf( String s )
Parameters
s
date in format "yyyy-mm-dd"
Returns
corresponding Date
Description
Convert a string in JDBC date escape format to a Date value


 Interface Driver

Interface java.sql.Driver

Interface Members | This Package | All Packages

public interface Driver

The Java SQL framework allows for multiple database drivers.

Each driver should supply a class that implements the Driver interface.

The DriverManager will try to load as many drivers as it can find and then for any given connection request, it will ask each driver in turn to try to connect to the target URL.

It is strongly recommended that each Driver class should be small and standalone so that the Driver class can be loaded and queried without bringing in vast quantities of supporting code.

When a Driver class is loaded, it should create an instance of itself and register it with the DriverManager. This means that a user can load and register a driver by doing Class.forName("foo.bah.Driver").

See Also:
DriverManager, Connection


 Driver Members

Driver Members

Interface Overview | This Package | All Packages

Methods
Name | Description
acceptsURL(String) | Returns true if the driver thinks that it can open a connection to the given URL.
connect(String, Properties) | Try to make a database connection to the given URL.
getMajorVersion() | Get the driver's major version number.
getMinorVersion() | Get the driver's minor version number.
getPropertyInfo(String, Properties) | The getPropertyInfo method is intended to allow a generic GUI tool to discover what properties it should prompt a human for in order to get enough information to connect to a database.
jdbcCompliant() | Report whether the Driver is a genuine JDBC COMPLIANT (tm) driver.


 Driver.acceptsURL

Driver.acceptsURL

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean acceptsURL( String url ) throws SQLException
Parameters
url
The URL of the database.
Returns
True if this driver can connect to the given URL.
Description
Returns true if the driver thinks that it can open a connection to the given URL. Typically drivers will return true if they understand the subprotocol specified in the URL and false if they don't.

Exceptions
SQLException if a database-access error occurs.


 Driver.connect

Driver.connect

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Connection connect( String url, Properties info ) throws SQLException
Parameters
url
The URL of the database to connect to
info
a list of arbitrary string tag/value pairs as connection arguments; normally at least a "user" and "password" property should be included
Returns
a Connection to the URL
Description
Try to make a database connection to the given URL. The driver should return "null" if it realizes it is the wrong kind of driver to connect to the given URL. This will be common, as when the JDBC driver manager is asked to connect to a given URL it passes the URL to each loaded driver in turn.

The driver should raise a SQLException if it is the right driver to connect to the given URL, but has trouble connecting to the database.

The java.util.Properties argument can be used to passed arbitrary string tag/value pairs as connection arguments. Normally at least "user" and "password" properties should be included in the Properties.

Exceptions
SQLException if a database-access error occurs.


 Driver.getMajorVersion

Driver.getMajorVersion

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMajorVersion()
Description
Get the driver's major version number. Initially this should be 1.


 Driver.getMinorVersion

Driver.getMinorVersion

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMinorVersion()
Description
Get the driver's minor version number. Initially this should be 0.


 Driver.getPropertyInfo

Driver.getPropertyInfo

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract DriverPropertyInfo[] getPropertyInfo( String url, Properties info ) throws SQLException
Parameters
url
The URL of the database to connect to.
info
A proposed list of tag/value pairs that will be sent on connect open.
Returns
An array of DriverPropertyInfo objects describing possible properties. This array may be an empty array if no properties are required.
Description

The getPropertyInfo method is intended to allow a generic GUI tool to discover what properties it should prompt a human for in order to get enough information to connect to a database. Note that depending on the values the human has supplied so far, additional values may become necessary, so it may be necessary to iterate though several calls to getPropertyInfo.

Exceptions
SQLException if a database-access error occurs.


 Driver.jdbcCompliant

Driver.jdbcCompliant

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean jdbcCompliant()
Description
Report whether the Driver is a genuine JDBC COMPLIANT (tm) driver. A driver may only report "true" here if it passes the JDBC compliance tests, otherwise it is required to return false. JDBC compliance requires full support for the JDBC API and full support for SQL 92 Entry Level. It is expected that JDBC compliant drivers will be available for all the major commercial databases. This method is not intended to encourage the development of non-JDBC compliant drivers, but is a recognition of the fact that some vendors are interested in using the JDBC API and framework for lightweight databases that do not support full database functionality, or for special databases such as document information retrieval where a SQL implementation may not be feasible.


 Class DriverManager

Class java.sql.DriverManager

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.sql.DriverManager

public class DriverManager
extends Object

The DriverManager provides a basic service for managing a set of JDBC drivers.

As part of its initialization, the DriverManager class will attempt to load the driver classes referenced in the "jdbc.drivers" system property. This allows a user to customize the JDBC Drivers used by their applications. For example in your ~/.hotjava/properties file you might specify: jdbc.drivers=foo.bah.Driver:wombat.sql.Driver:bad.taste.ourDriver A program can also explicitly load JDBC drivers at any time. For example, the my.sql.Driver is loaded with the following statement: Class.forName("my.sql.Driver");

When getConnection is called the DriverManager will attempt to locate a suitable driver from amongst those loaded at initialization and those loaded explicitly using the same classloader as the current applet or application.

See Also:
Driver, Connection


 DriverManager Members

DriverManager Members

Class Overview | This Package | All Packages

Methods
Name | Description
deregisterDriver(Driver) | Drop a Driver from the DriverManager's list.
getConnection(String) | Attempt to establish a connection to the given database URL.
getConnection(String, Properties) | Attempt to establish a connection to the given database URL.
getConnection(String, String, String) | Attempt to establish a connection to the given database URL.
getDriver(String) | Attempt to locate a driver that understands the given URL.
getDrivers() | Return an Enumeration of all the currently loaded JDBC drivers which the current caller has access to.
getLoginTimeout() | Get the maximum time in seconds that all drivers can wait when attempting to log in to a database.
getLogStream() | Get the logging/tracing PrintStream that is used by the DriverManager and all drivers.
println(String) | Print a message to the current JDBC log stream
registerDriver(Driver) | A newly loaded driver class should call registerDriver to make itself known to the DriverManager.
setLoginTimeout(int) | Set the maximum time in seconds that all drivers can wait when attempting to log in to a database.
setLogStream(PrintStream) | Set the logging/tracing PrintStream that is used by the DriverManager and all drivers.


 DriverManager.deregisterDriver

DriverManager.deregisterDriver

Syntax
public static void deregisterDriver( Driver driver ) throws SQLException
Parameters
driver
the JDBC Driver to drop
Description
Drop a Driver from the DriverManager's list. Applets can only deregister Drivers from their own classloader.

Exceptions
SQLException if a database-access error occurs.


 DriverManager.getConnection

DriverManager.getConnection

Syntax 1
public static synchronized Connection getConnection( String url, Properties info ) throws SQLException
Parameters
url
a database url of the form jdbc:subprotocol:subname
info
a list of arbitrary string tag/value pairs as connection arguments; normally at least a "user" and "password" property should be included
Returns
a Connection to the URL
Description
Attempt to establish a connection to the given database URL. The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers.

Exceptions
SQLException if a database-access error occurs.

Syntax 2
public static synchronized Connection getConnection( String url, String user, String password ) throws SQLException
Parameters
url
a database url of the form jdbc:subprotocol:subname
user
the database user on whose behalf the Connection is being made
password
the user's password
Returns
a Connection to the URL
Description
Attempt to establish a connection to the given database URL. The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers.

Exceptions
SQLException if a database-access error occurs.

Syntax 3
public static synchronized Connection getConnection( String url ) throws SQLException
Parameters
url
a database url of the form jdbc:subprotocol:subname
Returns
a Connection to the URL
Description
Attempt to establish a connection to the given database URL. The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers.

Exceptions
SQLException if a database-access error occurs.


 DriverManager.getDriver

DriverManager.getDriver

Syntax
public static Driver getDriver( String url ) throws SQLException
Parameters
url
a database url of the form jdbc:subprotocol:subname
Returns
a Driver that can connect to the URL
Description
Attempt to locate a driver that understands the given URL. The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers.

Exceptions
SQLException if a database-access error occurs.


 DriverManager.getDrivers

DriverManager.getDrivers

Syntax
public static Enumeration getDrivers()
Returns
the list of JDBC Drivers loaded by the caller's class loader
Description
Return an Enumeration of all the currently loaded JDBC drivers which the current caller has access to.

Note: The classname of a driver can be found using d.getClass().getName()


 DriverManager.getLoginTimeout

DriverManager.getLoginTimeout

Syntax
public static int getLoginTimeout()
Returns
the driver login time limit
Description
Get the maximum time in seconds that all drivers can wait when attempting to log in to a database.


 DriverManager.getLogStream

DriverManager.getLogStream

Syntax
public static PrintStream getLogStream()
Returns
the logging/tracing PrintStream; if disabled, is null
Description
Get the logging/tracing PrintStream that is used by the DriverManager and all drivers.


 DriverManager.println

DriverManager.println

Syntax
public static void println( String message )
Parameters
message
a log or tracing message
Description
Print a message to the current JDBC log stream


 DriverManager.registerDriver

DriverManager.registerDriver

Syntax
public static synchronized void registerDriver( Driver driver ) throws SQLException
Parameters
driver
the new JDBC Driver
Description
A newly loaded driver class should call registerDriver to make itself known to the DriverManager.

Exceptions
SQLException if a database-access error occurs.


 DriverManager.setLoginTimeout

DriverManager.setLoginTimeout

Syntax
public static void setLoginTimeout( int seconds )
Parameters
seconds
the driver login time limit
Description
Set the maximum time in seconds that all drivers can wait when attempting to log in to a database.


 DriverManager.setLogStream

DriverManager.setLogStream

Syntax
public static void setLogStream( PrintStream out )
Parameters
out
the new logging/tracing PrintStream; to disable, set to null
Description
Set the logging/tracing PrintStream that is used by the DriverManager and all drivers.


 Class DriverPropertyInfo

Class java.sql.DriverPropertyInfo

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.sql.DriverPropertyInfo

public class DriverPropertyInfo
extends Object

The DriverPropertyInfo class is only of interest to advanced programmers who need to interact with a Driver via getDriverProperties to discover and supply properties for connections.


 DriverPropertyInfo Members

DriverPropertyInfo Members

Class Overview | This Package | All Packages

Fields
Name | Description
choices | If the value may be selected from a particular set of values, then this is an array of the possible values.
description | A brief description of the property.
name | The name of the property.
required | "required" is true if a value must be supplied for this property during Driver.connect.
value | "value" specifies the current value of the property, based on a combination of the information supplied to getPropertyInfo, the Java environment, and driver supplied default values.

Constructors
Name | Description
DriverPropertyInfo(String, String) | Constructor a DriverPropertyInfo with a name and value; other members default to their initial values.


 DriverPropertyInfo.choices

DriverPropertyInfo.choices

Syntax
public String choices[]
Description
If the value may be selected from a particular set of values, then this is an array of the possible values. Otherwise it should be null.


 DriverPropertyInfo.description

DriverPropertyInfo.description

Syntax
public String description
Description
A brief description of the property. This may be null.


 DriverPropertyInfo.name

DriverPropertyInfo.name

Syntax
public String name
Description
The name of the property.


 DriverPropertyInfo.required

DriverPropertyInfo.required

Syntax
public boolean required
Description
"required" is true if a value must be supplied for this property during Driver.connect. Otherwise the property is optional.


 DriverPropertyInfo.value

DriverPropertyInfo.value

Syntax
public String value
Description
"value" specifies the current value of the property, based on a combination of the information supplied to getPropertyInfo, the Java environment, and driver supplied default values. This may be null if no value is known.


 DriverPropertyInfo.DriverPropertyInfo

DriverPropertyInfo.DriverPropertyInfo

Syntax
public DriverPropertyInfo( String name, String value )
Parameters
name
the name of the property
value
the current value, which may be null
Description
Constructor a DriverPropertyInfo with a name and value; other members default to their initial values.


 Interface PreparedStatement

Interface java.sql.PreparedStatement

Interface Members | This Package | All Packages

public interface PreparedStatement
extends Statement

A SQL statement is pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.

Note: The setXXX methods for setting IN parameter values must specify types that are compatible with the defined SQL type of the input parameter. For instance, if the IN parameter has SQL type Integer then setInt should be used.

If arbitrary parameter type conversions are required then the setObject method should be used with a target SQL type.

See Also:
prepareStatement, ResultSet


 PreparedStatement Members

PreparedStatement Members

Interface Overview | This Package | All Packages

Methods
Name | Description
clearParameters() | In general, parameter values remain in force for repeated use of a Statement.
execute() | Some prepared statements return multiple results; the execute method handles these complex statements as well as the simpler form of statements handled by executeQuery and executeUpdate.
executeQuery() | A prepared SQL query is executed and its ResultSet is returned.
executeUpdate() | Execute a SQL INSERT, UPDATE or DELETE statement.
setAsciiStream(int, InputStream, int) | When a very large ASCII value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.InputStream.
setBigDecimal(int, BigDecimal) | Set a parameter to a java.lang.BigDecimal value.
setBinaryStream(int, InputStream, int) | When a very large binary value is input to a LONGVARBINARY parameter, it may be more practical to send it via a java.io.InputStream.
setBoolean(int, boolean) | Set a parameter to a Java boolean value.
setByte(int, byte) | Set a parameter to a Java byte value.
setBytes(int, byte[]) | Set a parameter to a Java array of bytes.
setDate(int, Date) | Set a parameter to a java.sql.Date value.
setDouble(int, double) | Set a parameter to a Java double value.
setFloat(int, float) | Set a parameter to a Java float value.
setInt(int, int) | Set a parameter to a Java int value.
setLong(int, long) | Set a parameter to a Java long value.
setNull(int, int) | Set a parameter to SQL NULL.
setObject(int, Object) | Set the value of a parameter using an object; use the java.lang equivalent objects for integral values.
setObject(int, Object, int) | This method is like setObject above, but assumes a scale of zero.
setObject(int, Object, int, int) | Set the value of a parameter using an object; use the java.lang equivalent objects for integral values.
setShort(int, short) | Set a parameter to a Java short value.
setString(int, String) | Set a parameter to a Java String value.
setTime(int, Time) | Set a parameter to a java.sql.Time value.
setTimestamp(int, Timestamp) | Set a parameter to a java.sql.Timestamp value.
setUnicodeStream(int, InputStream, int) | When a very large UNICODE value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.InputStream.


 PreparedStatement.clearParameters

PreparedStatement.clearParameters

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void clearParameters() throws SQLException
Description

In general, parameter values remain in force for repeated use of a Statement. Setting a parameter value automatically clears its previous value. However, in some cases it is useful to immediately release the resources used by the current parameter values; this can be done by calling clearParameters.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.execute

PreparedStatement.execute

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean execute() throws SQLException
Description
Some prepared statements return multiple results; the execute method handles these complex statements as well as the simpler form of statements handled by executeQuery and executeUpdate.

Exceptions
SQLException if a database-access error occurs.
See Also
execute


 PreparedStatement.executeQuery

PreparedStatement.executeQuery

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet executeQuery() throws SQLException
Returns
a ResultSet that contains the data produced by the query; never null
Description
A prepared SQL query is executed and its ResultSet is returned.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.executeUpdate

PreparedStatement.executeUpdate

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int executeUpdate() throws SQLException
Returns
either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing
Description
Execute a SQL INSERT, UPDATE or DELETE statement. In addition, SQL statements that return nothing such as SQL DDL statements can be executed.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.setAsciiStream

PreparedStatement.setAsciiStream

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setAsciiStream( int parameterIndex, InputStream x, int length ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
x
the java input stream which contains the ASCII parameter value
length
the number of bytes in the stream
Description
When a very large ASCII value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.InputStream. JDBC will read the data from the stream as needed, until it reaches end-of-file. The JDBC driver will do any necessary conversion from ASCII to the database char format.

Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.setBigDecimal

PreparedStatement.setBigDecimal

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setBigDecimal( int parameterIndex, BigDecimal x ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
x
the parameter value
Description
Set a parameter to a java.lang.BigDecimal value. The driver converts this to a SQL NUMERIC value when it sends it to the database.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.setBinaryStream

PreparedStatement.setBinaryStream

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setBinaryStream( int parameterIndex, InputStream x, int length ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
x
the java input stream which contains the binary parameter value
length
the number of bytes in the stream
Description
When a very large binary value is input to a LONGVARBINARY parameter, it may be more practical to send it via a java.io.InputStream. JDBC will read the data from the stream as needed, until it reaches end-of-file.

Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.setBoolean

PreparedStatement.setBoolean

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setBoolean( int parameterIndex, boolean x ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
x
the parameter value
Description
Set a parameter to a Java boolean value. The driver converts this to a SQL BIT value when it sends it to the database.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.setByte

PreparedStatement.setByte

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setByte( int parameterIndex, byte x ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
x
the parameter value
Description
Set a parameter to a Java byte value. The driver converts this to a SQL TINYINT value when it sends it to the database.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.setBytes

PreparedStatement.setBytes

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setBytes( int parameterIndex, byte x[] ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
x
the parameter value
Description
Set a parameter to a Java array of bytes. The driver converts this to a SQL VARBINARY or LONGVARBINARY (depending on the argument's size relative to the driver's limits on VARBINARYs) when it sends it to the database.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.setDate

PreparedStatement.setDate

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setDate( int parameterIndex, Date x ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
x
the parameter value
Description
Set a parameter to a java.sql.Date value. The driver converts this to a SQL DATE value when it sends it to the database.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.setDouble

PreparedStatement.setDouble

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setDouble( int parameterIndex, double x ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
x
the parameter value
Description
Set a parameter to a Java double value. The driver converts this to a SQL DOUBLE value when it sends it to the database.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.setFloat

PreparedStatement.setFloat

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setFloat( int parameterIndex, float x ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
x
the parameter value
Description
Set a parameter to a Java float value. The driver converts this to a SQL FLOAT value when it sends it to the database.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.setInt

PreparedStatement.setInt

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setInt( int parameterIndex, int x ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
x
the parameter value
Description
Set a parameter to a Java int value. The driver converts this to a SQL INTEGER value when it sends it to the database.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.setLong

PreparedStatement.setLong

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setLong( int parameterIndex, long x ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
x
the parameter value
Description
Set a parameter to a Java long value. The driver converts this to a SQL BIGINT value when it sends it to the database.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.setNull

PreparedStatement.setNull

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setNull( int parameterIndex, int sqlType ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
sqlType
SQL type code defined by java.sql.Types
Description
Set a parameter to SQL NULL.

Note: You must specify the parameter's SQL type.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.setObject

PreparedStatement.setObject

Interface Overview | Interface Members | This Package | All Packages

Syntax 1
public abstract void setObject( int parameterIndex, Object x, int targetSqlType, int scale ) throws SQLException
Parameters
parameterIndex
The first parameter is 1, the second is 2, ...
x
The object containing the input parameter value
targetSqlType
The SQL type (as defined in java.sql.Types) to be sent to the database. The scale argument may further qualify this type.
scale
For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types this is the number of digits after the decimal. For all other types this value will be ignored,
Description

Set the value of a parameter using an object; use the java.lang equivalent objects for integral values.

The given Java object will be converted to the targetSqlType before being sent to the database.

Note that this method may be used to pass datatabase- specific abstract data types. This is done by using a Driver- specific Java type and using a targetSqlType of java.sql.types.OTHER.

Exceptions
SQLException if a database-access error occurs.
See Also
Types

Syntax 2
public abstract void setObject( int parameterIndex, Object x, int targetSqlType ) throws SQLException
Description
This method is like setObject above, but assumes a scale of zero.

Exceptions
SQLException if a database-access error occurs.

Syntax 3
public abstract void setObject( int parameterIndex, Object x ) throws SQLException
Parameters
parameterIndex
The first parameter is 1, the second is 2, ...
x
The object containing the input parameter value
Description

Set the value of a parameter using an object; use the java.lang equivalent objects for integral values.

The JDBC specification specifies a standard mapping from Java Object types to SQL types. The given argument java object will be converted to the corresponding SQL type before being sent to the database.

Note that this method may be used to pass datatabase specific abstract data types, by using a Driver specific Java type.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.setShort

PreparedStatement.setShort

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setShort( int parameterIndex, short x ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
x
the parameter value
Description
Set a parameter to a Java short value. The driver converts this to a SQL SMALLINT value when it sends it to the database.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.setString

PreparedStatement.setString

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setString( int parameterIndex, String x ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
x
the parameter value
Description
Set a parameter to a Java String value. The driver converts this to a SQL VARCHAR or LONGVARCHAR value (depending on the arguments size relative to the driver's limits on VARCHARs) when it sends it to the database.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.setTime

PreparedStatement.setTime

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setTime( int parameterIndex, Time x ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
x
the parameter value
Description
Set a parameter to a java.sql.Time value. The driver converts this to a SQL TIME value when it sends it to the database.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.setTimestamp

PreparedStatement.setTimestamp

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setTimestamp( int parameterIndex, Timestamp x ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
x
the parameter value
Description
Set a parameter to a java.sql.Timestamp value. The driver converts this to a SQL TIMESTAMP value when it sends it to the database.

Exceptions
SQLException if a database-access error occurs.


 PreparedStatement.setUnicodeStream

PreparedStatement.setUnicodeStream

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setUnicodeStream( int parameterIndex, InputStream x, int length ) throws SQLException
Parameters
parameterIndex
the first parameter is 1, the second is 2, ...
x
the java input stream which contains the UNICODE parameter value
length
the number of bytes in the stream
Description
When a very large UNICODE value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.InputStream. JDBC will read the data from the stream as needed, until it reaches end-of-file. The JDBC driver will do any necessary conversion from UNICODE to the database char format.

Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.

Exceptions
SQLException if a database-access error occurs.


 Interface ResultSet

Interface java.sql.ResultSet

Interface Members | This Package | All Packages

public interface ResultSet

A ResultSet provides access to a table of data generated by executing a Statement. The table rows are retrieved in sequence. Within a row its column values can be accessed in any order.

A ResultSet maintains a cursor pointing to its current row of data. Initially the cursor is positioned before the first row. The 'next' method moves the cursor to the next row.

The getXXX methods retrieve column values for the current row. You can retrieve values either using the index number of the column, or by using the name of the column. In general using the column index will be more efficient. Columns are numbered from 1.

For maximum portability, ResultSet columns within each row should be read in left-to-right order and each column should be read only once.

For the getXXX methods, the JDBC driver attempts to convert the underlying data to the specified Java type and returns a suitable Java value. See the JDBC specification for allowable mappings from SQL types to Java types with the ResultSet.getXXX methods.

Column names used as input to getXXX methods are case insensitive. When performing a getXXX using a column name, if several columns have the same name, then the value of the first matching column will be returned. The column name option is designed to be used when column names are used in the SQL query. For columns that are NOT explicitly named in the query, it is best to use column numbers. If column names were used there is no way for the programmer to guarantee that they actually refer to the intended columns.

A ResultSet is automatically closed by the Statement that generated it when that Statement is closed, re-executed, or is used to retrieve the next result from a sequence of multiple results.

The number, types and properties of a ResultSet's columns are provided by the ResulSetMetaData object returned by the getMetaData method.

See Also:
executeQuery, getResultSet, ResultSetMetaData


 ResultSet Members

ResultSet Members

Interface Overview | This Package | All Packages

Methods
Name | Description
clearWarnings() | After this call getWarnings returns null until a new warning is reported for this ResultSet.
close() | In some cases, it is desirable to immediately release a ResultSet's database and JDBC resources instead of waiting for this to happen when it is automatically closed; the close method provides this immediate release.
findColumn(String) | Map a Resultset column name to a ResultSet column index.
getAsciiStream(int) | A column value can be retrieved as a stream of ASCII characters and then read in chunks from the stream.
getAsciiStream(String) | A column value can be retrieved as a stream of ASCII characters and then read in chunks from the stream.
getBigDecimal(int, int) | Get the value of a column in the current row as a java.lang.BigDecimal object.
getBigDecimal(String, int) | Get the value of a column in the current row as a java.lang.BigDecimal object.
getBinaryStream(int) | A column value can be retrieved as a stream of uninterpreted bytes and then read in chunks from the stream.
getBinaryStream(String) | A column value can be retrieved as a stream of uninterpreted bytes and then read in chunks from the stream.
getBoolean(int) | Get the value of a column in the current row as a Java boolean.
getBoolean(String) | Get the value of a column in the current row as a Java boolean.
getByte(int) | Get the value of a column in the current row as a Java byte.
getByte(String) | Get the value of a column in the current row as a Java byte.
getBytes(int) | Get the value of a column in the current row as a Java byte array.
getBytes(String) | Get the value of a column in the current row as a Java byte array.
getCursorName() | Get the name of the SQL cursor used by this ResultSet.
getDate(int) | Get the value of a column in the current row as a java.sql.Date object.
getDate(String) | Get the value of a column in the current row as a java.sql.Date object.
getDouble(int) | Get the value of a column in the current row as a Java double.
getDouble(String) | Get the value of a column in the current row as a Java double.
getFloat(int) | Get the value of a column in the current row as a Java float.
getFloat(String) | Get the value of a column in the current row as a Java float.
getInt(int) | Get the value of a column in the current row as a Java int.
getInt(String) | Get the value of a column in the current row as a Java int.
getLong(int) | Get the value of a column in the current row as a Java long.
getLong(String) | Get the value of a column in the current row as a Java long.
getMetaData() | The number, types and properties of a ResultSet's columns are provided by the getMetaData method.
getObject(int) | Get the value of a column in the current row as a Java object.
getObject(String) | Get the value of a column in the current row as a Java object.
getShort(int) | Get the value of a column in the current row as a Java short.
getShort(String) | Get the value of a column in the current row as a Java short.
getString(int) | Get the value of a column in the current row as a Java String.
getString(String) | Get the value of a column in the current row as a Java String.
getTime(int) | Get the value of a column in the current row as a java.sql.Time object.
getTime(String) | Get the value of a column in the current row as a java.sql.Time object.
getTimestamp(int) | Get the value of a column in the current row as a java.sql.Timestamp object.
getTimestamp(String) | Get the value of a column in the current row as a java.sql.Timestamp object.
getUnicodeStream(int) | A column value can be retrieved as a stream of Unicode characters and then read in chunks from the stream.
getUnicodeStream(String) | A column value can be retrieved as a stream of Unicode characters and then read in chunks from the stream.
getWarnings() | The first warning reported by calls on this ResultSet is returned.
next() | A ResultSet is initially positioned before its first row; the first call to next makes the first row the current row; the second call makes the second row the current row, etc.
wasNull() | A column may have the value of SQL NULL; wasNull reports whether the last column read had this special value.


 ResultSet.clearWarnings

ResultSet.clearWarnings

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void clearWarnings() throws SQLException
Description
After this call getWarnings returns null until a new warning is reported for this ResultSet.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.close

ResultSet.close

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void close() throws SQLException
Description
In some cases, it is desirable to immediately release a ResultSet's database and JDBC resources instead of waiting for this to happen when it is automatically closed; the close method provides this immediate release.

Note: A ResultSet is automatically closed by the Statement that generated it when that Statement is closed, re-executed, or is used to retrieve the next result from a sequence of multiple results. A ResultSet is also automatically closed when it is garbage collected.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.findColumn

ResultSet.findColumn

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int findColumn( String columnName ) throws SQLException
Parameters
columnName
the name of the column
Returns
the column index
Description
Map a Resultset column name to a ResultSet column index.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getAsciiStream

ResultSet.getAsciiStream

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract InputStream getAsciiStream( int columnIndex ) throws SQLException
Parameters
columnIndex
the first column is 1, the second is 2, ...
Returns
a Java input stream that delivers the database column value as a stream of one byte ASCII characters. If the value is SQL NULL then the result is null.
Description
A column value can be retrieved as a stream of ASCII characters and then read in chunks from the stream. This method is particularly suitable for retrieving large LONGVARCHAR values. The JDBC driver will do any necessary conversion from the database format into ASCII.

Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a get method implicitly closes the stream. . Also, a stream may return 0 for available() whether there is data available or not.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getAsciiStream

ResultSet.getAsciiStream

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract InputStream getAsciiStream( String columnName ) throws SQLException
Parameters
columnName
is the SQL name of the column
Returns
a Java input stream that delivers the database column value as a stream of one byte ASCII characters. If the value is SQL NULL then the result is null.
Description
A column value can be retrieved as a stream of ASCII characters and then read in chunks from the stream. This method is particularly suitable for retrieving large LONGVARCHAR values. The JDBC driver will do any necessary conversion from the database format into ASCII.

Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a get method implicitly closes the stream.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getBigDecimal

ResultSet.getBigDecimal

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract BigDecimal getBigDecimal( int columnIndex, int scale ) throws SQLException
Parameters
columnIndex
the first column is 1, the second is 2, ...
scale
the number of digits to the right of the decimal
Returns
the column value; if the value is SQL NULL, the result is null
Description
Get the value of a column in the current row as a java.lang.BigDecimal object.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getBigDecimal

ResultSet.getBigDecimal

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract BigDecimal getBigDecimal( String columnName, int scale ) throws SQLException
Parameters
columnName
is the SQL name of the column
scale
the number of digits to the right of the decimal
Returns
the column value; if the value is SQL NULL, the result is null
Description
Get the value of a column in the current row as a java.lang.BigDecimal object.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getBinaryStream

ResultSet.getBinaryStream

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract InputStream getBinaryStream( int columnIndex ) throws SQLException
Parameters
columnIndex
the first column is 1, the second is 2, ...
Returns
a Java input stream that delivers the database column value as a stream of uninterpreted bytes. If the value is SQL NULL then the result is null.
Description
A column value can be retrieved as a stream of uninterpreted bytes and then read in chunks from the stream. This method is particularly suitable for retrieving large LONGVARBINARY values.

Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a get method implicitly closes the stream. Also, a stream may return 0 for available() whether there is data available or not.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getBinaryStream

ResultSet.getBinaryStream

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract InputStream getBinaryStream( String columnName ) throws SQLException
Parameters
columnName
is the SQL name of the column
Returns
a Java input stream that delivers the database column value as a stream of uninterpreted bytes. If the value is SQL NULL then the result is null.
Description
A column value can be retrieved as a stream of uninterpreted bytes and then read in chunks from the stream. This method is particularly suitable for retrieving large LONGVARBINARY values.

Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a get method implicitly closes the stream.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getBoolean

ResultSet.getBoolean

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean getBoolean( int columnIndex ) throws SQLException
Parameters
columnIndex
the first column is 1, the second is 2, ...
Returns
the column value; if the value is SQL NULL, the result is false
Description
Get the value of a column in the current row as a Java boolean.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getBoolean

ResultSet.getBoolean

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean getBoolean( String columnName ) throws SQLException
Parameters
columnName
is the SQL name of the column
Returns
the column value; if the value is SQL NULL, the result is false
Description
Get the value of a column in the current row as a Java boolean.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getByte

ResultSet.getByte

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract byte getByte( int columnIndex ) throws SQLException
Parameters
columnIndex
the first column is 1, the second is 2, ...
Returns
the column value; if the value is SQL NULL, the result is 0
Description
Get the value of a column in the current row as a Java byte.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getByte

ResultSet.getByte

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract byte getByte( String columnName ) throws SQLException
Parameters
columnName
is the SQL name of the column
Returns
the column value; if the value is SQL NULL, the result is 0
Description
Get the value of a column in the current row as a Java byte.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getBytes

ResultSet.getBytes

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract byte[] getBytes( int columnIndex ) throws SQLException
Parameters
columnIndex
the first column is 1, the second is 2, ...
Returns
the column value; if the value is SQL NULL, the result is null
Description
Get the value of a column in the current row as a Java byte array. The bytes represent the raw values returned by the driver.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getBytes

ResultSet.getBytes

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract byte[] getBytes( String columnName ) throws SQLException
Parameters
columnName
is the SQL name of the column
Returns
the column value; if the value is SQL NULL, the result is null
Description
Get the value of a column in the current row as a Java byte array. The bytes represent the raw values returned by the driver.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getCursorName

ResultSet.getCursorName

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getCursorName() throws SQLException
Returns
the ResultSet's SQL cursor name
Description
Get the name of the SQL cursor used by this ResultSet.

In SQL, a result table is retrieved through a cursor that is named. The current row of a result can be updated or deleted using a positioned update/delete statement that references the cursor name.

JDBC supports this SQL feature by providing the name of the SQL cursor used by a ResultSet. The current row of a ResultSet is also the current row of this SQL cursor.

Note: If positioned update is not supported a SQLException is thrown

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getDate

ResultSet.getDate

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Date getDate( int columnIndex ) throws SQLException
Parameters
columnIndex
the first column is 1, the second is 2, ...
Returns
the column value; if the value is SQL NULL, the result is null
Description
Get the value of a column in the current row as a java.sql.Date object.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getDate

ResultSet.getDate

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Date getDate( String columnName ) throws SQLException
Parameters
columnName
is the SQL name of the column
Returns
the column value; if the value is SQL NULL, the result is null
Description
Get the value of a column in the current row as a java.sql.Date object.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getDouble

ResultSet.getDouble

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract double getDouble( int columnIndex ) throws SQLException
Parameters
columnIndex
the first column is 1, the second is 2, ...
Returns
the column value; if the value is SQL NULL, the result is 0
Description
Get the value of a column in the current row as a Java double.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getDouble

ResultSet.getDouble

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract double getDouble( String columnName ) throws SQLException
Parameters
columnName
is the SQL name of the column
Returns
the column value; if the value is SQL NULL, the result is 0
Description
Get the value of a column in the current row as a Java double.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getFloat

ResultSet.getFloat

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract float getFloat( int columnIndex ) throws SQLException
Parameters
columnIndex
the first column is 1, the second is 2, ...
Returns
the column value; if the value is SQL NULL, the result is 0
Description
Get the value of a column in the current row as a Java float.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getFloat

ResultSet.getFloat

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract float getFloat( String columnName ) throws SQLException
Parameters
columnName
is the SQL name of the column
Returns
the column value; if the value is SQL NULL, the result is 0
Description
Get the value of a column in the current row as a Java float.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getInt

ResultSet.getInt

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getInt( int columnIndex ) throws SQLException
Parameters
columnIndex
the first column is 1, the second is 2, ...
Returns
the column value; if the value is SQL NULL, the result is 0
Description
Get the value of a column in the current row as a Java int.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getInt

ResultSet.getInt

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getInt( String columnName ) throws SQLException
Parameters
columnName
is the SQL name of the column
Returns
the column value; if the value is SQL NULL, the result is 0
Description
Get the value of a column in the current row as a Java int.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getLong

ResultSet.getLong

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract long getLong( int columnIndex ) throws SQLException
Parameters
columnIndex
the first column is 1, the second is 2, ...
Returns
the column value; if the value is SQL NULL, the result is 0
Description
Get the value of a column in the current row as a Java long.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getLong

ResultSet.getLong

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract long getLong( String columnName ) throws SQLException
Parameters
columnName
is the SQL name of the column
Returns
the column value; if the value is SQL NULL, the result is 0
Description
Get the value of a column in the current row as a Java long.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getMetaData

ResultSet.getMetaData

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSetMetaData getMetaData() throws SQLException
Returns
the description of a ResultSet's columns
Description
The number, types and properties of a ResultSet's columns are provided by the getMetaData method.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getObject

ResultSet.getObject

Interface Overview | Interface Members | This Package | All Packages

Syntax 1
public abstract Object getObject( int columnIndex ) throws SQLException
Parameters
columnIndex
the first column is 1, the second is 2, ...
Returns
A java.lang.Object holding the column value.
Description

Get the value of a column in the current row as a Java object.

This method will return the value of the given column as a Java object. The type of the Java object will be the default Java Object type corresponding to the column's SQL type, following the mapping specified in the JDBC spec.

This method may also be used to read datatabase specific abstract data types.

Exceptions
SQLException if a database-access error occurs.

Syntax 2
public abstract Object getObject( String columnName ) throws SQLException
Parameters
columnName
is the SQL name of the column
Returns
A java.lang.Object holding the column value.
Description

Get the value of a column in the current row as a Java object.

This method will return the value of the given column as a Java object. The type of the Java object will be the default Java Object type corresponding to the column's SQL type, following the mapping specified in the JDBC spec.

This method may also be used to read datatabase specific abstract data types.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getShort

ResultSet.getShort

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract short getShort( int columnIndex ) throws SQLException
Parameters
columnIndex
the first column is 1, the second is 2, ...
Returns
the column value; if the value is SQL NULL, the result is 0
Description
Get the value of a column in the current row as a Java short.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getShort

ResultSet.getShort

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract short getShort( String columnName ) throws SQLException
Parameters
columnName
is the SQL name of the column
Returns
the column value; if the value is SQL NULL, the result is 0
Description
Get the value of a column in the current row as a Java short.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getString

ResultSet.getString

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getString( int columnIndex ) throws SQLException
Parameters
columnIndex
the first column is 1, the second is 2, ...
Returns
the column value; if the value is SQL NULL, the result is null
Description
Get the value of a column in the current row as a Java String.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getString

ResultSet.getString

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getString( String columnName ) throws SQLException
Parameters
columnName
is the SQL name of the column
Returns
the column value; if the value is SQL NULL, the result is null
Description
Get the value of a column in the current row as a Java String.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getTime

ResultSet.getTime

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Time getTime( int columnIndex ) throws SQLException
Parameters
columnIndex
the first column is 1, the second is 2, ...
Returns
the column value; if the value is SQL NULL, the result is null
Description
Get the value of a column in the current row as a java.sql.Time object.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getTime

ResultSet.getTime

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Time getTime( String columnName ) throws SQLException
Parameters
columnName
is the SQL name of the column
Returns
the column value; if the value is SQL NULL, the result is null
Description
Get the value of a column in the current row as a java.sql.Time object.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getTimestamp

ResultSet.getTimestamp

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Timestamp getTimestamp( int columnIndex ) throws SQLException
Parameters
columnIndex
the first column is 1, the second is 2, ...
Returns
the column value; if the value is SQL NULL, the result is null
Description
Get the value of a column in the current row as a java.sql.Timestamp object.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getTimestamp

ResultSet.getTimestamp

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Timestamp getTimestamp( String columnName ) throws SQLException
Parameters
columnName
is the SQL name of the column
Returns
the column value; if the value is SQL NULL, the result is null
Description
Get the value of a column in the current row as a java.sql.Timestamp object.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getUnicodeStream

ResultSet.getUnicodeStream

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract InputStream getUnicodeStream( int columnIndex ) throws SQLException
Parameters
columnIndex
the first column is 1, the second is 2, ...
Returns
a Java input stream that delivers the database column value as a stream of two byte Unicode characters. If the value is SQL NULL then the result is null.
Description
A column value can be retrieved as a stream of Unicode characters and then read in chunks from the stream. This method is particularly suitable for retrieving large LONGVARCHAR values. The JDBC driver will do any necessary conversion from the database format into Unicode.

Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a get method implicitly closes the stream. . Also, a stream may return 0 for available() whether there is data available or not.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getUnicodeStream

ResultSet.getUnicodeStream

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract InputStream getUnicodeStream( String columnName ) throws SQLException
Parameters
columnName
is the SQL name of the column
Returns
a Java input stream that delivers the database column value as a stream of two byte Unicode characters. If the value is SQL NULL then the result is null.
Description
A column value can be retrieved as a stream of Unicode characters and then read in chunks from the stream. This method is particularly suitable for retrieving large LONGVARCHAR values. The JDBC driver will do any necessary conversion from the database format into Unicode.

Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a get method implicitly closes the stream.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.getWarnings

ResultSet.getWarnings

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract SQLWarning getWarnings() throws SQLException
Returns
the first SQLWarning or null
Description

The first warning reported by calls on this ResultSet is returned. Subsequent ResultSet warnings will be chained to this SQLWarning.

The warning chain is automatically cleared each time a new row is read.

Note: This warning chain only covers warnings caused by ResultSet methods. Any warning caused by statement methods (such as reading OUT parameters) will be chained on the Statement object.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.next

ResultSet.next

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean next() throws SQLException
Returns
true if the new current row is valid; false if there are no more rows
Description
A ResultSet is initially positioned before its first row; the first call to next makes the first row the current row; the second call makes the second row the current row, etc.

If an input stream from the previous row is open, it is implicitly closed. The ResultSet's warning chain is cleared when a new row is read.

Exceptions
SQLException if a database-access error occurs.


 ResultSet.wasNull

ResultSet.wasNull

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean wasNull() throws SQLException
Returns
true if last column read was SQL NULL
Description
A column may have the value of SQL NULL; wasNull reports whether the last column read had this special value. Note that you must first call getXXX on a column to try to read its value and then call wasNull() to find if the value was the SQL NULL.

Exceptions
SQLException if a database-access error occurs.


 Interface ResultSetMetaData

Interface java.sql.ResultSetMetaData

Interface Members | This Package | All Packages

public interface ResultSetMetaData

A ResultSetMetaData object can be used to find out about the types and properties of the columns in a ResultSet.


 ResultSetMetaData Members

ResultSetMetaData Members

Interface Overview | This Package | All Packages

Fields
Name | Description
columnNoNulls | Does not allow NULL values.
columnNullable | Allows NULL values.
columnNullableUnknown | Nullability unknown.

Methods
Name | Description
getCatalogName(int) | What's a column's table's catalog name?
getColumnCount() | What's the number of columns in the ResultSet?
getColumnDisplaySize(int) | What's the column's normal max width in chars?
getColumnLabel(int) | What's the suggested column title for use in printouts and displays?
getColumnName(int) | What's a column's name?
getColumnType(int) | What's a column's SQL type?
getColumnTypeName(int) | What's a column's data source specific type name?
getPrecision(int) | What's a column's number of decimal digits?
getScale(int) | What's a column's number of digits to right of the decimal point?
getSchemaName(int) | What's a column's table's schema?
getTableName(int) | What's a column's table name?
isAutoIncrement(int) | Is the column automatically numbered, thus read-only?
isCaseSensitive(int) | Does a column's case matter?
isCurrency(int) | Is the column a cash value?
isDefinitelyWritable(int) | Will a write on the column definitely succeed?
isNullable(int) | Can you put a NULL in this column?
isReadOnly(int) | Is a column definitely not writable?
isSearchable(int) | Can the column be used in a where clause?
isSigned(int) | Is the column a signed number?
isWritable(int) | Is it possible for a write on the column to succeed?


 ResultSetMetaData.columnNoNulls

ResultSetMetaData.columnNoNulls

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int columnNoNulls
Description
Does not allow NULL values.


 ResultSetMetaData.columnNullable

ResultSetMetaData.columnNullable

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int columnNullable
Description
Allows NULL values.


 ResultSetMetaData.columnNullableUnknown

ResultSetMetaData.columnNullableUnknown

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final int columnNullableUnknown
Description
Nullability unknown.


 ResultSetMetaData.getCatalogName

ResultSetMetaData.getCatalogName

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getCatalogName( int column ) throws SQLException
Parameters
column
the first column is 1, the second is 2, ...
Returns
column name or "" if not applicable.
Description
What's a column's table's catalog name?

Exceptions
SQLException if a database-access error occurs.


 ResultSetMetaData.getColumnCount

ResultSetMetaData.getColumnCount

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getColumnCount() throws SQLException
Returns
the number
Description
What's the number of columns in the ResultSet?

Exceptions
SQLException if a database-access error occurs.


 ResultSetMetaData.getColumnDisplaySize

ResultSetMetaData.getColumnDisplaySize

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getColumnDisplaySize( int column ) throws SQLException
Parameters
column
the first column is 1, the second is 2, ...
Returns
max width
Description
What's the column's normal max width in chars?

Exceptions
SQLException if a database-access error occurs.


 ResultSetMetaData.getColumnLabel

ResultSetMetaData.getColumnLabel

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getColumnLabel( int column ) throws SQLException
Parameters
column
the first column is 1, the second is 2, ...
Returns
true if so
Description
What's the suggested column title for use in printouts and displays?

Exceptions
SQLException if a database-access error occurs.


 ResultSetMetaData.getColumnName

ResultSetMetaData.getColumnName

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getColumnName( int column ) throws SQLException
Parameters
column
the first column is 1, the second is 2, ...
Returns
column name
Description
What's a column's name?

Exceptions
SQLException if a database-access error occurs.


 ResultSetMetaData.getColumnType

ResultSetMetaData.getColumnType

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getColumnType( int column ) throws SQLException
Parameters
column
the first column is 1, the second is 2, ...
Returns
SQL type
Description
What's a column's SQL type?

Exceptions
SQLException if a database-access error occurs.
See Also
Types


 ResultSetMetaData.getColumnTypeName

ResultSetMetaData.getColumnTypeName

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getColumnTypeName( int column ) throws SQLException
Parameters
column
the first column is 1, the second is 2, ...
Returns
type name
Description
What's a column's data source specific type name?

Exceptions
SQLException if a database-access error occurs.


 ResultSetMetaData.getPrecision

ResultSetMetaData.getPrecision

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getPrecision( int column ) throws SQLException
Parameters
column
the first column is 1, the second is 2, ...
Returns
precision
Description
What's a column's number of decimal digits?

Exceptions
SQLException if a database-access error occurs.


 ResultSetMetaData.getScale

ResultSetMetaData.getScale

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getScale( int column ) throws SQLException
Parameters
column
the first column is 1, the second is 2, ...
Returns
scale
Description
What's a column's number of digits to right of the decimal point?

Exceptions
SQLException if a database-access error occurs.


 ResultSetMetaData.getSchemaName

ResultSetMetaData.getSchemaName

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getSchemaName( int column ) throws SQLException
Parameters
column
the first column is 1, the second is 2, ...
Returns
schema name or "" if not applicable
Description
What's a column's table's schema?

Exceptions
SQLException if a database-access error occurs.


 ResultSetMetaData.getTableName

ResultSetMetaData.getTableName

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract String getTableName( int column ) throws SQLException
Returns
table name or "" if not applicable
Description
What's a column's table name?

Exceptions
SQLException if a database-access error occurs.


 ResultSetMetaData.isAutoIncrement

ResultSetMetaData.isAutoIncrement

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isAutoIncrement( int column ) throws SQLException
Parameters
column
the first column is 1, the second is 2, ...
Returns
true if so
Description
Is the column automatically numbered, thus read-only?

Exceptions
SQLException if a database-access error occurs.


 ResultSetMetaData.isCaseSensitive

ResultSetMetaData.isCaseSensitive

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isCaseSensitive( int column ) throws SQLException
Parameters
column
the first column is 1, the second is 2, ...
Returns
true if so
Description
Does a column's case matter?

Exceptions
SQLException if a database-access error occurs.


 ResultSetMetaData.isCurrency

ResultSetMetaData.isCurrency

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isCurrency( int column ) throws SQLException
Parameters
column
the first column is 1, the second is 2, ...
Returns
true if so
Description
Is the column a cash value?

Exceptions
SQLException if a database-access error occurs.


 ResultSetMetaData.isDefinitelyWritable

ResultSetMetaData.isDefinitelyWritable

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isDefinitelyWritable( int column ) throws SQLException
Parameters
column
the first column is 1, the second is 2, ...
Returns
true if so
Description
Will a write on the column definitely succeed?

Exceptions
SQLException if a database-access error occurs.


 ResultSetMetaData.isNullable

ResultSetMetaData.isNullable

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int isNullable( int column ) throws SQLException
Parameters
column
the first column is 1, the second is 2, ...
Returns
columnNoNulls, columnNullable or columnNullableUnknown
Description
Can you put a NULL in this column?

Exceptions
SQLException if a database-access error occurs.


 ResultSetMetaData.isReadOnly

ResultSetMetaData.isReadOnly

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isReadOnly( int column ) throws SQLException
Parameters
column
the first column is 1, the second is 2, ...
Returns
true if so
Description
Is a column definitely not writable?

Exceptions
SQLException if a database-access error occurs.


 ResultSetMetaData.isSearchable

ResultSetMetaData.isSearchable

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isSearchable( int column ) throws SQLException
Parameters
column
the first column is 1, the second is 2, ...
Returns
true if so
Description
Can the column be used in a where clause?

Exceptions
SQLException if a database-access error occurs.


 ResultSetMetaData.isSigned

ResultSetMetaData.isSigned

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isSigned( int column ) throws SQLException
Parameters
column
the first column is 1, the second is 2, ...
Returns
true if so
Description
Is the column a signed number?

Exceptions
SQLException if a database-access error occurs.


 ResultSetMetaData.isWritable

ResultSetMetaData.isWritable

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean isWritable( int column ) throws SQLException
Parameters
column
the first column is 1, the second is 2, ...
Returns
true if so
Description
Is it possible for a write on the column to succeed?

Exceptions
SQLException if a database-access error occurs.


 Class SQLException

Class java.sql.SQLException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.sql.SQLException

public class SQLException
extends Exception

The SQLException class provides information on a database access error.

Each SQLException provides several kinds of information:

  • a string describing the error. This is used as the Java Exception message, and is available via the getMesage() method
  • A "SQLstate" string which follows the XOPEN SQLstate conventions. The values of the SQLState string as described in the XOPEN SQL spec.
  • An integer error code that is vendor specific. Normally this will be the actual error code returned by the underlying database.
  • A chain to a next Exception. This can be used to provided additional error information.


 SQLException Members

SQLException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
SQLException() | Construct an SQLException; reason defaults to null, SQLState defaults to null and vendorCode defaults to 0.
SQLException(String) | Construct an SQLException with a reason; SQLState defaults to null and vendorCode defaults to 0.
SQLException(String, String) | Construct an SQLException with a reason and SQLState; vendorCode defaults to 0.
SQLException(String, String, int) | Construct a fully-specified SQLException

Methods
Name | Description
getErrorCode() | Get the vendor specific exception code
getNextException() | Get the exception chained to this one.
getSQLState() | Get the SQLState
setNextException(SQLException) | Add an SQLException to the end of the chain.


 SQLException.SQLException

SQLException.SQLException

Syntax 1
public SQLException( String reason, String SQLState, int vendorCode )
Parameters
reason
a description of the exception
SQLState
an XOPEN code identifying the exception
vendorCode
a database vendor specific exception code
Description
Construct a fully-specified SQLException

Syntax 2
public SQLException( String reason, String SQLState )
Parameters
reason
a description of the exception
SQLState
an XOPEN code identifying the exception
Description
Construct an SQLException with a reason and SQLState; vendorCode defaults to 0.

Syntax 3
public SQLException( String reason )
Parameters
reason
a description of the exception
Description
Construct an SQLException with a reason; SQLState defaults to null and vendorCode defaults to 0.

Syntax 4
public SQLException()
Description
Construct an SQLException; reason defaults to null, SQLState defaults to null and vendorCode defaults to 0.


 SQLException.getErrorCode

SQLException.getErrorCode

Syntax
public int getErrorCode()
Returns
the vendor's error code
Description
Get the vendor specific exception code


 SQLException.getNextException

SQLException.getNextException

Syntax
public SQLException getNextException()
Returns
the next SQLException in the chain, null if none
Description
Get the exception chained to this one.


 SQLException.getSQLState

SQLException.getSQLState

Syntax
public String getSQLState()
Returns
the SQLState value
Description
Get the SQLState


 SQLException.setNextException

SQLException.setNextException

Syntax
public synchronized void setNextException( SQLException ex )
Parameters
ex
the new end of the SQLException chain
Description
Add an SQLException to the end of the chain.


 Class SQLWarning

Class java.sql.SQLWarning

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.sql.SQLException
                           |
                           +----java.sql.SQLWarning

public class SQLWarning
extends SQLException

The SQLWarning class provides information on a database access warnings. Warnings are silently chained to the object whose method caused it to be reported.

See Also:
getWarnings, getWarnings, getWarnings


 SQLWarning Members

SQLWarning Members

Class Overview | This Package | All Packages

Constructors
Name | Description
SQLWarning() | Construct an SQLWarning ; reason defaults to null, SQLState defaults to null and vendorCode defaults to 0.
SQLWarning(String) | Construct an SQLWarning with a reason; SQLState defaults to null and vendorCode defaults to 0.
SQLWarning(String, String) | Construct an SQLWarning with a reason and SQLState; vendorCode defaults to 0.
SQLWarning(String, String, int) | Construct a fully specified SQLWarning.

Methods
Name | Description
getNextWarning() | Get the warning chained to this one
setNextWarning(SQLWarning) | Add an SQLWarning to the end of the chain.


 SQLWarning.SQLWarning

SQLWarning.SQLWarning

Syntax 1
public SQLWarning( String reason, String SQLstate, int vendorCode )
Parameters
reason
a description of the warning
SQLState
an XOPEN code identifying the warning
vendorCode
a database vendor specific warning code
Description
Construct a fully specified SQLWarning.

Syntax 2
public SQLWarning( String reason, String SQLstate )
Parameters
reason
a description of the warning
SQLState
an XOPEN code identifying the warning
Description
Construct an SQLWarning with a reason and SQLState; vendorCode defaults to 0.

Syntax 3
public SQLWarning( String reason )
Parameters
reason
a description of the warning
Description
Construct an SQLWarning with a reason; SQLState defaults to null and vendorCode defaults to 0.

Syntax 4
public SQLWarning()
Description
Construct an SQLWarning ; reason defaults to null, SQLState defaults to null and vendorCode defaults to 0.


 SQLWarning.getNextWarning

SQLWarning.getNextWarning

Syntax
public SQLWarning getNextWarning()
Returns
the next SQLException in the chain, null if none
Description
Get the warning chained to this one


 SQLWarning.setNextWarning

SQLWarning.setNextWarning

Syntax
public void setNextWarning( SQLWarning w )
Parameters
w
the new end of the SQLException chain
Description
Add an SQLWarning to the end of the chain.


 Interface Statement

Interface java.sql.Statement

Interface Members | This Package | All Packages

public interface Statement

A Statement object is used for executing a static SQL statement and obtaining the results produced by it.

Only one ResultSet per Statement can be open at any point in time. Therefore, if the reading of one ResultSet is interleaved with the reading of another, each must have been generated by different Statements. All statement execute methods implicitly close a statment's current ResultSet if an open one exists.

See Also:
createStatement, ResultSet


 Statement Members

Statement Members

Interface Overview | This Package | All Packages

Methods
Name | Description
cancel() | Cancel can be used by one thread to cancel a statement that is being executed by another thread.
clearWarnings() | After this call, getWarnings returns null until a new warning is reported for this Statement.
close() | In many cases, it is desirable to immediately release a Statements's database and JDBC resources instead of waiting for this to happen when it is automatically closed; the close method provides this immediate release.
execute(String) | Execute a SQL statement that may return multiple results.
executeQuery(String) | Execute a SQL statement that returns a single ResultSet.
executeUpdate(String) | Execute a SQL INSERT, UPDATE or DELETE statement.
getMaxFieldSize() | The maxFieldSize limit (in bytes) is the maximum amount of data returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR columns.
getMaxRows() | The maxRows limit is the maximum number of rows that a ResultSet can contain.
getMoreResults() | getMoreResults moves to a Statement's next result.
getQueryTimeout() | The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute.
getResultSet() | getResultSet returns the current result as a ResultSet.
getUpdateCount() | getUpdateCount returns the current result as an update count; if the result is a ResultSet or there are no more results, -1 is returned.
getWarnings() | The first warning reported by calls on this Statement is returned.
setCursorName(String) | setCursorname defines the SQL cursor name that will be used by subsequent Statement execute methods.
setEscapeProcessing(boolean) | If escape scanning is on (the default), the driver will do escape substitution before sending the SQL to the database.
setMaxFieldSize(int) | The maxFieldSize limit (in bytes) is set to limit the size of data that can be returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR fields.
setMaxRows(int) | The maxRows limit is set to limit the number of rows that any ResultSet can contain.
setQueryTimeout(int) | The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute.


 Statement.cancel

Statement.cancel

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void cancel() throws SQLException
Description
Cancel can be used by one thread to cancel a statement that is being executed by another thread.

Exceptions
SQLException if a database-access error occurs.


 Statement.clearWarnings

Statement.clearWarnings

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void clearWarnings() throws SQLException
Description
After this call, getWarnings returns null until a new warning is reported for this Statement.

Exceptions
SQLException if a database-access error occurs.


 Statement.close

Statement.close

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void close() throws SQLException
Description
In many cases, it is desirable to immediately release a Statements's database and JDBC resources instead of waiting for this to happen when it is automatically closed; the close method provides this immediate release.

Note: A Statement is automatically closed when it is garbage collected. When a Statement is closed, its current ResultSet, if one exists, is also closed.

Exceptions
SQLException if a database-access error occurs.


 Statement.execute

Statement.execute

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean execute( String sql ) throws SQLException
Parameters
sql
any SQL statement
Returns
true if the next result is a ResultSet; false if it is an update count or there are no more results
Description
Execute a SQL statement that may return multiple results. Under some (uncommon) situations a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this, unless you're executing a stored procedure that you know may return multiple results, or unless you're dynamically executing an unknown SQL string. The "execute", "getMoreResults", "getResultSet" and "getUpdateCount" methods let you navigate through multiple results. The "execute" method executes a SQL statement and indicates the form of the first result. You can then use getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).

Exceptions
SQLException if a database-access error occurs.
See Also
getResultSet, getUpdateCount, getMoreResults


 Statement.executeQuery

Statement.executeQuery

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet executeQuery( String sql ) throws SQLException
Parameters
sql
typically this is a static SQL SELECT statement
Returns
a ResultSet that contains the data produced by the query; never null
Description
Execute a SQL statement that returns a single ResultSet.

Exceptions
SQLException if a database-access error occurs.


 Statement.executeUpdate

Statement.executeUpdate

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int executeUpdate( String sql ) throws SQLException
Parameters
sql
a SQL INSERT, UPDATE or DELETE statement or a SQL statement that returns nothing
Returns
either the row count for INSERT, UPDATE or DELETE or 0 for SQL statements that return nothing
Description
Execute a SQL INSERT, UPDATE or DELETE statement. In addition, SQL statements that return nothing such as SQL DDL statements can be executed.

Exceptions
SQLException if a database-access error occurs.


 Statement.getMaxFieldSize

Statement.getMaxFieldSize

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxFieldSize() throws SQLException
Returns
the current max column size limit; zero means unlimited
Description
The maxFieldSize limit (in bytes) is the maximum amount of data returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR columns. If the limit is exceeded, the excess data is silently discarded.

Exceptions
SQLException if a database-access error occurs.


 Statement.getMaxRows

Statement.getMaxRows

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getMaxRows() throws SQLException
Returns
the current max row limit; zero means unlimited
Description
The maxRows limit is the maximum number of rows that a ResultSet can contain. If the limit is exceeded, the excess rows are silently dropped.

Exceptions
SQLException if a database-access error occurs.


 Statement.getMoreResults

Statement.getMoreResults

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean getMoreResults() throws SQLException
Returns
true if the next result is a ResultSet; false if it is an update count or there are no more results
Description
getMoreResults moves to a Statement's next result. It returns true if this result is a ResultSet. getMoreResults also implicitly closes any current ResultSet obtained with getResultSet. There are no more results when (!getMoreResults() && (getUpdateCount() == -1)

Exceptions
SQLException if a database-access error occurs.
See Also
execute


 Statement.getQueryTimeout

Statement.getQueryTimeout

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getQueryTimeout() throws SQLException
Returns
the current query timeout limit in seconds; zero means unlimited
Description
The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute. If the limit is exceeded, a SQLException is thrown.

Exceptions
SQLException if a database-access error occurs.


 Statement.getResultSet

Statement.getResultSet

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getResultSet() throws SQLException
Returns
the current result as a ResultSet; null if the result is an update count or there are no more results
Description
getResultSet returns the current result as a ResultSet. It should only be called once per result.

Exceptions
SQLException if a database-access error occurs.
See Also
execute


 Statement.getUpdateCount

Statement.getUpdateCount

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getUpdateCount() throws SQLException
Returns
the current result as an update count; -1 if it is a ResultSet or there are no more results
Description
getUpdateCount returns the current result as an update count; if the result is a ResultSet or there are no more results, -1 is returned. It should only be called once per result.

Exceptions
SQLException if a database-access error occurs.
See Also
execute


 Statement.getWarnings

Statement.getWarnings

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract SQLWarning getWarnings() throws SQLException
Returns
the first SQLWarning or null
Description
The first warning reported by calls on this Statement is returned. A Statment's execute methods clear its SQLWarning chain. Subsequent Statement warnings will be chained to this SQLWarning.

The warning chain is automatically cleared each time a statement is (re)executed.

Note: If you are processing a ResultSet then any warnings associated with ResultSet reads will be chained on the ResultSet object.

Exceptions
SQLException if a database-access error occurs.


 Statement.setCursorName

Statement.setCursorName

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setCursorName( String name ) throws SQLException
Parameters
name
the new cursor name.
Description
setCursorname defines the SQL cursor name that will be used by subsequent Statement execute methods. This name can then be used in SQL positioned update/delete statements to identify the current row in the ResultSet generated by this statement. If the database doesn't support positioned update/delete, this method is a noop.

Note: By definition, positioned update/delete execution must be done by a different Statement than the one which generated the ResultSet being used for positioning. Also, cursor names must be unique within a Connection.

Exceptions
SQLException if a database-access error occurs.


 Statement.setEscapeProcessing

Statement.setEscapeProcessing

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setEscapeProcessing( boolean enable ) throws SQLException
Parameters
enable
true to enable; false to disable
Description
If escape scanning is on (the default), the driver will do escape substitution before sending the SQL to the database. Note: Since prepared statements have usually been parsed prior to making this call, disabling escape processing for prepared statements will like have no affect.

Exceptions
SQLException if a database-access error occurs.


 Statement.setMaxFieldSize

Statement.setMaxFieldSize

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setMaxFieldSize( int max ) throws SQLException
Parameters
max
the new max column size limit; zero means unlimited
Description
The maxFieldSize limit (in bytes) is set to limit the size of data that can be returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR fields. If the limit is exceeded, the excess data is silently discarded. For maximum portability use values greater than 256.

Exceptions
SQLException if a database-access error occurs.


 Statement.setMaxRows

Statement.setMaxRows

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setMaxRows( int max ) throws SQLException
Parameters
max
the new max rows limit; zero means unlimited
Description
The maxRows limit is set to limit the number of rows that any ResultSet can contain. If the limit is exceeded, the excess rows are silently dropped.

Exceptions
SQLException if a database-access error occurs.


 Statement.setQueryTimeout

Statement.setQueryTimeout

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void setQueryTimeout( int seconds ) throws SQLException
Parameters
seconds
the new query timeout limit in seconds; zero means unlimited
Description
The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute. If the limit is exceeded, a SQLException is thrown.

Exceptions
SQLException if a database-access error occurs.


 Class Time

Class java.sql.Time

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.Date
           |
           +----java.sql.Time

public class Time
extends Date

This class is a thin wrapper around java.util.Date that allows JDBC to identify this as a SQL TIME value. It adds formatting and parsing operations to support the JDBC escape syntax for time values.


 Time Members

Time Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Time(int, int, int) | Construct a Time Object
Time(long) | Construct a Time using a milliseconds time value

Methods
Name | Description
getDate() | Returns the day of the month represented by this date.
getDay() | Returns the day of the week represented by this date.
getMonth() | Returns the month represented by this date.
getYear() | Returns the year represented by this date, minus 1900.
setDate(int) | Sets the day of the month of this date to the specified value.
setMonth(int) | Sets the month of this date to the specified value.
setTime(long) | Set a Time using a milliseconds time value
setYear(int) | Sets the year of this date to be the specified value plus 1900.
toString() | Format a time in JDBC date escape format
valueOf(String) | Convert a string in JDBC time escape format to a Time value


 Time.Time

Time.Time

Syntax 1
public Time( int hour, int minute, int second )
Parameters
hour
0 to 23
minute
0 to 59
second
0 to 59
Description
Construct a Time Object

Syntax 2
public Time( long time )
Parameters
time
milliseconds since January 1, 1970, 00:00:00 GMT
Description
Construct a Time using a milliseconds time value


 Time.getDate

Time.getDate

Syntax
public int getDate()
Description
Returns the day of the month represented by this date.

Overrides
getDate in class Date


 Time.getDay

Time.getDay

Syntax
public int getDay()
Description
Returns the day of the week represented by this date.

Overrides
getDay in class Date


 Time.getMonth

Time.getMonth

Syntax
public int getMonth()
Description
Returns the month represented by this date.

Overrides
getMonth in class Date


 Time.getYear

Time.getYear

Syntax
public int getYear()
Description
Returns the year represented by this date, minus 1900.

Overrides
getYear in class Date


 Time.setDate

Time.setDate

Syntax
public void setDate( int i )
Description
Sets the day of the month of this date to the specified value.

Overrides
setDate in class Date


 Time.setMonth

Time.setMonth

Syntax
public void setMonth( int i )
Description
Sets the month of this date to the specified value.

Overrides
setMonth in class Date


 Time.setTime

Time.setTime

Syntax
public void setTime( long time )
Parameters
time
milliseconds since January 1, 1970, 00:00:00 GMT
Description
Set a Time using a milliseconds time value

Overrides
setTime in class Date


 Time.setYear

Time.setYear

Syntax
public void setYear( int i )
Description
Sets the year of this date to be the specified value plus 1900.

Overrides
setYear in class Date


 Time.toString

Time.toString

Syntax
public String toString()
Returns
a String in hh:mm:ss format
Description
Format a time in JDBC date escape format

Overrides
toString in class Date


 Time.valueOf

Time.valueOf

Syntax
public static Time valueOf( String s )
Parameters
s
time in format "hh:mm:ss"
Returns
corresponding Time
Description
Convert a string in JDBC time escape format to a Time value


 Class Timestamp

Class java.sql.Timestamp

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.Date
           |
           +----java.sql.Timestamp

public class Timestamp
extends Date

This class is a thin wrapper around java.util.Date that allows JDBC to identify this as a SQL TIMESTAMP value. It adds the ability to hold the SQL TIMESTAMP nanos value and provides formatting and parsing operations to support the JDBC escape syntax for timestamp values.

Note: This type is a composite of a java.util.Date and a separate nanos value. Only integral seconds are stored in the java.util.Date component. The fractional seconds - the nanos - are separate. The getTime method will only return integral seconds. If a time value that includes the fractional seconds is desired you must convert nanos to milliseconds (nanos/1000000) and add this to the getTime value. Also note that the hashcode() method uses the underlying java.util.Data implementation and therefore does not include nanos in its computation.


 Timestamp Members

Timestamp Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Timestamp(int, int, int, int, int, int, int) | Construct a Timestamp Object
Timestamp(long) | Construct a Timestamp using a milliseconds time value.

Methods
Name | Description
after(Timestamp) | Is this timestamp later than the timestamp argument?
before(Timestamp) | Is this timestamp earlier than the timestamp argument?
equals(Timestamp) | Test Timestamp values for equality
getNanos() | Get the Timestamp's nanos value
setNanos(int) | Set the Timestamp's nanos value
toString() | Format a timestamp in JDBC timestamp escape format
valueOf(String) | Convert a string in JDBC timestamp escape format to a Timestamp value


 Timestamp.Timestamp

Timestamp.Timestamp

Syntax 1
public Timestamp( int year, int month, int date, int hour, int minute, int second, int nano )
Parameters
year
year-1900
month
0 to 11
day
1 to 31
hour
0 to 23
minute
0 to 59
second
0 to 59
nano
0 to 999,999,999
Description
Construct a Timestamp Object

Syntax 2
public Timestamp( long time )
Parameters
time
milliseconds since January 1, 1970, 00:00:00 GMT
Description
Construct a Timestamp using a milliseconds time value. The integral seconds are stored in the underlying date value; the fractional seconds are stored in the nanos value.


 Timestamp.after

Timestamp.after

Syntax
public boolean after( Timestamp ts )
Parameters
ts
the Timestamp value to compare with
Description
Is this timestamp later than the timestamp argument?


 Timestamp.before

Timestamp.before

Syntax
public boolean before( Timestamp ts )
Parameters
ts
the Timestamp value to compare with
Description
Is this timestamp earlier than the timestamp argument?


 Timestamp.equals

Timestamp.equals

Syntax
public boolean equals( Timestamp ts )
Parameters
ts
the Timestamp value to compare with
Description
Test Timestamp values for equality


 Timestamp.getNanos

Timestamp.getNanos

Syntax
public int getNanos()
Returns
the Timestamp's fractional seconds component
Description
Get the Timestamp's nanos value


 Timestamp.setNanos

Timestamp.setNanos

Syntax
public void setNanos( int n )
Parameters
n
the new fractional seconds component
Description
Set the Timestamp's nanos value


 Timestamp.toString

Timestamp.toString

Syntax
public String toString()
Returns
a String in yyyy-mm-dd hh:mm:ss.fffffffff format
Description
Format a timestamp in JDBC timestamp escape format

Overrides
toString in class Date


 Timestamp.valueOf

Timestamp.valueOf

Syntax
public static Timestamp valueOf( String s )
Parameters
s
timestamp in format "yyyy-mm-dd hh:mm:ss.fffffffff"
Returns
corresponding Timestamp
Description
Convert a string in JDBC timestamp escape format to a Timestamp value


 Class Types

Class java.sql.Types

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.sql.Types

public class Types
extends Object

This class defines constants that are used to identify SQL types. The actual type constant values are equivalent to those in XOPEN.


 Types Members

Types Members

Class Overview | This Package | All Packages

Fields
Name | Description
BIGINT |
BINARY |
BIT |
CHAR |
DATE |
DECIMAL |
DOUBLE |
FLOAT |
INTEGER |
LONGVARBINARY |
LONGVARCHAR |
NULL |
NUMERIC |
OTHER | OTHER indicates that the SQL type is database specific and gets mapped to a Java object which can be accessed via getObject and setObject.
REAL |
SMALLINT |
TIME |
TIMESTAMP |
TINYINT |
VARBINARY |
VARCHAR |


 Types.BIGINT

Types.BIGINT

Syntax
public static final int BIGINT


 Types.BINARY

Types.BINARY

Syntax
public static final int BINARY


 Types.BIT

Types.BIT

Syntax
public static final int BIT


 Types.CHAR

Types.CHAR

Syntax
public static final int CHAR


 Types.DATE

Types.DATE

Syntax
public static final int DATE


 Types.DECIMAL

Types.DECIMAL

Syntax
public static final int DECIMAL


 Types.DOUBLE

Types.DOUBLE

Syntax
public static final int DOUBLE


 Types.FLOAT

Types.FLOAT

Syntax
public static final int FLOAT


 Types.INTEGER

Types.INTEGER

Syntax
public static final int INTEGER


 Types.LONGVARBINARY

Types.LONGVARBINARY

Syntax
public static final int LONGVARBINARY


 Types.LONGVARCHAR

Types.LONGVARCHAR

Syntax
public static final int LONGVARCHAR


 Types.NULL

Types.NULL

Syntax
public static final int NULL


 Types.NUMERIC

Types.NUMERIC

Syntax
public static final int NUMERIC


 Types.OTHER

Types.OTHER

Syntax
public static final int OTHER
Description
OTHER indicates that the SQL type is database specific and gets mapped to a Java object which can be accessed via getObject and setObject.


 Types.REAL

Types.REAL

Syntax
public static final int REAL


 Types.SMALLINT

Types.SMALLINT

Syntax
public static final int SMALLINT


 Types.TIME

Types.TIME

Syntax
public static final int TIME


 Types.TIMESTAMP

Types.TIMESTAMP

Syntax
public static final int TIMESTAMP


 Types.TINYINT

Types.TINYINT

Syntax
public static final int TINYINT


 Types.VARBINARY

Types.VARBINARY

Syntax
public static final int VARBINARY


 Types.VARCHAR

Types.VARCHAR

Syntax
public static final int VARCHAR


 Package java.text

Package java.text

All Packages

Interfaces

  • CharacterIterator

    • Classes

  • BreakIterator
  • ChoiceFormat
  • CollationElementIterator
  • CollationKey
  • Collator
  • DateFormat
  • DateFormatSymbols
  • DecimalFormat
  • DecimalFormatSymbols
  • FieldPosition
  • Format
  • MessageFormat
  • NumberFormat
  • ParsePosition
  • RuleBasedCollator
  • SimpleDateFormat
  • StringCharacterIterator

    • Exceptions

  • ParseException


 Class BreakIterator

Class java.text.BreakIterator

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.text.BreakIterator

public abstract class BreakIterator
extends Object
implements Cloneable, Serializable

The BreakIterator class implements methods for finding the location of boundaries in text. Instances of BreakIterator maintain a current position and scan over text returning the index of characters where boundaries occur. Internally, BreakIterator scans text using a CharacterIterator, and is thus able to scan text held by any object implementing that protocol. A StringCharacterIterator is used to scan String objects passed to setText.

You use the factory methods provided by this class to create instances of various types of break iterators. In particular, use getWordIterator, getLineIterator, getSentenceIterator, and getCharacterIterator to create BreakIterators that perform word, line, sentence, and character boundary analysis respectively. A single BreakIterator can work only on one unit (word, line, sentence, and so on). You must use a different iterator for each unit boundary analysis you wish to perform.

Line boundary analysis determines where a text string can be broken when line-wrapping. The mechanism correctly handles punctuation and hyphenated words.

Sentence boundary analysis allows selection with correct interpretation of periods within numbers and abbreviations, and trailing punctuation marks such as quotation marks and parentheses.

Word boundary analysis is used by search and replace functions, as well as within text editing applications that allow the user to select words with a double click. Word selection provides correct interpretation of punctuation marks within and following words. Characters that are not part of a word, such as symbols or punctuation marks, have word-breaks on both sides.

Character boundary analysis allows users to interact with characters as they expect to, for example, when moving the cursor through a text string. Character boundary analysis provides correct navigation of through character strings, regardless of how the character is stored. For example, an accented character might be stored as a base character and a diacritical mark. What users consider to be a character can differ between languages.

BreakIterator is intended for use with natural languages only. Do not use this class to tokenize a programming language.

Examples:

Creating and using text boundaries

 public static void main(String args[]) {
      if (args.length == 1) {
          String stringToExamine = args[0];
          //print each word in order
          BreakIterator boundary = BreakIterator.getWordInstance();
          boundary.setText(stringToExamine);
          printEachForward(boundary, stringToExamine);
          //print each sentence in reverse order
          boundary = BreakIterator.getSentenceInstance(Locale.US);
          boundary.setText(stringToExamine);
          printEachBackward(boundary, stringToExamine);
          printFirst(boundary, stringToExamine);
          printLast(boundary, stringToExamine);
      }
 }
Print each element in order
 public static void printEachForward(BreakIterator boundary, String source) {
     int start = boundary.first();
     for (int end = boundary.next();
          end != BreakIterator.DONE;
          start = end, end = boundary.next()) {
          System.out.println(source.substring(start,end));
     }
 }
Print each element in reverse order
 public static void printEachBackward(BreakIterator boundary, String source) {
     int end = boundary.last();
     for (int start = boundary.previous();
          start != BreakIterator.DONE;
          end = start, start = boundary.previous()) {
         System.out.println(source.substring(start,end));
     }
 }
Print first element
 public static void printFirst(BreakIterator boundary, String source) {
     int start = boundary.first();
     int end = boundary.next();
     System.out.println(source.substring(start,end));
 }
Print last element
 public static void printLast(BreakIterator boundary, String source) {
     int end = boundary.last();
     int start = boundary.previous();
     System.out.println(source.substring(start,end));
 }
Print the element at a specified position
 public static void printAt(BreakIterator boundary, int pos, String source) {
     int end = boundary.following(pos);
     int start = boundary.previous();
     System.out.println(source.substring(start,end));
 }

See Also:
CharacterIterator


 BreakIterator Members

BreakIterator Members

Class Overview | This Package | All Packages

Fields
Name | Description
DONE | DONE is returned by previous() and next() after all valid boundaries have been returned.

Constructors
Name | Description
BreakIterator() | Constructor.

Methods
Name | Description
clone() | Create a copy of this boundary
current() | Return character index of the text boundary that was most recently returned by next(), previous(), first(), or last()
first() | Return the first boundary.
following(int) | Return the first boundary following the specified offset.
getAvailableLocales() | Get the set of Locales for which TextBoundaries are installed
getCharacterInstance() | Create BreakIterator for character-breaks using default locale Returns an instance of a BreakIterator implementing character breaks.
getCharacterInstance(Locale) | Create BreakIterator for character-breaks using specified locale Returns an instance of a BreakIterator implementing character breaks.
getLineInstance() | Create BreakIterator for line-breaks using default locale.
getLineInstance(Locale) | Create BreakIterator for line-breaks using default locale.
getSentenceInstance() | Create BreakIterator for sentence-breaks using default locale Returns an instance of a BreakIterator implementing sentence breaks.
getSentenceInstance(Locale) | Create BreakIterator for sentence-breaks using specified locale Returns an instance of a BreakIterator implementing sentence breaks.
getText() | Get the text being scanned
getWordInstance() | Create BreakIterator for word-breaks using default locale.
getWordInstance(Locale) | Create BreakIterator for word-breaks using default locale.
last() | Return the last boundary.
next() | Return the boundary following the current boundary.
next(int) | Return the nth boundary from the current boundary
previous() | Return the boundary preceding the current boundary.
setText(CharacterIterator) | Set a new text for scanning.
setText(String) | Set a new text string to be scanned.


 BreakIterator.DONE

BreakIterator.DONE

Syntax
public static final int DONE
Description
DONE is returned by previous() and next() after all valid boundaries have been returned.


 BreakIterator.BreakIterator

BreakIterator.BreakIterator

Syntax
protected BreakIterator()
Description
Constructor. BreakIterator is stateless and has no default behavior.


 BreakIterator.clone

BreakIterator.clone

Syntax
public Object clone()
Returns
A copy of this
Description
Create a copy of this boundary

Overrides
clone in class Object


 BreakIterator.current

BreakIterator.current

Syntax
public abstract int current()
Returns
The boundary most recently returned.
Description
Return character index of the text boundary that was most recently returned by next(), previous(), first(), or last()


 BreakIterator.first

BreakIterator.first

Syntax
public abstract int first()
Returns
The character index of the first text boundary.
Description
Return the first boundary. The iterator's current position is set to the first boundary.


 BreakIterator.following

BreakIterator.following

Syntax
public abstract int following( int offset )
Parameters
offset
the offset to begin scanning. Valid values are determined by the CharacterIterator passed to setText(). Invalid values cause an IllegalArgumentException to be thrown.
Returns
The first boundary after the specified offset.
Description
Return the first boundary following the specified offset. The value returned is always greater than the offset or the value BreakIterator.DONE


 BreakIterator.getAvailableLocales

BreakIterator.getAvailableLocales

Syntax
public static synchronized Locale[] getAvailableLocales()
Returns
available locales
Description
Get the set of Locales for which TextBoundaries are installed


 BreakIterator.getCharacterInstance

BreakIterator.getCharacterInstance

Syntax 1
public static BreakIterator getCharacterInstance()
Returns
A BreakIterator for character-breaks
Description
Create BreakIterator for character-breaks using default locale Returns an instance of a BreakIterator implementing character breaks. Character breaks are boundaries of combining character sequences.

See Also
getDefault

Syntax 2
public static BreakIterator getCharacterInstance( Locale where )
Parameters
where
the local. If a specific character break is not avaliable for the specified local, a default character break is returned.
Returns
A BreakIterator for character-breaks
Description
Create BreakIterator for character-breaks using specified locale Returns an instance of a BreakIterator implementing character breaks. Character breaks are boundaries of combining character sequences.


 BreakIterator.getLineInstance

BreakIterator.getLineInstance

Syntax 1
public static BreakIterator getLineInstance()
Returns
A BreakIterator for line-breaks
Description
Create BreakIterator for line-breaks using default locale. Returns an instance of a BreakIterator implementing line breaks. Line breaks are logically possible line breaks, actual line breaks are usually determined based on display width. LineBreak is usefull for word wrapping text.

See Also
getDefault

Syntax 2
public static BreakIterator getLineInstance( Locale where )
Parameters
where
the local. If a specific LineBreak is not avaliable for the specified local, a default LineBreak is returned.
Returns
A BreakIterator for line-breaks
Description
Create BreakIterator for line-breaks using default locale. Returns an instance of a BreakIterator implementing line breaks. Line breaks are logically possible line breaks, actual line breaks are usually determined based on display width. LineBreak is usefull for word wrapping text.


 BreakIterator.getSentenceInstance

BreakIterator.getSentenceInstance

Syntax 1
public static BreakIterator getSentenceInstance()
Returns
A BreakIterator for sentence-breaks
Description
Create BreakIterator for sentence-breaks using default locale Returns an instance of a BreakIterator implementing sentence breaks.

See Also
getDefault

Syntax 2
public static BreakIterator getSentenceInstance( Locale where )
Parameters
where
the local. If a specific SentenceBreak is not avaliable for the specified local, a default SentenceBreak is returned.
Returns
A BreakIterator for sentence-breaks
Description
Create BreakIterator for sentence-breaks using specified locale Returns an instance of a BreakIterator implementing sentence breaks.


 BreakIterator.getText

BreakIterator.getText

Syntax
public abstract CharacterIterator getText()
Returns
the text being scanned
Description
Get the text being scanned


 BreakIterator.getWordInstance

BreakIterator.getWordInstance

Syntax 1
public static BreakIterator getWordInstance()
Returns
A BreakIterator for word-breaks
Description
Create BreakIterator for word-breaks using default locale. Returns an instance of a BreakIterator implementing word breaks. WordBreak is usefull for word selection (ex. double click)

See Also
getDefault

Syntax 2
public static BreakIterator getWordInstance( Locale where )
Parameters
where
the local. If a specific WordBreak is not avaliable for the specified local, a default WordBreak is returned.
Returns
A BreakIterator for word-breaks
Description
Create BreakIterator for word-breaks using default locale. Returns an instance of a BreakIterator implementing word breaks. WordBreak is usefull for word selection (ex. double click)


 BreakIterator.last

BreakIterator.last

Syntax
public abstract int last()
Returns
The character index of the last text boundary.
Description
Return the last boundary. The iterator's current position is set to the last boundary.


 BreakIterator.next

BreakIterator.next

Syntax 1
public abstract int next( int n )
Parameters
n
which boundary to return. A value of 0 does nothing. Negative values move to previous boundaries and positive values move to later boundaries.
Returns
The index of the nth boundary from the current position.
Description
Return the nth boundary from the current boundary

Syntax 2
public abstract int next()
Returns
The character index of the next text boundary or DONE if all boundaries have been returned. Equivalent to next(1).
Description
Return the boundary following the current boundary.


 BreakIterator.previous

BreakIterator.previous

Syntax
public abstract int previous()
Returns
The character index of the previous text boundary or DONE if all boundaries have been returned.
Description
Return the boundary preceding the current boundary.


 BreakIterator.setText

BreakIterator.setText

Syntax 1
public void setText( String newText )
Parameters
newText
new text to scan.
Description
Set a new text string to be scanned. The current scan position is reset to first().

Syntax 2
public abstract void setText( CharacterIterator newText )
Parameters
newText
new text to scan.
Description
Set a new text for scanning. The current scan position is reset to first().


 Interface CharacterIterator

Interface java.text.CharacterIterator

Interface Members | This Package | All Packages

public interface CharacterIterator
extends Cloneable

This interface defines a protocol for bidirectional iteration over text. The iterator iterates over a bounded sequence of characters. Characters are indexed with values beginning with the value returned by getBeginIndex and continuing through the value returned by getEndIndex()-1. The index of the current character can be retrieved by calling getIndex. Calling setIndex will move the iterator to a new position within the sequence of characters. If at any time the iterator's current index moves outside the range of getBeginIndex and getEndIndex, previous() and next() will return DONE, signaling that the iterator has reached the end of the sequence.

Examples:

Traverse the text from start to finish

 public void traverseForward(CharacterIterator iter) {
     for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
         processChar(c);
     }
 }
Traverse the text backwards, from end to start
 public void traverseBackward(CharacterIterator iter) {
     for(char c = iter.last(); c != CharacterIterator.DONE; c = iter.prev()) {
         processChar(c);
     }
 }
Traverse both forward and backward from a given position in the text. Calls to notBoundary() in this example represents some additional stopping criteria.
 public void traverseOut(CharacterIterator iter, int pos) {
     for (char c = iter.setIndex(pos);
          c != CharacterIterator.DONE && notBoundary(c);
          c = iter.next()) {}
 int end = iter.getIndex();
 for (char c = iter.setIndex(pos);
     c != CharacterIterator.DONE && notBoundary(c);
     c = iter.prev()) {}
 int start = iter.getIndex();
 processSection(start,end);
 }

See Also:
StringCharacterIterator


 CharacterIterator Members

CharacterIterator Members

Interface Overview | This Package | All Packages

Fields
Name | Description
DONE | Constant that is returned when the iterator has reached either the end or the beginning of the text.

Methods
Name | Description
clone() | Create a copy of this iterator
current() | Get the character at the current position (as returned by getIndex()).
first() | Set the position to getBeginIndex() and return the character at that position.
getBeginIndex() | Return the start index of the text.
getEndIndex() | Return the end index of the text.
getIndex() | Return the current index.
last() | Set the position to getEndIndex()-1, return the character at that position.
next() | Increment the iterator's index by one and return the character at the new index.
previous() | Decrement the iterator's index by one and return the character at the new index.
setIndex(int) | Set the position to the specified position in the text and return that character.


 CharacterIterator.DONE

CharacterIterator.DONE

Interface Overview | Interface Members | This Package | All Packages

Syntax
public static final char DONE
Description
Constant that is returned when the iterator has reached either the end or the beginning of the text. The unicode 2.0 standard states that '\\uFFFF' is an invalid unicode value and should not occur in any valid unicode string.


 CharacterIterator.clone

CharacterIterator.clone

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Object clone()
Returns
A copy of this
Description
Create a copy of this iterator

Overrides
clone in class Object


 CharacterIterator.current

CharacterIterator.current

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract char current()
Returns
the character at the current position or DONE if the current position is off the end of the text.
Description
Get the character at the current position (as returned by getIndex()).

See Also
getIndex


 CharacterIterator.first

CharacterIterator.first

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract char first()
Returns
the first character in the text
Description
Set the position to getBeginIndex() and return the character at that position.

See Also
getBeginIndex


 CharacterIterator.getBeginIndex

CharacterIterator.getBeginIndex

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getBeginIndex()
Returns
the index at which the text begins.
Description
Return the start index of the text.


 CharacterIterator.getEndIndex

CharacterIterator.getEndIndex

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getEndIndex()
Returns
the index at which the text end.
Description
Return the end index of the text. This index is the index of the first character following the end of the text.


 CharacterIterator.getIndex

CharacterIterator.getIndex

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract int getIndex()
Returns
the current index.
Description
Return the current index.


 CharacterIterator.last

CharacterIterator.last

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract char last()
Returns
the last character in the text
Description
Set the position to getEndIndex()-1, return the character at that position.

See Also
getEndIndex


 CharacterIterator.next

CharacterIterator.next

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract char next()
Returns
the character at the new position or DONE if the current position is off the end of the text.
Description
Increment the iterator's index by one and return the character at the new index. If the resulting index is greater or equal to getEndIndex(), the current index is reset to getEndIndex() and a value of DONE is returned.


 CharacterIterator.previous

CharacterIterator.previous

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract char previous()
Returns
the character at the new position or DONE if the current position is off the end of the text.
Description
Decrement the iterator's index by one and return the character at the new index. If the resulting index is less than getBeginIndex(), the current index is reset to getBeginIndex() and a value of DONE is returned.


 CharacterIterator.setIndex

CharacterIterator.setIndex

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract char setIndex( int position )
Parameters
position
the position within the text. Valid values range from getBeginIndex() to getEndIndex() - 1. An IllegalArgumentException is thrown if an invalid value is supplied.
Returns
the character at the specified position.
Description
Set the position to the specified position in the text and return that character.


 Class ChoiceFormat

Class java.text.ChoiceFormat

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.text.Format
           |
           +----java.text.NumberFormat
                   |
                   +----java.text.ChoiceFormat

public class ChoiceFormat
extends NumberFormat

A ChoiceFormat allows you to attach a format to a range of numbers. It is generally used in a MessageFormat for handling plurals. The choice is specified with an ascending list of doubles, where each item specifies a half-open interval up to the next item:

 X matches j if and only if limit[j] <= X < limit[j+1]
If there is no match, then either the first or last index is used, depending on whether the number (X) is too low or too high.

Note: ChoiceFormat differs from the other Format classes in that you create a ChoiceFormat object with a constructor (not with a getInstance style factory method). The factory methods aren't necessary because ChoiceFormat doesn't require any complex setup for a given locale. In fact, ChoiceFormat doesn't implement any locale specific behavior.

When creating a ChoiceFormat, you must specify an array of formats and an array of limits. The length of these arrays must be the same. For example,

  •      limits = {1,2,3,4,5,6,7}
formats = {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"}

     limits = {0, 1, ChoiceFormat.nextDouble(1)}
formats = {"no files", "one file", "many files"}
(nextDouble can be used to get the next higher double, to
     make the half-open interval.)

Here is a simple example that shows formatting and parsing:

 double[] limits = {1,2,3,4,5,6,7};
 String[] monthNames = {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"};
 ChoiceFormat form = new ChoiceFormat(limits, monthNames);
 ParsePosition status = new ParsePosition(0);
 for (double i = 0.0; i <= 8.0; ++i) {
     status.setIndex(0);
     System.out.println(i + " -> " + form.format(i) + " -> "
                              + form.parse(form.format(i),status));
 }
Here is a more complex example, with a pattern format:
 double[] filelimits = {0,1,2};
 String[] filepart = {"are no files","is one file","are {2} files"};
 ChoiceFormat fileform = new ChoiceFormat(filelimits, filepart);
 Format[] testFormats = {fileform, null, NumberFormat.getInstance()};
 MessageFormat pattform = new MessageFormat("There {0} on {1}");
 pattform.setFormats(testFormats);
 Object[] testArgs = {null, "ADisk", null};
 for (int i = 0; i < 4; ++i) {
     testArgs[0] = new Integer(i);
     testArgs[2] = testArgs[0];
     System.out.println(pattform.format(testArgs));
 }

See Also:
DecimalFormat, MessageFormat


 ChoiceFormat Members

ChoiceFormat Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ChoiceFormat(double[], String[]) | Constructs with the limits and the corresponding formats.
ChoiceFormat(String) | Constructs with limits and corresponding formats based on the pattern.

Methods
Name | Description
applyPattern(String) | Sets the pattern.
clone() | Overrides Cloneable
equals(Object) | Equality comparision between two
format(double, StringBuffer, FieldPosition) | Specialization of format.
format(long, StringBuffer, FieldPosition) | Specialization of format.
getFormats() | Get the formats passed in the constructor.
getLimits() | Get the limits passed in the constructor.
hashCode() | Generates a hash code for the message format object.
nextDouble(double) | Finds the least double greater than d.
nextDouble(double, boolean) |
parse(String, ParsePosition) | Returns a Long if possible (e.g.
previousDouble(double) | Finds the greatest double less than d.
setChoices(double[], String[]) | Set the choices to be used in formatting.
toPattern() | Gets the pattern.


 ChoiceFormat.ChoiceFormat

ChoiceFormat.ChoiceFormat

Syntax 1
public ChoiceFormat( String newPattern )
Description
Constructs with limits and corresponding formats based on the pattern.

Syntax 2
public ChoiceFormat( double limits[], String formats[] )
Description
Constructs with the limits and the corresponding formats.

See Also
setChoices


 ChoiceFormat.applyPattern

ChoiceFormat.applyPattern

Syntax
public void applyPattern( String newPattern )
Parameters
newPattern
See the class description.
Description
Sets the pattern.


 ChoiceFormat.clone

ChoiceFormat.clone

Syntax
public Object clone()
Description
Overrides Cloneable

Overrides
clone in class NumberFormat


 ChoiceFormat.equals

ChoiceFormat.equals

Syntax
public boolean equals( Object obj )
Description
Equality comparision between two

Overrides
equals in class NumberFormat


 ChoiceFormat.format

ChoiceFormat.format

Syntax 1
public StringBuffer format( long number, StringBuffer toAppendTo, FieldPosition status )
Description
Specialization of format. This method really calls format(double, StringBuffer, FieldPosition) thus the range of longs that are supported is only equal to the range that can be stored by double. This will never be a practical limitation.

Overrides
format in class NumberFormat

Syntax 2
public StringBuffer format( double number, StringBuffer toAppendTo, FieldPosition status )
Description
Specialization of format.

Overrides
format in class NumberFormat


 ChoiceFormat.getFormats

ChoiceFormat.getFormats

Syntax
public Object[] getFormats()
Returns
the formats.
Description
Get the formats passed in the constructor.


 ChoiceFormat.getLimits

ChoiceFormat.getLimits

Syntax
public double[] getLimits()
Returns
the limits.
Description
Get the limits passed in the constructor.


 ChoiceFormat.hashCode

ChoiceFormat.hashCode

Syntax
public int hashCode()
Description
Generates a hash code for the message format object.

Overrides
hashCode in class NumberFormat


 ChoiceFormat.nextDouble

ChoiceFormat.nextDouble

Syntax
public static final double nextDouble( double d )
Description
Finds the least double greater than d. If NaN, returns same value.

Used to make half-open intervals.

See Also
previousDouble


 ChoiceFormat.nextDouble

ChoiceFormat.nextDouble

Syntax
public static double nextDouble( double d, boolean positive )


 ChoiceFormat.parse

ChoiceFormat.parse

Syntax
public Number parse( String text, ParsePosition status )
Description
Returns a Long if possible (e.g.

Overrides
parse in class NumberFormat


 ChoiceFormat.previousDouble

ChoiceFormat.previousDouble

Syntax
public static final double previousDouble( double d )
Description
Finds the greatest double less than d. If NaN, returns same value.

See Also
nextDouble


 ChoiceFormat.setChoices

ChoiceFormat.setChoices

Syntax
public void setChoices( double limits[], String formats[] )
Parameters
limits
contains the top value that you want parsed with that format,and should be in ascending sorted order. When formatting X, the choice will be the i, where limit[i] <= X < limit[i+1].
formats
are the formats you want to use for each limit. They can be either Format objects or Strings. When formatting with object Y, if the object is a NumberFormat, then ((NumberFormat) Y).format(X) is called. Otherwise Y.toString() is called.
Description
Set the choices to be used in formatting.


 ChoiceFormat.toPattern

ChoiceFormat.toPattern

Syntax
public String toPattern()
Description
Gets the pattern.


 Class CollationElementIterator

Class java.text.CollationElementIterator

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.text.CollationElementIterator

public final class CollationElementIterator
extends Object

The CollationElementIterator class is used as an iterator to walk through each character of an international string. Use the iterator to return the ordering priority of the positioned character. The ordering priority of a character, which we refer to as a key, defines how a character is collated in the given collation object.

For example, consider the following in Spanish:

 "ca" -> the first key is key('c') and second key is key('a').
 "cha" -> the first key is key('ch') and second key is key('a').
And in German,
 "äb"-> the first key is key('a'), the second key is key('e'), and
 the third key is key('b').
The key of a character is an integer composed of primary order(short), secondary order(byte), and tertiary order(byte). Java strictly defines the size and signedness of its primitive data types. Therefore, the static functions primaryOrder, secondaryOrder, and tertiaryOrder return int, short, and short respectively to ensure the correctness of the key value.

Example of the iterator usage,

 // get the first key of the string
 String str = "This is a test";
 CollationElementIterator c =
     new CollationElementIterator(str, 0, str.length(),
                                  Collator.getInstance());
 int primaryOrder = CollationElementIterator.primaryOrder(c->next());

CollationElementIterator.next returns the collation order of the next character. A collation order consists of primary order, secondary order and tertiary order. The data type of the collation order is int. The first 16 bits of a collation order is its primary order; the next 8 bits is the secondary order and the last 8 bits is the tertiary order.

See Also:
Collator, RuleBasedCollator


 CollationElementIterator Members

CollationElementIterator Members

Class Overview | This Package | All Packages

Fields
Name | Description
NULLORDER | Null order which indicates the end of string is reached by the cursor.

Methods
Name | Description
next() | Get the ordering priority of the next character in the string.
primaryOrder(int) | Get the primary order of a collation order.
reset() | Resets the cursor to the beginning of the string.
secondaryOrder(int) | Get the secondary order of a collation order.
tertiaryOrder(int) | Get the tertiary order of a collation order.


 CollationElementIterator.NULLORDER

CollationElementIterator.NULLORDER

Syntax
public static final int NULLORDER
Description
Null order which indicates the end of string is reached by the cursor.


 CollationElementIterator.next

CollationElementIterator.next

Syntax
public int next()
Returns
the next character's ordering. Returns NULLORDER if the end of string is reached.
Description
Get the ordering priority of the next character in the string.


 CollationElementIterator.primaryOrder

CollationElementIterator.primaryOrder

Syntax
public static final int primaryOrder( int order )
Parameters
order
the collation order
Returns
the primary order of a collation order.
Description
Get the primary order of a collation order.


 CollationElementIterator.reset

CollationElementIterator.reset

Syntax
public void reset()
Description
Resets the cursor to the beginning of the string.


 CollationElementIterator.secondaryOrder

CollationElementIterator.secondaryOrder

Syntax
public static final short secondaryOrder( int order )
Parameters
order
the collation order
Returns
the secondary order of a collation order.
Description
Get the secondary order of a collation order.


 CollationElementIterator.tertiaryOrder

CollationElementIterator.tertiaryOrder

Syntax
public static final short tertiaryOrder( int order )
Parameters
order
the collation order
Returns
the tertiary order of a collation order.
Description
Get the tertiary order of a collation order.


 Class CollationKey

Class java.text.CollationKey

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.text.CollationKey

public final class CollationKey
extends Object

A CollationKey represents a String under the rules of a specific Collator object. Comparing two CollationKeys returns the relative order of the Strings they represent. Using CollationKeys to compare Strings is generally faster than using Collator.compare. Thus, when the Strings must be compared multiple times, for example when sorting a list of Strings. It's more efficient to use CollationKeys.

You can not create CollationKeys directly. Rather, generate them by calling Collator.getCollationKey. You can only compare CollationKeys generated from the same Collator object.

Generating a CollationKey for a String involves examining the entire String and converting it to series of bits that can be compared bitwise. This allows fast comparisons once the keys are generated. The cost of generating keys is recouped in faster comparisons when Strings need to be compared many times. On the other hand, the result of a comparison is often determined by the first couple of characters of each String. Collator.compare examines only as many characters as it needs which allows it to be faster when doing single comparisons.

The following example shows how CollationKeys might be used to sort a list of Strings.

 // Create an array of CollationKeys for the Strings to be sorted.
 Collator myCollator = Collator.getInstance();
 CollationKey[] keys = new CollationKey[3];
 keys[0] = myCollator.getCollationKey("Tom");
 keys[1] = myCollator.getCollationKey("Dick");
 keys[2] = myCollator.getCollationKey("Harry");
 sort( keys );

 //...

 // Inside body of sort routine, compare keys this way
 if( keys[i].compareTo( keys[j] ) > 0 )
    // swap keys[i] and keys[j]

 //...

 // Finally, when we've returned from sort.
 System.out.println( keys[0].getSourceString() );
 System.out.println( keys[1].getSourceString() );
 System.out.println( keys[2].getSourceString() );

See Also:
Collator, RuleBasedCollator


 CollationKey Members

CollationKey Members

Class Overview | This Package | All Packages

Methods
Name | Description
compareTo(CollationKey) | Compare this CollationKey to the target CollationKey.
equals(Object) | Compare this CollationKey and the target CollationKey for equality.
getSourceString() | Returns the String that this CollationKey represents.
hashCode() | Creates a hash code for this CollationKey.
toByteArray() | Converts the CollationKey to a sequence of bits.


 CollationKey.compareTo

CollationKey.compareTo

Syntax
public int compareTo( CollationKey target )
Parameters
target
target CollationKey
Returns
Returns an integer value. Value is less than zero if this is less than target, value is zero if this and target are equal and value is greater than zero if this is greater than target.
Description
Compare this CollationKey to the target CollationKey. The collation rules of the Collator object which created these keys are applied. Note: CollationKeys created by different Collators can not be compared.

See Also
compare


 CollationKey.equals

CollationKey.equals

Syntax
public boolean equals( Object target )
Parameters
target
the CollationKey to compare to.
Returns
Returns true if two objects are equal, false otherwise.
Description
Compare this CollationKey and the target CollationKey for equality. The collation rules of the Collator object which created these keys are applied. Note: CollationKeys created by different Collators can not be compared.

Overrides
equals in class Object


 CollationKey.getSourceString

CollationKey.getSourceString

Syntax
public String getSourceString()
Description
Returns the String that this CollationKey represents.


 CollationKey.hashCode

CollationKey.hashCode

Syntax
public int hashCode()
Returns
the hash value based on the string's collation order.
Description
Creates a hash code for this CollationKey. The hash value is calculated on the key itself, not the String from which the key was created. Thus if x and y are CollationKeys, then x.hashCode(x) == y.hashCode() if x.equals(y) is true. This allows language-sensitive comparison in a hash table. See the CollatinKey class description for an example.

Overrides
hashCode in class Object


 CollationKey.toByteArray

CollationKey.toByteArray

Syntax
public byte[] toByteArray()
Description
Converts the CollationKey to a sequence of bits. If two CollationKeys could be legitimately compared, then one could compare the byte arrays for each of those keys to obtain the same result. Byte arrays are organized most significant byte first.


 Class Collator

Class java.text.Collator

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.text.Collator

public abstract class Collator
extends Object
implements Cloneable, Serializable

The Collator class performs locale-sensitive String comparison. You use this class to build searching and sorting routines for natural language text.

Collator is an abstract base class. Subclasses implement specific collation strategies. One subclass, RuleBasedCollator, is currently provided with the JDK and is applicable to a wide set of languages. Other subclasses may be created to handle more specialized needs.

Like other locale-sensitive classes, you can use the static factory method, getInstance, to obtain the appropriate Collator object for a given locale. You will only need to look at the subclasses of Collator if you need to understand the details of a particular collation strategy or if you need to modify that strategy.

The following example shows how to compare two strings using the Collator for the default locale.

 // Compare two strings in the default locale
 Collator myCollator = Collator.getInstance();
 if( myCollator.compare("abc", "ABC") < 0 )
     System.out.println("abc is less than ABC");
 else
     System.out.println("abc is greater than or equal to ABC");

You can set a Collator's strength property to determine the level of difference considered significant in comparisons. Four strengths are provided: PRIMARY, SECONDARY, TERTIARY, and IDENTICAL. The exact assignment of strengths to language features is locale dependant. For example, in Czech, "e" and "f" are considered primary differences, while "e" and "ê" are secondary differences, "e" and "E" are tertiary differences and "e" and "e" are identical. The following shows how both case and accents could be ignored for US English.

 //Get the Collator for US English and set its strength to PRIMARY
 Collator usCollator = Collator.getInstance(Locale.US);
 usCollator.setStrength(Collator.PRIMARY);
 if( usCollator.compare("abc", "ABC") == 0 ) {
     System.out.println("Strings are equivalent");
 }

For comparing Strings exactly once, the compare method provides the best performance. When sorting a list of Strings however, it is generally necessary to compare each String multiple times. In this case, CollationKeys provide better performance. The CollationKey class converts a String to a series of bits that can be compared bitwise against other CollationKeys. A CollationKey is created by a Collator object for a given String.
Note: CollationKeys from different Collators can not be compared. See the class description for CollationKey for an example using CollationKeys.

See Also:
RuleBasedCollator, CollationKey, CollationElementIterator, Locale


 Collator Members

Collator Members

Class Overview | This Package | All Packages

Fields
Name | Description
CANONICAL_DECOMPOSITION | Decomposition mode value.
FULL_DECOMPOSITION | Decomposition mode value.
IDENTICAL | Collator strength value.
NO_DECOMPOSITION | Decomposition mode value.
PRIMARY | Collator strength value.
SECONDARY | Collator strength value.
TERTIARY | Collator strength value.

Constructors
Name | Description
Collator() | Default constructor.

Methods
Name | Description
clone() | Overrides Cloneable
compare(String, String) | Compares the source string to the target string according to the collation rules for this Collator.
equals(Object) | Compares the equality of two Collators.
equals(String, String) | Convenience method for comparing the equality of two strings based on this Collator's collation rules.
getAvailableLocales() | Get the set of Locales for which Collators are installed.
getCollationKey(String) | Transforms the String into a series of bits that can be compared bitwise to other CollationKeys.
getDecomposition() | Get the decomposition mode of this Collator.
getInstance() | Gets the Collator for the current default locale.
getInstance(Locale) | Gets the Collator for the desired locale.
getStrength() | Returns this Collator's strength property.
hashCode() | Generates the hash code for this Collator.
setDecomposition(int) | Set the decomposition mode of this Collator.
setStrength(int) | Sets this Collator's strength property.


 Collator.CANONICAL_DECOMPOSITION

Collator.CANONICAL_DECOMPOSITION

Syntax
public static final int CANONICAL_DECOMPOSITION
Description
Decomposition mode value. With CANONICAL_DECOMPOSITION set, characters that are canonical variants according to Unicode 2.0 will be decomposed for collation. This is the default setting and should be used to get correct collation of accented characters.

See Also
getDecomposition, setDecomposition


 Collator.FULL_DECOMPOSITION

Collator.FULL_DECOMPOSITION

Syntax
public static final int FULL_DECOMPOSITION
Description
Decomposition mode value. With FULL_DECOMPOSITION set, both Unicode canonical variants and Unicode compatibility variants will be decomposed for collation. This causes not only accented characters to be collated, but also characters that have special formats to be collated with their norminal form. For example, the half-width and full-width ASCII and Katakana characters are then collated together. FULL_DECOMPOSITION is the most complete and therefore the slowest decomposition mode.

See Also
getDecomposition, setDecomposition


 Collator.IDENTICAL

Collator.IDENTICAL

Syntax
public static final int IDENTICAL
Description
Collator strength value. When set, all differences are considered significant during comparison. The assignment of strengths to language features is locale dependant. A common example is for characters with equivalent Unicode spellings ("ä" vs "a?") to be considered IDENTICAL.


 Collator.NO_DECOMPOSITION

Collator.NO_DECOMPOSITION

Syntax
public static final int NO_DECOMPOSITION
Description
Decomposition mode value. With NO_DECOMPOSITION set, accented characters will not be decomposed for collation. This provides the fastest collation but will only produce correct results for languages that do not use accents.

See Also
getDecomposition, setDecomposition


 Collator.PRIMARY

Collator.PRIMARY

Syntax
public static final int PRIMARY
Description
Collator strength value. When set, only PRIMARY differences are considered significant during comparison. The assignment of strengths to language features is locale dependant. A common example is for different base letters ("a" vs "b") to be considered a PRIMARY difference.

See Also
setStrength, getStrength


 Collator.SECONDARY

Collator.SECONDARY

Syntax
public static final int SECONDARY
Description
Collator strength value. When set, only SECONDARY and above differences are considered significant during comparison. The assignment of strengths to language features is locale dependant. A common example is for different accented forms of the same base letter ("a" vs "ä") to be considered a SECONDARY difference.

See Also
setStrength, getStrength


 Collator.TERTIARY

Collator.TERTIARY

Syntax
public static final int TERTIARY
Description
Collator strength value. When set, only TERTIARY and above differences are considered significant during comparison. The assignment of strengths to language features is locale dependant. A common example is for case differences ("a" vs "A") to be considered a TERTIARY difference.

See Also
setStrength, getStrength


 Collator.Collator

Collator.Collator

Syntax
protected Collator()
Description
Default constructor. This constructor is protected so subclasses can get access to it. Users typically create a Collator sub-class by calling the factory method getInstance.

See Also
getInstance


 Collator.clone

Collator.clone

Syntax
public Object clone()
Description
Overrides Cloneable

Overrides
clone in class Object


 Collator.compare

Collator.compare

Syntax
public abstract int compare( String source, String target )
Parameters
source
the source string.
target
the target string.
Returns
Returns an integer value. Value is less than zero if source is less than target, value is zero if source and target are equal, value is greater than zero if source is greater than target.
Description
Compares the source string to the target string according to the collation rules for this Collator. Returns an integer less than, equal to or greater than zero depending on whether the source String is less than, equal to or greater than the target string. See the Collator class description for an example of use.

For a one time comparison, this method has the best performance. If a given String will be involved in multiple comparisons, CollationKey.compareTo has the best performance. See the Collator class description for an example using CollationKeys.

See Also
CollationKey, getCollationKey


 Collator.equals

Collator.equals

Syntax
public boolean equals( String source, String target )
Parameters
source
the source string to be compared with.
target
the target string to be compared with.
Returns
true if the strings are equal according to the collation rules. false, otherwise.
Description
Convenience method for comparing the equality of two strings based on this Collator's collation rules.

See Also
compare


 Collator.equals

Collator.equals

Syntax
public boolean equals( Object that )
Parameters
that
the Collator to be compared with this.
Returns
true if this Collator is the same as that Collator; false otherwise.
Description
Compares the equality of two Collators.

Overrides
equals in class Object


 Collator.getAvailableLocales

Collator.getAvailableLocales

Syntax
public static synchronized Locale[] getAvailableLocales()
Returns
the list of available locales which collators are installed.
Description
Get the set of Locales for which Collators are installed.


 Collator.getCollationKey

Collator.getCollationKey

Syntax
public abstract CollationKey getCollationKey( String source )
Parameters
source
the string to be transformed into a collation key.
Returns
the CollationKey for the given String based on this Collator's collation rules. If the source String is null, a null CollationKey is returned.
Description
Transforms the String into a series of bits that can be compared bitwise to other CollationKeys. CollationKeys provide better performance than Collator.compare when Strings are involved in multiple comparisons. See the Collator class description for an example using CollationKeys.

See Also
CollationKey, compare


 Collator.getDecomposition

Collator.getDecomposition

Syntax
public synchronized int getDecomposition()
Returns
the decomposition mode
Description
Get the decomposition mode of this Collator. Decomposition mode determines how Unicode composed characters are handled. Adjusting decomposition mode allows the user to select between faster and more complete collation behavior.

The three values for decomposition mode are:

  • NO_DECOMPOSITION,
  • CANONICAL_DECOMPOSITION
  • FULL_DECOMPOSITION.
See the documentation for these three constants for a description of their meaning.

See Also
setDecomposition, NO_DECOMPOSITION, CANONICAL_DECOMPOSITION, FULL_DECOMPOSITION


 Collator.getInstance

Collator.getInstance

Syntax 1
public static synchronized Collator getInstance()
Returns
the Collator for the default locale.(for example, en_US)
Description
Gets the Collator for the current default locale. The default locale is determined by java.util.Locale.getDefault.

See Also
getDefault

Syntax 2
public static synchronized Collator getInstance( Locale desiredLocale )
Parameters
desiredLocale
the desired locale.
Returns
the Collator for the desired locale.
Description
Gets the Collator for the desired locale.

See Also
Locale, ResourceBundle


 Collator.getStrength

Collator.getStrength

Syntax
public synchronized int getStrength()
Returns
this Collator's current strength property.
Description
Returns this Collator's strength property. The strength property determines the minimum level of difference considered significant during comparison. See the Collator class description for an example of use.

See Also
setStrength, PRIMARY, SECONDARY, TERTIARY, IDENTICAL


 Collator.hashCode

Collator.hashCode

Syntax
public abstract synchronized int hashCode()
Description
Generates the hash code for this Collator.

Overrides
hashCode in class Object


 Collator.setDecomposition

Collator.setDecomposition

Syntax
public synchronized void setDecomposition( int decompositionMode )
Parameters
the
new decomposition mode
Description
Set the decomposition mode of this Collator. See getDecomposition for a description of decomposition mode.

Exceptions
IllegalArgumentException If the given value is not a valid decomposition mode.
See Also
getDecomposition, NO_DECOMPOSITION, CANONICAL_DECOMPOSITION, FULL_DECOMPOSITION


 Collator.setStrength

Collator.setStrength

Syntax
public synchronized void setStrength( int newStrength )
Parameters
the
new strength value.
Description
Sets this Collator's strength property. The strength property determines the minimum level of difference considered significant during comparison. See the Collator class description for an example of use.

Exceptions
IllegalArgumentException If the new strength value is not one of PRIMARY, SECONDARY, TERTIARY or IDENTICAL.
See Also
getStrength, PRIMARY, SECONDARY, TERTIARY, IDENTICAL


 Class DateFormat

Class java.text.DateFormat

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.text.Format
           |
           +----java.text.DateFormat

public abstract class DateFormat
extends Format
implements Cloneable

DateFormat is an abstract class for date/time formatting subclasses which formats and parses dates or time in a language-independent manner. The date/time formatting subclass, such as SimpleDateFormat, allows for formatting (i.e., millis -> text), parsing (text -> millis), and normalization. Formats/Parses a date or time, which is the standard millis since 24:00 GMT, Jan 1, 1970

DateFormat provides many class methods for obtaining default date/time formatters based on the default or a given loacle and a number of formatting styles. The formatting styles include FULL, LONG, MEDIUM, and SHORT. More detail and examples of using these styles are provided in the method descriptions.

DateFormat helps you to format and parse dates for any locale. Your code can be completely independent of the locale conventions for months, days of the week, or even the calendar format: lunar vs. solar.

To format a date for the current Locale, use one of the static factory methods:

  myString = DateFormat.getDateInstance().format(myDate);

If you are formatting multiple numbers, it is more efficient to get the format and use it multiple times so that the system doesn't have to fetch the information about the local language and country conventions multiple times.

  DateFormat df = DateFormat.getDateInstance();
  for (int i = 0; i < a.length; ++i) {
    output.println(df.format(myDate[i]) + "; ");
  }

To format a number for a different Locale, specify it in the call to getDateInstance().

  DateFormat df = DateFormat.getDateInstance(Locale.FRANCE);

You can use a DateFormat to parse also.

  myDate = df.parse(myString);

Use getDate to get the normal date format for that country. There are other static factory methods available. Use getTime to get the time format for that country. Use getDateTime to get a date and time format. You can pass in different options to these factory methods to control the length of the result; from SHORT to MEDIUM to LONG to FULL. The exact result depends on the locale, but generally:

  • SHORT is completely numeric, such as 12.13.52 or 3:30pm
  • MEDIUM is longer, such as Jan 12, 1952
  • LONG is longer, such as January 12, 1952 or 3:30:32pm
  • FULL is pretty completely specified, such as Tuesday, April 12, 1952 AD or 3:30:42pm PST.

You can also set the time zone on the format if you wish. If you want even more control over the format or parsing, (or want to give your users more control), you can try casting the DateFormat you get from the factory methods to a SimpleDateFormat. This will work for the majority of countries; just remember to put it in a try block in case you encounter an unusual one.

You can also use forms of the parse and format methods with ParsePosition and FieldPosition to allow you to

  • pregressively parse through pieces of a string.
  • align any particular field, or find out where it is for selection on the screen.

See Also:
Format, NumberFormat, SimpleDateFormat, Calendar, GregorianCalendar, TimeZone


 DateFormat Members

DateFormat Members

Class Overview | This Package | All Packages

Fields
Name | Description
AM_PM_FIELD | Useful constant for AM_PM field alignment.
calendar | The calendar that DateFormat uses to produce the time field values needed to implement date/time formatting.
DATE_FIELD | Useful constant for DATE field alignment.
DAY_OF_WEEK_FIELD | Useful constant for DAY_OF_WEEK field alignment.
DAY_OF_WEEK_IN_MONTH_FIELD | Useful constant for DAY_OF_WEEK_IN_MONTH field alignment.
DAY_OF_YEAR_FIELD | Useful constant for DAY_OF_YEAR field alignment.
DEFAULT | Constant for default style pattern.
ERA_FIELD | Useful constant for ERA field alignment.
FULL | Constant for full style pattern.
HOUR0_FIELD | Useful constant for zero-based HOUR field alignment.
HOUR1_FIELD | Useful constant for one-based HOUR field alignment.
HOUR_OF_DAY0_FIELD | Useful constant for zero-based HOUR_OF_DAY field alignment.
HOUR_OF_DAY1_FIELD | Useful constant for one-based HOUR_OF_DAY field alignment.
LONG | Constant for long style pattern.
MEDIUM | Constant for medium style pattern.
MILLISECOND_FIELD | Useful constant for MILLISECOND field alignment.
MINUTE_FIELD | Useful constant for MINUTE field alignment.
MONTH_FIELD | Useful constant for MONTH field alignment.
numberFormat | The number formatter that DateFormat uses to format numbers in dates and times.
SECOND_FIELD | Useful constant for SECOND field alignment.
SHORT | Constant for short style pattern.
TIMEZONE_FIELD | Useful constant for TIMEZONE field alignment.
WEEK_OF_MONTH_FIELD | Useful constant for WEEK_OF_MONTH field alignment.
WEEK_OF_YEAR_FIELD | Useful constant for WEEK_OF_YEAR field alignment.
YEAR_FIELD | Useful constant for YEAR field alignment.

Constructors
Name | Description
DateFormat() |

Methods
Name | Description
clone() | Overrides Cloneable
equals(Object) | Overrides equals
format(Date) | Formats a Date into a date/time string.
format(Date, StringBuffer, FieldPosition) | Formats a Date into a date/time string.
format(Object, StringBuffer, FieldPosition) | Overrides Format.
getAvailableLocales() | Gets the set of locales for which DateFormats are installed.
getCalendar() | Gets the calendar associated with this date/time formatter.
getDateInstance() | Gets the date formatter with the default formatting style for the default locale.
getDateInstance(int) | Gets the date formatter with the given formatting style for the default locale.
getDateInstance(int, Locale) | Gets the date formatter with the given formatting style for the given locale.
getDateTimeInstance() | Gets the date/time formatter with the default formatting style for the default locale.
getDateTimeInstance(int, int) | Gets the date/time formatter with the given date and time formatting styles for the default locale.
getDateTimeInstance(int, int, Locale) | Gets the date/time formatter with the given formatting styles for the given locale.
getInstance() | Get a default date/time formatter that uses the SHORT style for both the date and the time.
getNumberFormat() | Gets the number formatter which this date/time formatter uses to format and parse a time.
getTimeInstance() | Gets the time formatter with the default formatting style for the default locale.
getTimeInstance(int) | Gets the time formatter with the given formatting style for the default locale.
getTimeInstance(int, Locale) | Gets the time formatter with the given formatting style for the given locale.
getTimeZone() | Gets the time zone.
hashCode() | Overrides hashCode
isLenient() | Tell whether date/time parsing is to be lenient.
parse(String) | Parse a date/time string.
parse(String, ParsePosition) | Parse a date/time string according to the given parse position.
parseObject(String, ParsePosition) | Parse a date/time string into an Object.
setCalendar(Calendar) | Set the calendar to be used by this date format.
setLenient(boolean) | Specify whether or not date/time parsing is to be lenient.
setNumberFormat(NumberFormat) | Allows you to set the number formatter.
setTimeZone(TimeZone) | Sets the time zone for the calendar of this DateFormat object.


 DateFormat.AM_PM_FIELD

DateFormat.AM_PM_FIELD

Syntax
public static final int AM_PM_FIELD
Description
Useful constant for AM_PM field alignment. Used in FieldPosition of date/time formatting.


 DateFormat.calendar

DateFormat.calendar

Syntax
protected Calendar calendar
Description
The calendar that DateFormat uses to produce the time field values needed to implement date/time formatting. Subclasses should initialize this to the default calendar for the locale associated with this DateFormat.


 DateFormat.DATE_FIELD

DateFormat.DATE_FIELD

Syntax
public static final int DATE_FIELD
Description
Useful constant for DATE field alignment. Used in FieldPosition of date/time formatting.


 DateFormat.DAY_OF_WEEK_FIELD

DateFormat.DAY_OF_WEEK_FIELD

Syntax
public static final int DAY_OF_WEEK_FIELD
Description
Useful constant for DAY_OF_WEEK field alignment. Used in FieldPosition of date/time formatting.


 DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD

DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD

Syntax
public static final int DAY_OF_WEEK_IN_MONTH_FIELD
Description
Useful constant for DAY_OF_WEEK_IN_MONTH field alignment. Used in FieldPosition of date/time formatting.


 DateFormat.DAY_OF_YEAR_FIELD

DateFormat.DAY_OF_YEAR_FIELD

Syntax
public static final int DAY_OF_YEAR_FIELD
Description
Useful constant for DAY_OF_YEAR field alignment. Used in FieldPosition of date/time formatting.


 DateFormat.DEFAULT

DateFormat.DEFAULT

Syntax
public static final int DEFAULT
Description
Constant for default style pattern.


 DateFormat.ERA_FIELD

DateFormat.ERA_FIELD

Syntax
public static final int ERA_FIELD
Description
Useful constant for ERA field alignment. Used in FieldPosition of date/time formatting.


 DateFormat.FULL

DateFormat.FULL

Syntax
public static final int FULL
Description
Constant for full style pattern.


 DateFormat.HOUR0_FIELD

DateFormat.HOUR0_FIELD

Syntax
public static final int HOUR0_FIELD
Description
Useful constant for zero-based HOUR field alignment. Used in FieldPosition of date/time formatting. HOUR0_FIELD is used for the zero-based 12-hour clock. For example, 11:30 PM + 1 hour results in 00:30 AM.


 DateFormat.HOUR1_FIELD

DateFormat.HOUR1_FIELD

Syntax
public static final int HOUR1_FIELD
Description
Useful constant for one-based HOUR field alignment. Used in FieldPosition of date/time formatting. HOUR1_FIELD is used for the one-based 12-hour clock. For example, 11:30 PM + 1 hour results in 12:30 AM.


 DateFormat.HOUR_OF_DAY0_FIELD

DateFormat.HOUR_OF_DAY0_FIELD

Syntax
public static final int HOUR_OF_DAY0_FIELD
Description
Useful constant for zero-based HOUR_OF_DAY field alignment. Used in FieldPosition of date/time formatting. HOUR_OF_DAY0_FIELD is used for the zero-based 24-hour clock. For example, 23:59 + 01:00 results in 00:59.


 DateFormat.HOUR_OF_DAY1_FIELD

DateFormat.HOUR_OF_DAY1_FIELD

Syntax
public static final int HOUR_OF_DAY1_FIELD
Description
Useful constant for one-based HOUR_OF_DAY field alignment. Used in FieldPosition of date/time formatting. HOUR_OF_DAY1_FIELD is used for the one-based 24-hour clock. For example, 23:59 + 01:00 results in 24:59.


 DateFormat.LONG

DateFormat.LONG

Syntax
public static final int LONG
Description
Constant for long style pattern.


 DateFormat.MEDIUM

DateFormat.MEDIUM

Syntax
public static final int MEDIUM
Description
Constant for medium style pattern.


 DateFormat.MILLISECOND_FIELD

DateFormat.MILLISECOND_FIELD

Syntax
public static final int MILLISECOND_FIELD
Description
Useful constant for MILLISECOND field alignment. Used in FieldPosition of date/time formatting.


 DateFormat.MINUTE_FIELD

DateFormat.MINUTE_FIELD

Syntax
public static final int MINUTE_FIELD
Description
Useful constant for MINUTE field alignment. Used in FieldPosition of date/time formatting.


 DateFormat.MONTH_FIELD

DateFormat.MONTH_FIELD

Syntax
public static final int MONTH_FIELD
Description
Useful constant for MONTH field alignment. Used in FieldPosition of date/time formatting.


 DateFormat.numberFormat

DateFormat.numberFormat

Syntax
protected NumberFormat numberFormat
Description
The number formatter that DateFormat uses to format numbers in dates and times. Subclasses should initialize this to the default number format for the locale associated with this DateFormat.


 DateFormat.SECOND_FIELD

DateFormat.SECOND_FIELD

Syntax
public static final int SECOND_FIELD
Description
Useful constant for SECOND field alignment. Used in FieldPosition of date/time formatting.


 DateFormat.SHORT

DateFormat.SHORT

Syntax
public static final int SHORT
Description
Constant for short style pattern.


 DateFormat.TIMEZONE_FIELD

DateFormat.TIMEZONE_FIELD

Syntax
public static final int TIMEZONE_FIELD
Description
Useful constant for TIMEZONE field alignment. Used in FieldPosition of date/time formatting.


 DateFormat.WEEK_OF_MONTH_FIELD

DateFormat.WEEK_OF_MONTH_FIELD

Syntax
public static final int WEEK_OF_MONTH_FIELD
Description
Useful constant for WEEK_OF_MONTH field alignment. Used in FieldPosition of date/time formatting.


 DateFormat.WEEK_OF_YEAR_FIELD

DateFormat.WEEK_OF_YEAR_FIELD

Syntax
public static final int WEEK_OF_YEAR_FIELD
Description
Useful constant for WEEK_OF_YEAR field alignment. Used in FieldPosition of date/time formatting.


 DateFormat.YEAR_FIELD

DateFormat.YEAR_FIELD

Syntax
public static final int YEAR_FIELD
Description
Useful constant for YEAR field alignment. Used in FieldPosition of date/time formatting.


 DateFormat.DateFormat

DateFormat.DateFormat

Syntax
protected DateFormat()


 DateFormat.clone

DateFormat.clone

Syntax
public Object clone()
Description
Overrides Cloneable

Overrides
clone in class Format


 DateFormat.equals

DateFormat.equals

Syntax
public boolean equals( Object obj )
Description
Overrides equals

Overrides
equals in class Object


 DateFormat.format

DateFormat.format

Syntax 1
public final StringBuffer format( Object obj, StringBuffer toAppendTo, FieldPosition fieldPosition )
Parameters
obj
must be a Number or a Date.
toAppendTo
the string buffer for the returning time string.
status
the formatting status. On input: an alignment field, if desired. On output: the offsets of the alignment field.
Returns
the formatted time string.
Description
Overrides Format. Formats a time object into a time string. Examples of time objects are a time value expressed in milliseconds and a Date object.

Overrides
format in class Format
See Also
Format

Syntax 2
public abstract StringBuffer format( Date date, StringBuffer toAppendTo, FieldPosition fieldPosition )
Parameters
date
a Date to be formatted into a date/time string.
toAppendTo
the string buffer for the returning date/time string.
status
the formatting status. On input: an alignment field, if desired. On output: the offsets of the alignment field. For example, given a time text "1996.07.10 AD at 15:08:56 PDT", if the given status.field is DateFormat.YEAR_FIELD, the offsets status.beginIndex and status.getEndIndex will be set to 0 and 4, respectively. Notice that if the same time field appears more than once in a pattern, the status will be set for the first occurence of that time field. For instance, formatting a Date to the time string "1 PM PDT (Pacific Daylight Time)" using the pattern "h a z (zzzz)" and the alignment field DateFormat.TIMEZONE_FIELD, the offsets status.beginIndex and status.getEndIndex will be set to 5 and 8, respectively, for the first occurence of the timezone pattern character 'z'.
Returns
the formatted date/time string.
Description
Formats a Date into a date/time string.

Syntax 3
public final String format( Date date )
Parameters
date
the time value to be formatted into a time string.
Returns
the formatted time string.
Description
Formats a Date into a date/time string.


 DateFormat.getAvailableLocales

DateFormat.getAvailableLocales

Syntax
public static Locale[] getAvailableLocales()
Returns
the set of locales for which DateFormats are installed.
Description
Gets the set of locales for which DateFormats are installed.


 DateFormat.getCalendar

DateFormat.getCalendar

Syntax
public Calendar getCalendar()
Returns
the calendar associated with this date/time formatter.
Description
Gets the calendar associated with this date/time formatter.


 DateFormat.getDateInstance

DateFormat.getDateInstance

Syntax 1
public static final DateFormat getDateInstance()
Returns
a date formatter.
Description
Gets the date formatter with the default formatting style for the default locale.

Syntax 2
public static final DateFormat getDateInstance( int style )
Parameters
style
the given formatting style. For example, SHORT for "M/d/yy" in the US locale.
Returns
a date formatter.
Description
Gets the date formatter with the given formatting style for the default locale.

Syntax 3
public static final DateFormat getDateInstance( int style, Locale aLocale )
Parameters
style
the given formatting style. For example, SHORT for "M/d/yy" in the US locale.
inLocale
the given locale.
Returns
a date formatter.
Description
Gets the date formatter with the given formatting style for the given locale.


 DateFormat.getDateTimeInstance

DateFormat.getDateTimeInstance

Syntax 1
public static final DateFormat getDateTimeInstance()
Returns
a date/time formatter.
Description
Gets the date/time formatter with the default formatting style for the default locale.

Syntax 2
public static final DateFormat getDateTimeInstance( int dateStyle, int timeStyle )
Parameters
dateStyle
the given date formatting style. For example, SHORT for "M/d/yy" in the US locale.
timeStyle
the given time formatting style. For example, SHORT for "h:mm a" in the US locale.
Returns
a date/time formatter.
Description
Gets the date/time formatter with the given date and time formatting styles for the default locale.

Syntax 3
public static final DateFormat getDateTimeInstance( int dateStyle, int timeStyle, Locale aLocale )
Parameters
dateStyle
the given date formatting style.
timeStyle
the given time formatting style.
inLocale
the given locale.
Returns
a date/time formatter.
Description
Gets the date/time formatter with the given formatting styles for the given locale.


 DateFormat.getInstance

DateFormat.getInstance

Syntax
public static final DateFormat getInstance()
Description
Get a default date/time formatter that uses the SHORT style for both the date and the time.


 DateFormat.getNumberFormat

DateFormat.getNumberFormat

Syntax
public NumberFormat getNumberFormat()
Returns
the number formatter which this date/time formatter uses.
Description
Gets the number formatter which this date/time formatter uses to format and parse a time.


 DateFormat.getTimeInstance

DateFormat.getTimeInstance

Syntax 1
public static final DateFormat getTimeInstance()
Returns
a time formatter.
Description
Gets the time formatter with the default formatting style for the default locale.

Syntax 2
public static final DateFormat getTimeInstance( int style )
Parameters
style
the given formatting style. For example, SHORT for "h:mm a" in the US locale.
Returns
a time formatter.
Description
Gets the time formatter with the given formatting style for the default locale.

Syntax 3
public static final DateFormat getTimeInstance( int style, Locale aLocale )
Parameters
style
the given formatting style. For example, SHORT for "h:mm a" in the US locale.
inLocale
the given locale.
Returns
a time formatter.
Description
Gets the time formatter with the given formatting style for the given locale.


 DateFormat.getTimeZone

DateFormat.getTimeZone

Syntax
public TimeZone getTimeZone()
Returns
the time zone associated with the calendar of DateFormat.
Description
Gets the time zone.


 DateFormat.hashCode

DateFormat.hashCode

Syntax
public int hashCode()
Description
Overrides hashCode

Overrides
hashCode in class Object


 DateFormat.isLenient

DateFormat.isLenient

Syntax
public boolean isLenient()
Description
Tell whether date/time parsing is to be lenient.


 DateFormat.parse

DateFormat.parse

Syntax 1
public Date parse( String text ) throws ParseException
Description
Parse a date/time string.

Exceptions
ParseException If the given string cannot be parsed as a date.
See Also
parse

Syntax 2
public abstract Date parse( String text, ParsePosition pos )
Parameters
text
The date/time string to be parsed
pos
On input, the position at which to start parsing; on output, the position at which parsing terminated, or the start position if the parse failed.
Returns
A Date, or null if the input could not be parsed
Description
Parse a date/time string according to the given parse position. For example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date that is equivalent to Date(837039928046).

By default, parsing is lenient: If the input is not in the form used by this object's format method but can still be parsed as a date, then the parse succeeds. Clients may insist on strict adherence to the format by calling setLenient(false).

See Also
setLenient


 DateFormat.parseObject

DateFormat.parseObject

Syntax
public Object parseObject( String source, ParsePosition pos )
Description
Parse a date/time string into an Object. This convenience method simply calls parse(String, ParsePosition).

Overrides
parseObject in class Format
See Also
parse


 DateFormat.setCalendar

DateFormat.setCalendar

Syntax
public void setCalendar( Calendar newCalendar )
Description
Set the calendar to be used by this date format. Initially, the default calendar for the specified or default locale is used.


 DateFormat.setLenient

DateFormat.setLenient

Syntax
public void setLenient( boolean lenient )
Description
Specify whether or not date/time parsing is to be lenient. With lenient parsing, the parser may use heuristics to interpret inputs that do not precisely match this object's format. With strict parsing, inputs must match this object's format.

See Also
setLenient


 DateFormat.setNumberFormat

DateFormat.setNumberFormat

Syntax
public void setNumberFormat( NumberFormat newNumberFormat )
Parameters
newNumberFormat
the given new NumberFormat.
Description
Allows you to set the number formatter.


 DateFormat.setTimeZone

DateFormat.setTimeZone

Syntax
public void setTimeZone( TimeZone zone )
Parameters
zone
the given new time zone.
Description
Sets the time zone for the calendar of this DateFormat object.


 Class DateFormatSymbols

Class java.text.DateFormatSymbols

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.text.DateFormatSymbols

public class DateFormatSymbols
extends Object
implements Serializable, Cloneable

DateFormatSymbols is a public class for encapsulating localizable date-time formatting data, such as the names of the months, the names of the days of the week, and the time zone data. DateFormat and SimpleDateFormat both use DateFormatSymbols to encapsulate this information.

Typically you shouldn't use DateFormatSymbols directly. Rather, you are encouraged to create a date-time formatter with the DateFormat class's factory methods: getTimeInstance, getDateInstance, or getDateTimeInstance. These methods automatically create a DateFormatSymbols for the formatter so that you don't have to. After the formatter is created, you may modify its format pattern using the setPattern method. For more information about creating formatters using DateFormat's factory methods, see DateFormat.

If you decide to create a date-time formatter with a specific format pattern for a specific locale, you can do so with:

 new SimpleDateFormat(aPattern, new DateFormatSymbols(aLocale)).

DateFormatSymbols objects are clonable. When you obtain a DateFormatSymbols object, feel free to modify the date-time formatting data. For instance, you can replace the localized date-time format pattern characters with the ones that you feel easy to remember. Or you can change the representative cities to your favorite ones.

New DateFormatSymbols subclasses may be added to support SimpleDateFormat for date-time formatting for additional locales.

See Also:
DateFormat, SimpleDateFormat, SimpleTimeZone


 DateFormatSymbols Members

DateFormatSymbols Members

Class Overview | This Package | All Packages

Constructors
Name | Description
DateFormatSymbols() | Construct a DateFormatSymbols object by loading format data from resources for the default locale.
DateFormatSymbols(Locale) | Construct a DateFormatSymbols object by loading format data from resources for the given locale.

Methods
Name | Description
clone() | Overrides Cloneable
equals(Object) | Override equals
getAmPmStrings() | Gets ampm strings.
getEras() | Gets era strings.
getLocalPatternChars() | Gets localized date-time pattern characters.
getMonths() | Gets month strings.
getShortMonths() | Gets short month strings.
getShortWeekdays() | Gets short weekday strings.
getWeekdays() | Gets weekday strings.
getZoneStrings() | Gets timezone strings.
hashCode() | Override hashCode.
setAmPmStrings(String[]) | Sets ampm strings.
setEras(String[]) | Sets era strings.
setLocalPatternChars(String) | Sets localized date-time pattern characters.
setMonths(String[]) | Sets month strings.
setShortMonths(String[]) | Sets short month strings.
setShortWeekdays(String[]) | Sets short weekday strings.
setWeekdays(String[]) | Sets weekday strings.
setZoneStrings(String[][]) | Sets timezone strings.


 DateFormatSymbols.DateFormatSymbols

DateFormatSymbols.DateFormatSymbols

Syntax 1
public DateFormatSymbols()
Description
Construct a DateFormatSymbols object by loading format data from resources for the default locale.

Exceptions
MissingResourceException if the resources for the default locale cannot be found or cannot be loaded.

Syntax 2
public DateFormatSymbols( Locale locale )
Description
Construct a DateFormatSymbols object by loading format data from resources for the given locale.

Exceptions
MissingResourceException if the resources for the specified locale cannot be found or cannot be loaded.


 DateFormatSymbols.clone

DateFormatSymbols.clone

Syntax
public Object clone()
Description
Overrides Cloneable

Overrides
clone in class Object


 DateFormatSymbols.equals

DateFormatSymbols.equals

Syntax
public boolean equals( Object obj )
Description
Override equals

Overrides
equals in class Object


 DateFormatSymbols.getAmPmStrings

DateFormatSymbols.getAmPmStrings

Syntax
public String[] getAmPmStrings()
Returns
the weekday strings.
Description
Gets ampm strings. For example: "AM" and "PM".


 DateFormatSymbols.getEras

DateFormatSymbols.getEras

Syntax
public String[] getEras()
Returns
the era strings.
Description
Gets era strings. For example: "AD" and "BC".


 DateFormatSymbols.getLocalPatternChars

DateFormatSymbols.getLocalPatternChars

Syntax
public String getLocalPatternChars()
Returns
the localized date-time pattern characters.
Description
Gets localized date-time pattern characters. For example: 'u', 't', etc.


 DateFormatSymbols.getMonths

DateFormatSymbols.getMonths

Syntax
public String[] getMonths()
Returns
the month strings.
Description
Gets month strings. For example: "January", "February", etc.


 DateFormatSymbols.getShortMonths

DateFormatSymbols.getShortMonths

Syntax
public String[] getShortMonths()
Returns
the short month strings.
Description
Gets short month strings. For example: "Jan", "Feb", etc.


 DateFormatSymbols.getShortWeekdays

DateFormatSymbols.getShortWeekdays

Syntax
public String[] getShortWeekdays()
Returns
the short weekday strings.
Description
Gets short weekday strings. For example: "Sun", "Mon", etc.


 DateFormatSymbols.getWeekdays

DateFormatSymbols.getWeekdays

Syntax
public String[] getWeekdays()
Returns
the weekday strings.
Description
Gets weekday strings. For example: "Sunday", "Monday", etc.


 DateFormatSymbols.getZoneStrings

DateFormatSymbols.getZoneStrings

Syntax
public String[][] getZoneStrings()
Returns
the timezone strings.
Description
Gets timezone strings.


 DateFormatSymbols.hashCode

DateFormatSymbols.hashCode

Syntax
public int hashCode()
Description
Override hashCode. Generates a hash code for the DateFormatSymbols object.

Overrides
hashCode in class Object


 DateFormatSymbols.setAmPmStrings

DateFormatSymbols.setAmPmStrings

Syntax
public void setAmPmStrings( String newAmpms[] )
Parameters
newAmpms
the new ampm strings.
Description
Sets ampm strings. For example: "AM" and "PM".


 DateFormatSymbols.setEras

DateFormatSymbols.setEras

Syntax
public void setEras( String newEras[] )
Parameters
newEras
the new era strings.
Description
Sets era strings. For example: "AD" and "BC".


 DateFormatSymbols.setLocalPatternChars

DateFormatSymbols.setLocalPatternChars

Syntax
public void setLocalPatternChars( String newLocalPatternChars )
Parameters
newLocalPatternChars
the new localized date-time pattern characters.
Description
Sets localized date-time pattern characters. For example: 'u', 't', etc.


 DateFormatSymbols.setMonths

DateFormatSymbols.setMonths

Syntax
public void setMonths( String newMonths[] )
Parameters
newMonths
the new month strings.
Description
Sets month strings. For example: "January", "February", etc.


 DateFormatSymbols.setShortMonths

DateFormatSymbols.setShortMonths

Syntax
public void setShortMonths( String newShortMonths[] )
Parameters
newShortMonths
the new short month strings.
Description
Sets short month strings. For example: "Jan", "Feb", etc.


 DateFormatSymbols.setShortWeekdays

DateFormatSymbols.setShortWeekdays

Syntax
public void setShortWeekdays( String newShortWeekdays[] )
Parameters
newShortWeekdays
the new short weekday strings.
Description
Sets short weekday strings. For example: "Sun", "Mon", etc.


 DateFormatSymbols.setWeekdays

DateFormatSymbols.setWeekdays

Syntax
public void setWeekdays( String newWeekdays[] )
Parameters
newWeekdays
the new weekday strings.
Description
Sets weekday strings. For example: "Sunday", "Monday", etc.


 DateFormatSymbols.setZoneStrings

DateFormatSymbols.setZoneStrings

Syntax
public void setZoneStrings( String newZoneStrings[][] )
Parameters
newZoneStrings
the new timezone strings.
Description
Sets timezone strings.


 Class DecimalFormat

Class java.text.DecimalFormat

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.text.Format
           |
           +----java.text.NumberFormat
                   |
                   +----java.text.DecimalFormat

public class DecimalFormat
extends NumberFormat

DecimalFormat is a concrete subclass of NumberFormat for formatting decimal numbers. This class allows for a variety of parameters, and localization to Western, Arabic, or Indic numbers.

Normally, you get the proper NumberFormat for a specific locale (including the default locale) using one of NumberFormat's factory methods such as getInstance. You may then modify it from there (after testing to make sure it is a DecimalFormat, of course!)

Either the prefixes or the suffixes must be different for the parse to distinguish positive from negative. Parsing will be unreliable if the digits, thousands or decimal separators are the same, or if any of them occur in the prefixes or suffixes.

Special cases:

NaN is formatted as a single character, typically \\uFFFD.

+/-Infinity is formatted as a single character, typically \\u221E, plus the positive and negative pre/suffixes.

Note: this class is designed for common users; for very large or small numbers, use a format that can express exponential values.

Example:

 // normally we would have a GUI with a menu for this
 Locale[] locales = NumberFormat.getAvailableLocales();
 double myNumber = -1234.56;
 NumberFormat form;
 // just for fun, we print out a number with the locale number, currency
 // and percent format for each locale we can.
 for (int j = 0; j < 3; ++j) {
     System.out.println("FORMAT");
     for (int i = 0; i < locales.length; ++i) {
         if (locales[i].getCountry().length() == 0) {
            // skip language-only
            continue;
         }
         System.out.print(locales[i].getDisplayName());
         switch (j) {
         default:
             form = NumberFormat.getInstance(locales[i]); break;
         case 1:
             form = NumberFormat.getCurrencyInstance(locales[i]); break;
         case 0:
             form = NumberFormat.getPercentInstance(locales[i]); break;
         }
         try {
             System.out.print(": " + ((DecimalFormat)form).toPattern()
                          + " -> " + form.format(myNumber));
         } catch (IllegalArgumentException iae) { }
         try {
             System.out.println(" -> " + form.parse(form.format(myNumber)));
         } catch (ParseException pe) { }
     }
 }
The following shows the structure of the pattern.
 pattern    := subpattern{;subpattern}
 subpattern := {prefix}integer{.fraction}{suffix}
 prefix     := '\\u0000'..'\\uFFFD' - specialCharacters
 suffix     := '\\u0000'..'\\uFFFD' - specialCharacters
 integer    := '#'* '0'* '0'
 fraction   := '0'* '#'*
 Notation:
  X*       0 or more instances of X
  (X | Y)  either X or Y.
  X..Y     any character from X up to Y, inclusive.
  S - T    characters in S, except those in T
The first subpattern is for positive numbers. The second (optional) subpattern is for negative numbers. (In both cases, ',' can occur inside the integer portion--it is just too messy to indicate in BNF.)

Here are the special characters used in the parts of the subpattern, with notes on their usage.

 Symbol Meaning
 0      a digit
 #      a digit, zero shows as absent
 .      placeholder for decimal separator
 ,      placeholder for grouping separator.
 ;      separates formats.
 -      default negative prefix.
 %      divide by 100 and show as percentage
 X      any other characters can be used in the prefix or suffix
 '      used to quote special characters in a prefix or suffix.

Notes

If there is no explicit negative subpattern, - is prefixed to the positive form. That is, "0.00" alone is equivalent to "0.00;-0.00".

Illegal formats, such as "#.#.#" or mixing '_' and '*' in the same format, will cause an ParseException to be thrown. From that ParseException, you can find the place in the string where the error occurred.

The grouping separator is commonly used for thousands, but in some countries for ten-thousands. The interval is a constant number of digits between the grouping characters, such as 100,000,000 or 1,0000,0000. If you supply a pattern with multiple grouping characters, the interval between the last one and the end of the integer is the one that is used. So "#,##,###,####" == "######,####" == "##,####,####".

This class only handles localized digits where the 10 digits are contiguous in Unicode, from 0 to 9. Other digits sets (such as superscripts) would need a different subclass.

See Also:
Format, NumberFormat, ChoiceFormat


 DecimalFormat Members

DecimalFormat Members

Class Overview | This Package | All Packages

Constructors
Name | Description
DecimalFormat() | Create a DecimalFormat using the default pattern and symbols for the default locale.
DecimalFormat(String) | Create a DecimalFormat from the given pattern and the symbols for the default locale.
DecimalFormat(String, DecimalFormatSymbols) | Create a DecimalFormat from the given pattern and symbols.

Methods
Name | Description
applyLocalizedPattern(String) | Apply the given pattern to this Format object.
applyPattern(String) | Apply the given pattern to this Format object.
clone() | Standard override; no change in semantics.
equals(Object) | Overrides equals
format(double, StringBuffer, FieldPosition) | Specialization of format.
format(long, StringBuffer, FieldPosition) | Specialization of format.
getDecimalFormatSymbols() | Returns the decimal format symbols, which is generally not changed by the programmer or user.
getGroupingSize() | Return the grouping size.
getMultiplier() | Get the multiplier for use in percent, permill, etc.
getNegativePrefix() | Get the negative prefix.
getNegativeSuffix() | Get the negative suffix.
getPositivePrefix() | Get the positive prefix.
getPositiveSuffix() | Get the positive suffix.
hashCode() | Overrides hashCode
isDecimalSeparatorAlwaysShown() | Allows you to get the behavior of the decimal separator with integers.
parse(String, ParsePosition) | Returns a Long if possible (e.g.
setDecimalFormatSymbols(DecimalFormatSymbols) | Sets the decimal format symbols, which is generally not changed by the programmer or user.
setDecimalSeparatorAlwaysShown(boolean) | Allows you to set the behavior of the decimal separator with integers.
setGroupingSize(int) | Set the grouping size.
setMultiplier(int) | Set the multiplier for use in percent, permill, etc.
setNegativePrefix(String) | Set the negative prefix.
setNegativeSuffix(String) | Set the positive suffix.
setPositivePrefix(String) | Set the positive prefix.
setPositiveSuffix(String) | Set the positive suffix.
toLocalizedPattern() | Synthesizes a localized pattern string that represents the current state of this Format object.
toPattern() | Synthesizes a pattern string that represents the current state of this Format object.


 DecimalFormat.DecimalFormat

DecimalFormat.DecimalFormat

Syntax 1
public DecimalFormat()
Description
Create a DecimalFormat using the default pattern and symbols for the default locale. This is a convenient way to obtain a DecimalFormat when internationalization is not the main concern.

To obtain standard formats for a given locale, use the factory methods on NumberFormat such as getNumberInstance. These factories will return the most appropriate sub-class of NumberFormat for a given locale.

See Also
getInstance, getNumberInstance, getCurrencyInstance, getPercentInstance

Syntax 2
public DecimalFormat( String pattern )
Parameters
pattern
A non-localized pattern string.
Description
Create a DecimalFormat from the given pattern and the symbols for the default locale. This is a convenient way to obtain a DecimalFormat when internationalization is not the main concern.

To obtain standard formats for a given locale, use the factory methods on NumberFormat such as getNumberInstance. These factories will return the most appropriate sub-class of NumberFormat for a given locale.

Exceptions
IllegalArgumentException if the given pattern is invalid.
See Also
getInstance, getNumberInstance, getCurrencyInstance, getPercentInstance

Syntax 3
public DecimalFormat( String pattern, DecimalFormatSymbols symbols )
Parameters
pattern
a non-localized pattern string
symbols
the set of symbols to be used
Description
Create a DecimalFormat from the given pattern and symbols. Use this constructor when you need to completely customize the behavior of the format.

To obtain standard formats for a given locale, use the factory methods on NumberFormat such as getInstance or getCurrencyInstance. If you need only minor adjustments to a standard format, you can modify the format returned by a NumberFormat factory method.

Exceptions
IllegalArgumentException if the given pattern is invalid
See Also
getInstance, getNumberInstance, getCurrencyInstance, getPercentInstance, DecimalFormatSymbols


 DecimalFormat.applyLocalizedPattern

DecimalFormat.applyLocalizedPattern

Syntax
public void applyLocalizedPattern( String pattern )
Description
Apply the given pattern to this Format object. The pattern is assumed to be in a localized notation. A pattern is a short-hand specification for the various formatting properties. These properties can also be changed individually through the various setter methods.

There is no limit to integer digits are set by this routine, since that is the typical end-user desire; use setMaximumInteger if you want to set a real value. For negative numbers, use a second pattern, separated by a semicolon

Example "#,#00.0#" -> 1,234.56

This means a minimum of 2 integer digits, 1 fraction digit, and a maximum of 2 fraction digits.

Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses.

In negative patterns, the minimum and maximum counts are ignored; these are presumed to be set in the positive pattern.


 DecimalFormat.applyPattern

DecimalFormat.applyPattern

Syntax
public void applyPattern( String pattern )
Description
Apply the given pattern to this Format object. A pattern is a short-hand specification for the various formatting properties. These properties can also be changed individually through the various setter methods.

There is no limit to integer digits are set by this routine, since that is the typical end-user desire; use setMaximumInteger if you want to set a real value. For negative numbers, use a second pattern, separated by a semicolon

Example "#,#00.0#" -> 1,234.56

This means a minimum of 2 integer digits, 1 fraction digit, and a maximum of 2 fraction digits.

Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses.

In negative patterns, the minimum and maximum counts are ignored; these are presumed to be set in the positive pattern.


 DecimalFormat.clone

DecimalFormat.clone

Syntax
public Object clone()
Description
Standard override; no change in semantics.

Overrides
clone in class NumberFormat


 DecimalFormat.equals

DecimalFormat.equals

Syntax
public boolean equals( Object obj )
Description
Overrides equals

Overrides
equals in class NumberFormat


 DecimalFormat.format

DecimalFormat.format

Syntax 1
public StringBuffer format( double number, StringBuffer result, FieldPosition fieldPosition )
Description
Specialization of format.

Overrides
format in class NumberFormat

Syntax 2
public StringBuffer format( long number, StringBuffer result, FieldPosition fieldPosition )
Description
Specialization of format.

Overrides
format in class NumberFormat


 DecimalFormat.getDecimalFormatSymbols

DecimalFormat.getDecimalFormatSymbols

Syntax
public DecimalFormatSymbols getDecimalFormatSymbols()
Returns
desired DecimalFormatSymbols
Description
Returns the decimal format symbols, which is generally not changed by the programmer or user.

See Also
DecimalFormatSymbols


 DecimalFormat.getGroupingSize

DecimalFormat.getGroupingSize

Syntax
public int getGroupingSize()
Description
Return the grouping size. Grouping size is the number of digits between grouping separators in the integer portion of a number. For example, in the number "123,456.78", the grouping size is 3.

See Also
setGroupingSize, isGroupingUsed, getGroupingSeparator


 DecimalFormat.getMultiplier

DecimalFormat.getMultiplier

Syntax
public int getMultiplier()
Description
Get the multiplier for use in percent, permill, etc. For a percentage, set the suffixes to have "%" and the multiplier to be 100. (For Arabic, use arabic percent symbol). For a permill, set the suffixes to have "?" and the multiplier to be 1000.

Examples: with 100, 1.23 -> "123", and "123" -> 1.23


 DecimalFormat.getNegativePrefix

DecimalFormat.getNegativePrefix

Syntax
public String getNegativePrefix()
Description
Get the negative prefix.

Examples: -123, ($123) (with negative suffix), sFr-123


 DecimalFormat.getNegativeSuffix

DecimalFormat.getNegativeSuffix

Syntax
public String getNegativeSuffix()
Description
Get the negative suffix.

Examples: -123%, ($123) (with positive suffixes)


 DecimalFormat.getPositivePrefix

DecimalFormat.getPositivePrefix

Syntax
public String getPositivePrefix()
Description
Get the positive prefix.

Examples: +123, $123, sFr123


 DecimalFormat.getPositiveSuffix

DecimalFormat.getPositiveSuffix

Syntax
public String getPositiveSuffix()
Description
Get the positive suffix.

Example: 123%


 DecimalFormat.hashCode

DecimalFormat.hashCode

Syntax
public int hashCode()
Description
Overrides hashCode

Overrides
hashCode in class NumberFormat


 DecimalFormat.isDecimalSeparatorAlwaysShown

DecimalFormat.isDecimalSeparatorAlwaysShown

Syntax
public boolean isDecimalSeparatorAlwaysShown()
Description
Allows you to get the behavior of the decimal separator with integers. (The decimal separator will always appear with decimals.)

Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345


 DecimalFormat.parse

DecimalFormat.parse

Syntax
public Number parse( String text, ParsePosition status )
Description
Returns a Long if possible (e.g.

Overrides
parse in class NumberFormat


 DecimalFormat.setDecimalFormatSymbols

DecimalFormat.setDecimalFormatSymbols

Syntax
public void setDecimalFormatSymbols( DecimalFormatSymbols newSymbols )
Parameters
newSymbols
desired DecimalFormatSymbols
Description
Sets the decimal format symbols, which is generally not changed by the programmer or user.

See Also
DecimalFormatSymbols


 DecimalFormat.setDecimalSeparatorAlwaysShown

DecimalFormat.setDecimalSeparatorAlwaysShown

Syntax
public void setDecimalSeparatorAlwaysShown( boolean newValue )
Description
Allows you to set the behavior of the decimal separator with integers. (The decimal separator will always appear with decimals.)

Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345


 DecimalFormat.setGroupingSize

DecimalFormat.setGroupingSize

Syntax
public void setGroupingSize( int newValue )
Description
Set the grouping size. Grouping size is the number of digits between grouping separators in the integer portion of a number. For example, in the number "123,456.78", the grouping size is 3.

See Also
getGroupingSize, setGroupingUsed, setGroupingSeparator


 DecimalFormat.setMultiplier

DecimalFormat.setMultiplier

Syntax
public void setMultiplier( int newValue )
Description
Set the multiplier for use in percent, permill, etc. For a percentage, set the suffixes to have "%" and the multiplier to be 100. (For Arabic, use arabic percent symbol). For a permill, set the suffixes to have "?" and the multiplier to be 1000.

Examples: with 100, 1.23 -> "123", and "123" -> 1.23


 DecimalFormat.setNegativePrefix

DecimalFormat.setNegativePrefix

Syntax
public void setNegativePrefix( String newValue )
Description
Set the negative prefix.

Examples: -123, ($123) (with negative suffix), sFr-123


 DecimalFormat.setNegativeSuffix

DecimalFormat.setNegativeSuffix

Syntax
public void setNegativeSuffix( String newValue )
Description
Set the positive suffix.

Examples: 123%


 DecimalFormat.setPositivePrefix

DecimalFormat.setPositivePrefix

Syntax
public void setPositivePrefix( String newValue )
Description
Set the positive prefix.

Examples: +123, $123, sFr123


 DecimalFormat.setPositiveSuffix

DecimalFormat.setPositiveSuffix

Syntax
public void setPositiveSuffix( String newValue )
Description
Set the positive suffix.

Example: 123%


 DecimalFormat.toLocalizedPattern

DecimalFormat.toLocalizedPattern

Syntax
public String toLocalizedPattern()
Description
Synthesizes a localized pattern string that represents the current state of this Format object.

See Also
applyPattern


 DecimalFormat.toPattern

DecimalFormat.toPattern

Syntax
public String toPattern()
Description
Synthesizes a pattern string that represents the current state of this Format object.

See Also
applyPattern


 Class DecimalFormatSymbols

Class java.text.DecimalFormatSymbols

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.text.DecimalFormatSymbols

public final class DecimalFormatSymbols
extends Object
implements Cloneable, Serializable

This class represents the set of symbols (such as the decimal separator, the grouping separator, and so on) needed by DecimalFormat to format numbers. DecimalFormat creates for itself an instance of DecimalFormatSymbols from its locale data. If you need to change any of these symbols, you can get the DecimalFormatSymbols object from your DecimalFormat and modify it.

See Also:
Locale, DecimalFormat


 DecimalFormatSymbols Members

DecimalFormatSymbols Members

Class Overview | This Package | All Packages

Constructors
Name | Description
DecimalFormatSymbols() | Create a DecimalFormatSymbols object for the default locale.
DecimalFormatSymbols(Locale) | Create a DecimalFormatSymbols object for the given locale.

Methods
Name | Description
clone() | Standard override.
equals(Object) | Override equals
getDecimalSeparator() | character used for decimal sign.
getDigit() | character used for a digit in a pattern.
getGroupingSeparator() | character used for thousands separator.
getInfinity() | character used to represent infinity.
getMinusSign() | character used to represent minus sign.
getNaN() | character used to represent NaN.
getPatternSeparator() | character used to separate positive and negative subpatterns in a pattern.
getPercent() | character used for percent sign.
getPerMill() | character used for mille percent sign.
getZeroDigit() | character used for zero.
hashCode() | Override hashCode
setDecimalSeparator(char) |
setDigit(char) |
setGroupingSeparator(char) |
setInfinity(String) |
setMinusSign(char) |
setNaN(String) |
setPatternSeparator(char) |
setPercent(char) |
setPerMill(char) |
setZeroDigit(char) |


 DecimalFormatSymbols.DecimalFormatSymbols

DecimalFormatSymbols.DecimalFormatSymbols

Syntax 1
public DecimalFormatSymbols()
Description
Create a DecimalFormatSymbols object for the default locale.

Syntax 2
public DecimalFormatSymbols( Locale locale )
Description
Create a DecimalFormatSymbols object for the given locale.


 DecimalFormatSymbols.clone

DecimalFormatSymbols.clone

Syntax
public Object clone()
Description
Standard override.

Overrides
clone in class Object


 DecimalFormatSymbols.equals

DecimalFormatSymbols.equals

Syntax
public boolean equals( Object obj )
Description
Override equals

Overrides
equals in class Object


 DecimalFormatSymbols.getDecimalSeparator

DecimalFormatSymbols.getDecimalSeparator

Syntax
public char getDecimalSeparator()
Description
character used for decimal sign. Different for French, etc.


 DecimalFormatSymbols.getDigit

DecimalFormatSymbols.getDigit

Syntax
public char getDigit()
Description
character used for a digit in a pattern.


 DecimalFormatSymbols.getGroupingSeparator

DecimalFormatSymbols.getGroupingSeparator

Syntax
public char getGroupingSeparator()
Description
character used for thousands separator. Different for French, etc.


 DecimalFormatSymbols.getInfinity

DecimalFormatSymbols.getInfinity

Syntax
public String getInfinity()
Description
character used to represent infinity. Almost always left unchanged.


 DecimalFormatSymbols.getMinusSign

DecimalFormatSymbols.getMinusSign

Syntax
public char getMinusSign()
Description
character used to represent minus sign. If no explicit negative format is specified, one is formed by prefixing minusSign to the positive format.


 DecimalFormatSymbols.getNaN

DecimalFormatSymbols.getNaN

Syntax
public String getNaN()
Description
character used to represent NaN. Almost always left unchanged.


 DecimalFormatSymbols.getPatternSeparator

DecimalFormatSymbols.getPatternSeparator

Syntax
public char getPatternSeparator()
Description
character used to separate positive and negative subpatterns in a pattern.


 DecimalFormatSymbols.getPercent

DecimalFormatSymbols.getPercent

Syntax
public char getPercent()
Description
character used for percent sign. Different for Arabic, etc.


 DecimalFormatSymbols.getPerMill

DecimalFormatSymbols.getPerMill

Syntax
public char getPerMill()
Description
character used for mille percent sign. Different for Arabic, etc.


 DecimalFormatSymbols.getZeroDigit

DecimalFormatSymbols.getZeroDigit

Syntax
public char getZeroDigit()
Description
character used for zero. Different for Arabic, etc.


 DecimalFormatSymbols.hashCode

DecimalFormatSymbols.hashCode

Syntax
public int hashCode()
Description
Override hashCode

Overrides
hashCode in class Object


 DecimalFormatSymbols.setDecimalSeparator

DecimalFormatSymbols.setDecimalSeparator

Syntax
public void setDecimalSeparator( char decimalSeparator )


 DecimalFormatSymbols.setDigit

DecimalFormatSymbols.setDigit

Syntax
public void setDigit( char digit )


 DecimalFormatSymbols.setGroupingSeparator

DecimalFormatSymbols.setGroupingSeparator

Syntax
public void setGroupingSeparator( char groupingSeparator )


 DecimalFormatSymbols.setInfinity

DecimalFormatSymbols.setInfinity

Syntax
public void setInfinity( String infinity )


 DecimalFormatSymbols.setMinusSign

DecimalFormatSymbols.setMinusSign

Syntax
public void setMinusSign( char minusSign )


 DecimalFormatSymbols.setNaN

DecimalFormatSymbols.setNaN

Syntax
public void setNaN( String NaN )


 DecimalFormatSymbols.setPatternSeparator

DecimalFormatSymbols.setPatternSeparator

Syntax
public void setPatternSeparator( char patternSeparator )


 DecimalFormatSymbols.setPercent

DecimalFormatSymbols.setPercent

Syntax
public void setPercent( char percent )


 DecimalFormatSymbols.setPerMill

DecimalFormatSymbols.setPerMill

Syntax
public void setPerMill( char perMill )


 DecimalFormatSymbols.setZeroDigit

DecimalFormatSymbols.setZeroDigit

Syntax
public void setZeroDigit( char zeroDigit )


 Class FieldPosition

Class java.text.FieldPosition

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.text.FieldPosition

public class FieldPosition
extends Object

FieldPosition is a simple class used by Format and its subclasses to identify fields in formatted output. Fields are identified by constants, whose names typically end with _FIELD, defined in the various subclasses of Format. See ERA_FIELD and its friends in DateFormat for an example.

FieldPosition keeps track of the position of the field within the formatted output with two indices: the index of the first character of the field and the index of the last character of the field.

One version of the format method in the various Format classes requires a FieldPosition object as an argument. You use this format method to perform partial formatting or to get information about the formatted output (such as the position of a field).

See Also:
Format


 FieldPosition Members

FieldPosition Members

Class Overview | This Package | All Packages

Constructors
Name | Description
FieldPosition(int) | Creates a FieldPosition object for the given field.

Methods
Name | Description
getBeginIndex() | Retrieve the index of the first character in the requested field.
getEndIndex() | Retrieve the index of the character following the last character in the requested field.
getField() | Retrieve the field identifier.


 FieldPosition.FieldPosition

FieldPosition.FieldPosition

Syntax
public FieldPosition( int field )
Description
Creates a FieldPosition object for the given field. Fields are identified by constants, whose names typically end with _FIELD, in the various subclasses of Format.

See Also
INTEGER_FIELD, FRACTION_FIELD, YEAR_FIELD, MONTH_FIELD


 FieldPosition.getBeginIndex

FieldPosition.getBeginIndex

Syntax
public int getBeginIndex()
Description
Retrieve the index of the first character in the requested field.


 FieldPosition.getEndIndex

FieldPosition.getEndIndex

Syntax
public int getEndIndex()
Description
Retrieve the index of the character following the last character in the requested field.


 FieldPosition.getField

FieldPosition.getField

Syntax
public int getField()
Description
Retrieve the field identifier.


 Class Format

Class java.text.Format

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.text.Format

public abstract class Format
extends Object
implements Serializable, Cloneable

Format is an abstract base class for formatting locale-sensitive information such as dates, messages, and numbers.

Format defines the programming interface for formatting locale-sensitive objects into Strings (the format method) and for parsing Strings back into objects (the parseObject method). Any String formatted by format is guaranteed to be parseable by parseObject.

If formatting is unsuccessful because the Format object cannot format the type of object specified, format throws an IllegalArgumentException. Otherwise, if there is something illformed about the object, format returns the Unicode replacement character \\uFFFD.

If there is no match when parsing, parseObject(String) throws a ParseException, and parseObject(String, ParsePosition) leaves the ParsePosition index member unchanged and returns null.

Subclassing: The JDK provides three concrete subclasses of Format-- DateFormat, MessageFormat, and NumberFormat--for formatting dates, messages, and numbers, respectively.

Concrete subclasses must implement these two methods:

  1. format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
  2. parseObject (String source, ParsePosition pos)

Most subclasses will also implement the following two methods:

  1. getInstance for getting a useful format object appropriate for the current locale
  2. getInstance(Locale) for getting a useful format object appropriate for the specified locale
In addition, some subclasses may also choose to implement other getXxxxInstance methods for more specialized control. For example, the NumberFormat class provides getPercentInstance and getCurrencyInstance methods for getting specialized number formatters.

Subclasses of Format that allow programmers to create objects for locales (with getInstance(Locale) for example) must also implement the following class method:

 public static Locale[] getAvailableLocales()

And finally subclasses may define a set of constants to identify the various fields in the formatted output. These constants are used to create a FieldPosition object which identifies what information is contained in the field and its position in the formatted result. These constants should be named item_FIELD where item identifies the field. For examples of these constants, see ERA_FIELD and its friends in DateFormat.

See Also:
ParsePosition, FieldPosition, NumberFormat, DateFormat, MessageFormat


 Format Members

Format Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Format() |

Methods
Name | Description
clone() | Creates a new object of the same class as this object.
format(Object) | Formats an object to produce a string.
format(Object, StringBuffer, FieldPosition) | Formats an object to produce a string.
parseObject(String) | Parses a string to produce an object.
parseObject(String, ParsePosition) | Parses a string to produce an object.


 Format.Format

Format.Format

Syntax
public Format()


 Format.clone

Format.clone

Syntax
public Object clone()
Description
Creates a new object of the same class as this object.

Overrides
clone in class Object


 Format.format

Format.format

Syntax 1
public final String format( Object obj )
Parameters
obj
The object to format
Returns
Formatted string.
Description
Formats an object to produce a string.

Subclasses will override the StringBuffer version of format.

Exceptions
IllegalArgumentException when the Format cannot format the type of object.
See Also
MessageFormat, format

Syntax 2
public abstract StringBuffer format( Object obj, StringBuffer toAppendTo, FieldPosition pos )
Parameters
obj
The object to format
toAppendTo
where the text is to be appended
status
On input: an alignment field, if desired. On output: the offsets of the alignment field.
Returns
the value passed in as toAppendTo (this allows chaining, as with StringBuffer.append())
Description
Formats an object to produce a string. Subclasses will implement for particular object, such as:
 StringBuffer format (Number obj, StringBuffer toAppendTo)
 Number parse (String str)
These general routines allow polymorphic parsing and formatting for objects such as the MessageFormat.

Exceptions
IllegalArgumentException when the Format cannot format the given object.
See Also
MessageFormat, FieldPosition


 Format.parseObject

Format.parseObject

Syntax 1
public abstract Object parseObject( String source, ParsePosition status )
Parameters
ParsePosition
Input-Output parameter.

Before calling, set status.index to the offset you want to start parsing at in the source. After calling, status.index is the end of the text you parsed. If error occurs, index is unchanged.

When parsing, leading whitespace is discarded (with successful parse), while trailing whitespace is left as is.

Example: Parsing "_12_xy" (where _ represents a space) for a number, with index == 0 will result in the number 12, with status.index updated to 3 (just before the second space). Parsing a second time will result in a ParseException since "xy" is not a number, and leave index at 3.

Subclasses will typically supply specific parse methods that return different types of values. Since methods can't overload on return types, these will typically be named "parse", while this polymorphic method will always be called parseObject. Any parse method that does not take a status should throw ParseException when no text in the required format is at the start position.

Returns
Object parsed from string. In case of error, returns null.
Description
Parses a string to produce an object. Subclasses will typically implement for particular object, such as:
       String format (Number obj);
       String format (long obj);
       String format (double obj);
       Number parse (String str);

See Also
ParsePosition

Syntax 2
public Object parseObject( String source ) throws ParseException
Description
Parses a string to produce an object.

Exceptions
ParseException if the specified string is invalid.


 Class MessageFormat

Class java.text.MessageFormat

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.text.Format
           |
           +----java.text.MessageFormat

public class MessageFormat
extends Format

MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to construct messages displayed for end users.

MessageFormat takes a set of objects, formats them, then inserts the formatted strings into the pattern at the appropriate places.

Note: MessageFormat differs from the other Format classes in that you create a MessageFormat object with one of its constructors (not with a getInstance style factory method). The factory methods aren't necessary because MessageFormat doesn't require any complex setup for a given locale. In fact, MessageFormat doesn't implement any locale specific behavior at all. It just needs to be set up on a sentence by sentence basis.

Here are some examples of usage:

 Object[] arguments = {
     new Integer(7),
     new Date(System.currentTimeMillis()),
     "a disturbance in the Force"
 };
 String result = MessageFormat.format(
     "At {1,time} on {1,date}, there was {2} on planet {0,number,integer}.",
     arguments);
 : At 12:30 PM on Jul 3, 2053, there was a disturbance
           in the Force on planet 7.
Typically, the message format will come from resources, and the arguments will be dynamically set at runtime.

Example 2:

 Object[] testArgs = {new Long(3), "MyDisk"};
 MessageFormat form = new MessageFormat(
     "The disk \"{1}\" contains {0} file(s).");
 System.out.println(form.format(testArgs));
 // output, with different testArgs
 : The disk "MyDisk" contains 0 file(s).
 : The disk "MyDisk" contains 1 file(s).
 : The disk "MyDisk" contains 1,273 file(s).

The pattern is of the form:

 messageFormatPattern := string ( "{" messageFormatElement "}" string )*
 messageFormatElement := argument { "," elementFormat }
 elementFormat := "time" { "," datetimeStyle }
                | "date" { "," datetimeStyle }
                | "number" { "," numberStyle }
                | "choice" { "," choiceStyle }
 datetimeStyle := "short"
                  | "medium"
                  | "long"
                  | "full"
                  | dateFormatPattern
 numberStyle := "currency"
               | "percent"
               | "integer"
               | numberFormatPattern
 choiceStyle := choiceFormatPattern
If there is no elementFormat, then the argument must be a string, which is substituted. If there is no dateTimeStyle or numberStyle, then the default format is used (for example, NumberFormat.getInstance, DateFormat.getTimeInstance, or DateFormat.getInstance).

In strings, single quotes can be used to quote the "{" (curly brace) if necessary. A real single quote is represented by ''. Inside a messageFormatElement, quotes are not removed. For example, {1,number,$'#',##} will produce a number format with the pound-sign quoted, with a result such as: "$#31,45".

If a pattern is used, then unquoted braces in the pattern, if any, must match: that is, "ab {0} de" and "ab '}' de" are ok, but "ab {0'}' de" and "ab } de" are not.

The argument is a number from 0 to 9, which corresponds to the arguments presented in an array to be formatted.

It is ok to have unused arguments in the array. With missing arguments or arguments that are not of the right class for the specified format, a ParseException is thrown. First, format checks to see if a Format object has been specified for the argument with the setFormats method. If so, then format uses that Format object to format the argument. Otherwise, the argument is formatted based on the object's type. If the argument is a Number, then format uses NumberFormat.getInstance to format the argument; if the argument is a Date, then format uses DateFormat.getDateTimeInstance to format the argument. Otherwise, it uses the toString method.

For more sophisticated patterns, you can use a ChoiceFormat to get output such as:

 MessageFormat form = new MessageFormat("The disk \"{1}\" contains {0}.");
 double[] filelimits = {0,1,2};
 String[] filepart = {"no files","one file","{0,number} files"};
 ChoiceFormat fileform = new ChoiceFormat(filelimits, filepart);
 form.setFormat(1,fileform); // NOT zero, see below
 Object[] testArgs = {new Long(12373), "MyDisk"};
 System.out.println(form.format(testArgs));
 // output, with different testArgs
 output: The disk "MyDisk" contains no files.
 output: The disk "MyDisk" contains one file.
 output: The disk "MyDisk" contains 1,273 files.
You can either do this programmatically, as in the above example, or by using a pattern (see ChoiceFormat for more information) as in:
 form.applyPattern(
    "There {0,choice,0#are no files|1#is one file|1#are {0,number,integer} files}.");

Note: As we see above, the string produced by a ChoiceFormat in MessageFormat is treated specially; occurances of '{' are used to indicated subformats, and cause recursion. If you create both a MessageFormat and ChoiceFormat programmatically (instead of using the string patterns), then be careful not to produce a format that recurses on itself, which will cause an infinite loop.

Note: formats are numbered by order of variable in the string. This is not the same as the argument numbering! For example: with "abc{2}def{3}ghi{0}...",

  • format0 affects the first variable {2}
  • format1 affects the second variable {3}
  • format2 affects the second variable {0}
  • and so on.

See Also:
Locale, Format, NumberFormat, DecimalFormat, ChoiceFormat


 MessageFormat Members

MessageFormat Members

Class Overview | This Package | All Packages

Constructors
Name | Description
MessageFormat(String) | Constructs with the specified pattern.

Methods
Name | Description
applyPattern(String) | Sets the pattern.
clone() | Overrides Cloneable
equals(Object) | Equality comparision between two message format objects
format(Object, StringBuffer, FieldPosition) | Formats an object to produce a string.
format(Object[], StringBuffer, FieldPosition) | Returns pattern with formatted objects.
format(String, Object[]) | Convenience routine.
getFormats() | Gets formats that were set with setFormats.
getLocale() | Gets the locale.
hashCode() | Generates a hash code for the message format object.
parse(String) | Parses the string.
parse(String, ParsePosition) | Parses the string.
parseObject(String, ParsePosition) | Parses the string.
setFormat(int, Format) | Sets formats individually to use on parameters.
setFormats(Format[]) | Sets formats to use on parameters.
setLocale(Locale) | Constructs with the specified pattern and formats for the arguments in that pattern.
toPattern() | Gets the pattern.


 MessageFormat.MessageFormat

MessageFormat.MessageFormat

Syntax
public MessageFormat( String pattern )
Description
Constructs with the specified pattern.

See Also
applyPattern


 MessageFormat.applyPattern

MessageFormat.applyPattern

Syntax
public void applyPattern( String newPattern )
Description
Sets the pattern. See the class description.


 MessageFormat.clone

MessageFormat.clone

Syntax
public Object clone()
Description
Overrides Cloneable

Overrides
clone in class Format


 MessageFormat.equals

MessageFormat.equals

Syntax
public boolean equals( Object obj )
Description
Equality comparision between two message format objects

Overrides
equals in class Object


 MessageFormat.format

MessageFormat.format

Syntax 1
public final StringBuffer format( Object source[], StringBuffer result, FieldPosition ignore )
Parameters
source
an array of objects to be formatted & substituted.
result
where text is appended.
ignore
no useful status is returned.
Description
Returns pattern with formatted objects.

Syntax 2
public static String format( String pattern, Object arguments[] )
Description
Convenience routine. Avoids explicit creation of MessageFormat, but doesn't allow future optimizations.

Syntax 3
public final StringBuffer format( Object source, StringBuffer result, FieldPosition ignore )
Description
Formats an object to produce a string.

Overrides
format in class Format


 MessageFormat.getFormats

MessageFormat.getFormats

Syntax
public Format[] getFormats()
Description
Gets formats that were set with setFormats. See the class description about format numbering.


 MessageFormat.getLocale

MessageFormat.getLocale

Syntax
public Locale getLocale()
Description
Gets the locale. This locale is used for fetching default number or date format information.


 MessageFormat.hashCode

MessageFormat.hashCode

Syntax
public int hashCode()
Description
Generates a hash code for the message format object.

Overrides
hashCode in class Object


 MessageFormat.parse

MessageFormat.parse

Syntax 1
public Object[] parse( String source, ParsePosition status )
Description
Parses the string.

Caveats: The parse may fail in a number of circumstances. For example:

  • If one of the arguments does not occur in the pattern.
  • If the format of an argument is loses information, such as with a choice format where a large number formats to "many".
  • Does not yet handle recursion (where the substituted strings contain {n} references.)
  • Will not always find a match (or the correct match) if some part of the parse is ambiguous. For example, if the pattern "{1},{2}" is used with the string arguments {"a,b", "c"}, it will format as "a,b,c". When the result is parsed, it will return {"a", "b,c"}.
  • If a single argument is formatted twice in the string, then the later parse wins.

Syntax 2
public Object[] parse( String source ) throws ParseException
Description
Parses the string. Does not yet handle recursion (where the substituted strings contain {n} references.)

Exceptions
ParseException if the string can't be parsed.


 MessageFormat.parseObject

MessageFormat.parseObject

Syntax
public Object parseObject( String text, ParsePosition status )
Description
Parses the string. Does not yet handle recursion (where the substituted strings contain %n references.)

Overrides
parseObject in class Format


 MessageFormat.setFormat

MessageFormat.setFormat

Syntax
public void setFormat( int variable, Format newFormat )
Description
Sets formats individually to use on parameters. See the class description about format numbering.


 MessageFormat.setFormats

MessageFormat.setFormats

Syntax
public void setFormats( Format newFormats[] )
Description
Sets formats to use on parameters. See the class description about format numbering.


 MessageFormat.setLocale

MessageFormat.setLocale

Syntax
public void setLocale( Locale theLocale )
Description
Constructs with the specified pattern and formats for the arguments in that pattern.

See Also
applyPattern


 MessageFormat.toPattern

MessageFormat.toPattern

Syntax
public String toPattern()
Description
Gets the pattern. See the class description.


 Class NumberFormat

Class java.text.NumberFormat

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.text.Format
           |
           +----java.text.NumberFormat

public abstract class NumberFormat
extends Format
implements Cloneable

NumberFormat is the abstract base class for all number formats. This class provides the interface for formatting and parsing numbers. NumberFormat also provides methods for determining which locales have number formats, and what their names are.

NumberFormat helps you to format and parse numbers for any locale. Your code can be completely independent of the locale conventions for decimal points, thousands-separators, or even the particular decimal digits used, or whether the number format is even decimal.

To format a number for the current Locale, use one of the factory class methods:

  myString = NumberFormat.getInstance().format(myNumber);
If you are formatting multiple numbers, it is more efficient to get the format and use it multiple times so that the system doesn't have to fetch the information about the local language and country conventions multiple times.
 NumberFormat nf = NumberFormat.getInstance();
 for (int i = 0; i < a.length; ++i) {
     output.println(nf.format(myNumber[i]) + "; ");
 }
To format a number for a different Locale, specify it in the call to getInstance.
 NumberFormat nf = NumberFormat.getInstance(Locale.FRENCH);
You can also use a NumberFormat to parse numbers:
 myNumber = nf.parse(myString);
Use getInstance or getNumberInstance to get the normal number format. Use getCurrencyInstance to get the currency number format. And use getPercentInstance to get a format for displaying percentages. With this format, a fraction like 0.53 is displayed as 53%.

You can also control the display of numbers with such methods as setMinimumFractionDigits. If you want even more control over the format or parsing, or want to give your users more control, you can try casting the NumberFormat you get from the factory methods to a DecimalNumberFormat. This will work for the vast majority of locales; just remember to put it in a try block in case you encounter an unusual one.

You can also use forms of the parse and format methods with ParsePosition and FieldPosition to allow you to:

  • progressively parse through pieces of a string
  • align the decimal point and other areas
For example, you can align numbers in two ways:
  1. If you are using a monospaced font with spacing for alignment, you can pass the FieldPosition in your format call, with field = INTEGER_FIELD. On output, getEndIndex will be set to the offset between the last character of the integer and the decimal. Add (desiredSpaceCount - getEndIndex) spaces at the front of the string.
  2. If you are using proportional fonts, instead of padding with spaces, measure the width of the string in pixels from the start to getEndIndex. Then move the pen by (desiredPixelWidth - widthToAlignmentPoint) before drawing the text. It also works where there is no decimal, but possibly additional characters at the end, e.g. with parentheses in negative numbers: "(12)" for -12.

See Also:
DecimalFormat, ChoiceFormat


 NumberFormat Members

NumberFormat Members

Class Overview | This Package | All Packages

Fields
Name | Description
FRACTION_FIELD | Field constant used to construct a FieldPosition object.
INTEGER_FIELD | Field constant used to construct a FieldPosition object.

Constructors
Name | Description
NumberFormat() |

Methods
Name | Description
clone() | Overrides Cloneable
equals(Object) | Overrides equals
format(double) | Specialization of format.
format(double, StringBuffer, FieldPosition) | Specialization of format.
format(long) | Specialization of format.
format(long, StringBuffer, FieldPosition) | Specialization of format.
format(Object, StringBuffer, FieldPosition) | Formats an object to produce a string.
getAvailableLocales() | Get the set of Locales for which NumberFormats are installed
getCurrencyInstance() | Returns a currency format for the current default locale.
getCurrencyInstance(Locale) | Returns a currency format for the specified locale.
getInstance() | Returns the default number format for the current default locale.
getInstance(Locale) | Returns the default number format for the specified locale.
getMaximumFractionDigits() | Returns the maximum number of digits allowed in the fraction portion of a number.
getMaximumIntegerDigits() | Returns the maximum number of digits allowed in the integer portion of a number.
getMinimumFractionDigits() | Returns the minimum number of digits allowed in the fraction portion of a number.
getMinimumIntegerDigits() | Returns the minimum number of digits allowed in the integer portion of a number.
getNumberInstance() | Returns a general-purpose number format for the current default locale.
getNumberInstance(Locale) | Returns a general-purpose number format for the specified locale.
getPercentInstance() | Returns a percentage format for the current default locale.
getPercentInstance(Locale) | Returns a percentage format for the specified locale.
hashCode() | Overrides hashCode
isGroupingUsed() | Returns true if grouping is used in this format.
isParseIntegerOnly() | Returns true if this format will parse numbers as integers only.
parse(String) | Convenience method.
parse(String, ParsePosition) | Returns a Long if possible (e.g.
parseObject(String, ParsePosition) | Parses a string to produce an object.
setGroupingUsed(boolean) | Set whether or not grouping will be used in this format.
setMaximumFractionDigits(int) | Sets the maximum number of digits allowed in the fraction portion of a number.
setMaximumIntegerDigits(int) | Sets the maximum number of digits allowed in the integer portion of a number.
setMinimumFractionDigits(int) | Sets the minimum number of digits allowed in the fraction portion of a number.
setMinimumIntegerDigits(int) | Sets the minimum number of digits allowed in the integer portion of a number.
setParseIntegerOnly(boolean) | Sets whether or not numbers should be parsed as integers only.


 NumberFormat.FRACTION_FIELD

NumberFormat.FRACTION_FIELD

Syntax
public static final int FRACTION_FIELD
Description
Field constant used to construct a FieldPosition object. Signifies that the position of the fraction part of a formatted number should be returned.

See Also
FieldPosition


 NumberFormat.INTEGER_FIELD

NumberFormat.INTEGER_FIELD

Syntax
public static final int INTEGER_FIELD
Description
Field constant used to construct a FieldPosition object. Signifies that the position of the integer part of a formatted number should be returned.

See Also
FieldPosition


 NumberFormat.NumberFormat

NumberFormat.NumberFormat

Syntax
public NumberFormat()


 NumberFormat.clone

NumberFormat.clone

Syntax
public Object clone()
Description
Overrides Cloneable

Overrides
clone in class Format


 NumberFormat.equals

NumberFormat.equals

Syntax
public boolean equals( Object obj )
Description
Overrides equals

Overrides
equals in class Object


 NumberFormat.format

NumberFormat.format

Syntax
public final StringBuffer format( Object number, StringBuffer toAppendTo, FieldPosition pos )
Description
Formats an object to produce a string.

Overrides
format in class Format


 NumberFormat.format

NumberFormat.format

Syntax 1
public final String format( double number )
Description
Specialization of format.

See Also
format

Syntax 2
public final String format( long number )
Description
Specialization of format.

See Also
format

Syntax 3
public abstract StringBuffer format( double number, StringBuffer toAppendTo, FieldPosition pos )
Description
Specialization of format.

See Also
format

Syntax 4
public abstract StringBuffer format( long number, StringBuffer toAppendTo, FieldPosition pos )
Description
Specialization of format.

See Also
format


 NumberFormat.getAvailableLocales

NumberFormat.getAvailableLocales

Syntax
public static Locale[] getAvailableLocales()
Returns
available locales
Description
Get the set of Locales for which NumberFormats are installed


 NumberFormat.getCurrencyInstance

NumberFormat.getCurrencyInstance

Syntax 1
public static final NumberFormat getCurrencyInstance()
Description
Returns a currency format for the current default locale.

Syntax 2
public static NumberFormat getCurrencyInstance( Locale inLocale )
Description
Returns a currency format for the specified locale.


 NumberFormat.getInstance

NumberFormat.getInstance

Syntax 1
public static final NumberFormat getInstance()
Description
Returns the default number format for the current default locale. The default format is one of the styles provided by the other factory methods: getNumberInstance, getCurrencyInstance or getPercentInstance. Exactly which one is locale dependant.

Syntax 2
public static NumberFormat getInstance( Locale inLocale )
Description
Returns the default number format for the specified locale. The default format is one of the styles provided by the other factory methods: getNumberInstance, getCurrencyInstance or getPercentInstance. Exactly which one is locale dependant.


 NumberFormat.getMaximumFractionDigits

NumberFormat.getMaximumFractionDigits

Syntax
public int getMaximumFractionDigits()
Description
Returns the maximum number of digits allowed in the fraction portion of a number.

See Also
setMaximumFractionDigits


 NumberFormat.getMaximumIntegerDigits

NumberFormat.getMaximumIntegerDigits

Syntax
public int getMaximumIntegerDigits()
Description
Returns the maximum number of digits allowed in the integer portion of a number.

See Also
setMaximumIntegerDigits


 NumberFormat.getMinimumFractionDigits

NumberFormat.getMinimumFractionDigits

Syntax
public int getMinimumFractionDigits()
Description
Returns the minimum number of digits allowed in the fraction portion of a number.

See Also
setMinimumFractionDigits


 NumberFormat.getMinimumIntegerDigits

NumberFormat.getMinimumIntegerDigits

Syntax
public int getMinimumIntegerDigits()
Description
Returns the minimum number of digits allowed in the integer portion of a number.

See Also
setMinimumIntegerDigits


 NumberFormat.getNumberInstance

NumberFormat.getNumberInstance

Syntax 1
public static final NumberFormat getNumberInstance()
Description
Returns a general-purpose number format for the current default locale.

Syntax 2
public static NumberFormat getNumberInstance( Locale inLocale )
Description
Returns a general-purpose number format for the specified locale.


 NumberFormat.getPercentInstance

NumberFormat.getPercentInstance

Syntax 1
public static final NumberFormat getPercentInstance()
Description
Returns a percentage format for the current default locale.

Syntax 2
public static NumberFormat getPercentInstance( Locale inLocale )
Description
Returns a percentage format for the specified locale.


 NumberFormat.hashCode

NumberFormat.hashCode

Syntax
public int hashCode()
Description
Overrides hashCode

Overrides
hashCode in class Object


 NumberFormat.isGroupingUsed

NumberFormat.isGroupingUsed

Syntax
public boolean isGroupingUsed()
Description
Returns true if grouping is used in this format. For example, in the English locale, with grouping on, the number 1234567 might be formatted as "1,234,567". The grouping separator as well as the size of each group is locale dependant and is determined by sub-classes of NumberFormat.

See Also
setGroupingUsed


 NumberFormat.isParseIntegerOnly

NumberFormat.isParseIntegerOnly

Syntax
public boolean isParseIntegerOnly()
Description
Returns true if this format will parse numbers as integers only. For example in the English locale, with ParseIntegerOnly true, the string "1234." would be parsed as the integer value 1234 and parsing would stop at the "." character. Of course, the exact format accepted by the parse operation is locale dependant and determined by sub-classes of NumberFormat.


 NumberFormat.parse

NumberFormat.parse

Syntax 1
public abstract Number parse( String text, ParsePosition parsePosition )
Description
Returns a Long if possible (e.g. within range [Long.MIN_VALUE, Long.MAX_VALUE], and with no decimals), otherwise a Double. If IntegerOnly is set, will stop at a decimal point (or equivalent; e.g. for rational numbers "1 2/3", will stop after the 1). Does not throw an exception; if no object can be parsed, index is unchanged!

See Also
isParseIntegerOnly, parseObject

Syntax 2
public Number parse( String text ) throws ParseException
Description
Convenience method.

Exceptions
ParseException if the specified string is invalid.
See Also
format


 NumberFormat.parseObject

NumberFormat.parseObject

Syntax
public final Object parseObject( String source, ParsePosition parsePosition )
Description
Parses a string to produce an object.

Overrides
parseObject in class Format


 NumberFormat.setGroupingUsed

NumberFormat.setGroupingUsed

Syntax
public void setGroupingUsed( boolean newValue )
Description
Set whether or not grouping will be used in this format.

See Also
isGroupingUsed


 NumberFormat.setMaximumFractionDigits

NumberFormat.setMaximumFractionDigits

Syntax
public void setMaximumFractionDigits( int newValue )
Description
Sets the maximum number of digits allowed in the fraction portion of a number. maximumFractionDigits must be >= minimumFractionDigits. If the new value for maximumFractionDigits is less than the current value of minimumFractionDigits, then minimumFractionDigits will also be set to the new value.

See Also
getMaximumFractionDigits


 NumberFormat.setMaximumIntegerDigits

NumberFormat.setMaximumIntegerDigits

Syntax
public void setMaximumIntegerDigits( int newValue )
Description
Sets the maximum number of digits allowed in the integer portion of a number. maximumIntegerDigits must be >= minimumIntegerDigits. If the new value for maximumIntegerDigits is less than the current value of minimumIntegerDigits, then minimumIntegerDigits will also be set to the new value.

See Also
getMaximumIntegerDigits


 NumberFormat.setMinimumFractionDigits

NumberFormat.setMinimumFractionDigits

Syntax
public void setMinimumFractionDigits( int newValue )
Description
Sets the minimum number of digits allowed in the fraction portion of a number. minimumFractionDigits must be <= maximumFractionDigits. If the new value for minimumFractionDigits exceeds the current value of maximumFractionDigits, then maximumIntegerDigits will also be set to the new value

See Also
getMinimumFractionDigits


 NumberFormat.setMinimumIntegerDigits

NumberFormat.setMinimumIntegerDigits

Syntax
public void setMinimumIntegerDigits( int newValue )
Description
Sets the minimum number of digits allowed in the integer portion of a number. minimumIntegerDigits must be <= maximumIntegerDigits. If the new value for minimumIntegerDigits exceeds the current value of maximumIntegerDigits, then maximumIntegerDigits will also be set to the new value

See Also
getMinimumIntegerDigits


 NumberFormat.setParseIntegerOnly

NumberFormat.setParseIntegerOnly

Syntax
public void setParseIntegerOnly( boolean value )
Description
Sets whether or not numbers should be parsed as integers only.

See Also
isParseIntegerOnly


 Class ParseException

Class java.text.ParseException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.text.ParseException

public class ParseException
extends Exception

Signals that an error has been has been reached unexpectedly while parsing.

See Also:
Exception, Format, FieldPosition


 ParseException Members

ParseException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ParseException(String, int) | Constructs a ParseException with the specified detail message and offset.

Methods
Name | Description
getErrorOffset() | Returns the position where the error was found.


 ParseException.ParseException

ParseException.ParseException

Syntax
public ParseException( String s, int errorOffset )
Parameters
s
the detail message
errorOffset
the position where the error is found while parsing.
Description
Constructs a ParseException with the specified detail message and offset. A detail message is a String that describes this particular exception.


 ParseException.getErrorOffset

ParseException.getErrorOffset

Syntax
public int getErrorOffset()
Description
Returns the position where the error was found.


 Class ParsePosition

Class java.text.ParsePosition

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.text.ParsePosition

public class ParsePosition
extends Object

ParsePosition is a simple class used by Format and its subclasses to keep track of the current position during parsing. The parseObject method in the various Format classes requires a ParsePosition object as an argument.

By design, as you parse through a string with different formats, you can use the same ParsePosition, since the index parameter records the current position.

See Also:
Format


 ParsePosition Members

ParsePosition Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ParsePosition(int) | Create a new ParsePosition with the given initial index.

Methods
Name | Description
getIndex() | Retrieve the current parse position.
setIndex(int) | Set the current parse position.


 ParsePosition.ParsePosition

ParsePosition.ParsePosition

Syntax
public ParsePosition( int index )
Description
Create a new ParsePosition with the given initial index.


 ParsePosition.getIndex

ParsePosition.getIndex

Syntax
public int getIndex()
Description
Retrieve the current parse position. On input to a parse method, this is the index of the character at which parsing will begin; on output, it is the index of the character following the last character parsed.


 ParsePosition.setIndex

ParsePosition.setIndex

Syntax
public void setIndex( int index )
Description
Set the current parse position.


 Class RuleBasedCollator

Class java.text.RuleBasedCollator

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.text.Collator
           |
           +----java.text.RuleBasedCollator

public class RuleBasedCollator
extends Collator

The RuleBasedCollator class is a concrete subclass of Collator that provides a simple, data-driven, table collator. With this class you can create a customized table-based Collator. RuleBasedCollator maps characters to sort keys.

RuleBasedCollator has the following restrictions for efficiency (other subclasses may be used for more complex languages) :

  1. The French secondary ordering is applied to the whole collator object.
  2. All non-mentioned Unicode characters are at the end of the collation order.
  3. Private use characters are treated as identical. The private use area in Unicode is 0xE800-0xF8FF.

The collation table is composed of a list of collation rules, where each rule is of three forms:

    < modifier >
    < relation > < text-argument >
    < reset > < text-argument >
The following demonstrates how to create your own collation rules:
  • Text-Argument: A text-argument is any sequence of characters, excluding special characters (that is, whitespace characters and the characters used in modifier, relation and reset). If those characters are desired, you can put them in single quotes (e.g. ampersand => '&').
  • Modifier: There is a single modifier which is used to specify that all accents (secondary differences) are backwards.

    '@' : Indicates that accents are sorted backwards, as in French.

  • Relation: The relations are the following:
    • '<' : Greater, as a letter difference (primary)
    • ';' : Greater, as an accent difference (secondary)
    • ',' : Greater, as a case difference (tertiary)
    • '=' : Equal
  • Reset: There is a single reset which is used primarily for contractions and expansions, but which can also be used to add a modification at the end of a set of rules.

    '&' : Indicates that the next rule follows the position to where the reset text-argument would be sorted.

This sounds more complicated than it is in practice. For example, the following are equivalent ways of expressing the same thing:

 a < b < c
 a < b & b < c
 a < c & a < b
Notice that the order is important, as the subsequent item goes immediately after the text-argument. The following are not equivalent:
 a < b & a < c
 a < c & a < b
Either the text-argument must already be present in the sequence, or some initial substring of the text-argument must be present. (e.g. "a < b & ae < e" is valid since "a" is present in the sequence before "ae" is reset). In this latter case, "ae" is not entered and treated as a single character; instead, "e" is sorted as if it were expanded to two characters: "a" followed by an "e". This difference appears in natural languages: in traditional Spanish "ch" is treated as though it contracts to a single character (expressed as "c < ch < d"), while in traditional German "ä" (a-umlaut) is treated as though it expands to two characters (expressed as "a & ae ; ä < b").

Ignorable Characters

For ignorable characters, the first rule must start with a relation (the examples we have used above are really fragments; "a < b" really should be "< a < b"). If, however, the first relation is not "<", then all the text-arguments up to the first "<" are ignorable. For example, ", - < a < b" makes "-" an ignorable character, as we saw earlier in the word "black-birds". In the samples for different languages, you see that most accents are ignorable.

Normalization and Accents

The Collator object automatically normalizes text internally to separate accents from base characters where possible. This is done both when processing the rules, and when comparing two strings. Collator also uses the Unicode canonical mapping to ensure that combining sequences are sorted properly (for more information, see The Unicode Standard, Version 2.0.)

Errors

The following are errors:

  • A text-argument not preceded by either a reset or relation character (e.g. "a < b c < d").
  • A relation or reset character not followed by a text-argument (e.g. "a < , b").
  • A reset where the text-argument (or an initial substring of the text-argument) is not already in the sequence. (e.g. "a < b & e < f")
If you produce one of these errors, a RuleBasedCollator throws a ParseException.

Examples

Simple: "< a < b < c < d"

Norwegian: "< a,A< b,B< c,C< d,D< e,E< f,F< g,G< h,H< i,I< j,J < k,K< l,L< m,M< n,N< o,O< p,P< q,Q< r,R< s,S< t,T < u,U< v,V< w,W< x,X< y,Y< z,Z < å=a?,Å=A? ;aa,AA< æ,Æ< ø,Ø"

Normally, to create a rule-based Collator object, you will use Collator's factory method getInstance. However, to create a rule-based Collator object with specialized rules tailored to your needs, you construct the RuleBasedCollator with the rules contained in a String object. For example:

 String Simple = "< a < b < c < d";
 RuleBasedCollator mySimple = new RuleBasedCollator(Simple);
Or:
 String Norwegian = "< a,A< b,B< c,C< d,D< e,E< f,F< g,G< h,H< i,I< j,J" +
                 "< k,K< l,L< m,M< n,N< o,O< p,P< q,Q< r,R< s,S< t,T" +
                 "< u,U< v,V< w,W< x,X< y,Y< z,Z" +
                 "< å=a?,Å=A?" +
                 ";aa,AA< æ,Æ< ø,Ø";
 RuleBasedCollator myNorwegian = new RuleBasedCollator(Norwegian);

Combining Collators is as simple as concatenating strings. Here's an example that combines two Collators from two different locales:

 // Create an en_US Collator object
 RuleBasedCollator en_USCollator = (RuleBasedCollator)
     Collator.getInstance(new Locale("en", "US", ""));
 // Create a da_DK Collator object
 RuleBasedCollator da_DKCollator = (RuleBasedCollator)
     Collator.getInstance(new Locale("da", "DK", ""));
 // Combine the two
 // First, get the collation rules from en_USCollator
 String en_USRules = en_USCollator.getRules();
 // Second, get the collation rules from da_DKCollator
 String da_DKRules = da_DKCollator.getRules();
 RuleBasedCollator newCollator =
     new RuleBasedCollator(en_USRules + da_DKRules);
 // newCollator has the combined rules

Another more interesting example would be to make changes on an existing table to create a new Collator object. For example, add "& C < ch, cH, Ch, CH" to the en_USCollator object to create your own:

 // Create a new Collator object with additional rules
 String addRules = "& C < ch, cH, Ch, CH";
 RuleBasedCollator myCollator =
     new RuleBasedCollator(en_USCollator + addRules);
 // myCollator contains the new rules

The following example demonstrates how to change the order of non-spacing accents,

 // old rule
 String oldRules = "=?;?;?;?"    // main accents
                 + ";?;?;?;?"    // main accents
                 + ";?;?;?;?"    // main accents
                 + ";?;?;?;?"    // main accents
                 + ";?;?;?;?"    // main accents
                 + "< a , A ; ae, AE ; æ , Æ"
                 + "< b , B < c, C < e, E & C < d, D";
 // change the order of accent characters
 String addOn = "& ? ; ? ; ?";
 RuleBasedCollator myCollator = new RuleBasedCollator(oldRules + addOn);

The last example shows how to put new primary ordering in before the default setting. For example, in Japanese Collator, you can either sort English characters before or after Japanese characters,

 // get en_US Collator rules
 RuleBasedCollator en_USCollator = (RuleBasedCollator)Collator.getInstance(Locale.US);
 // add a few Japanese character to sort before English characters
 // suppose the last character before the first base letter 'a' in
 // the English collation rule is ?
 String jaString = "& ? < ?, ? < ?, ?";
 RuleBasedCollator myJapaneseCollator = new
     RuleBasedCollator(en_USCollator.getRules() + jaString);

See Also:
Collator, CollationElementIterator


 RuleBasedCollator Members

RuleBasedCollator Members

Class Overview | This Package | All Packages

Constructors
Name | Description
RuleBasedCollator(String) | RuleBasedCollator constructor.

Methods
Name | Description
clone() | Standard override; no change in semantics.
compare(String, String) | Compares the character data stored in two different strings based on the collation rules.
equals(Object) | Compares the equality of two collation objects.
getCollationElementIterator(String) | Return a CollationElementIterator for the given String.
getCollationKey(String) | Transforms the string into a series of characters that can be compared with CollationKey.compareTo.
getRules() | Gets the table-based rules for the collation object.
hashCode() | Generates the hash code for the table-based collation object


 RuleBasedCollator.RuleBasedCollator

RuleBasedCollator.RuleBasedCollator

Syntax
public RuleBasedCollator( String rules ) throws ParseException
Parameters
rules
the collation rules to build the collation table from.
Description
RuleBasedCollator constructor. This takes the table rules and builds a collation table out of them. Please see RuleBasedCollator class description for more details on the collation rule syntax.

Exceptions
ParseException A format exception will be thrown if the build process of the rules fails. For example, build rule "a < b c < d" will cause the constructor to throw the ParseException.
See Also
Locale


 RuleBasedCollator.clone

RuleBasedCollator.clone

Syntax
public Object clone()
Description
Standard override; no change in semantics.

Overrides
clone in class Collator


 RuleBasedCollator.compare

RuleBasedCollator.compare

Syntax
public int compare( String source, String target )
Description
Compares the character data stored in two different strings based on the collation rules. Returns information about whether a string is less than, greater than or equal to another string in a language. This can be overriden in a subclass.

Overrides
compare in class Collator


 RuleBasedCollator.equals

RuleBasedCollator.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the table-based collation object to be compared with this.
Returns
true if the current table-based collation object is the same as the table-based collation object obj; false otherwise.
Description
Compares the equality of two collation objects.

Overrides
equals in class Collator


 RuleBasedCollator.getCollationElementIterator

RuleBasedCollator.getCollationElementIterator

Syntax
public CollationElementIterator getCollationElementIterator( String source )
Description
Return a CollationElementIterator for the given String.

See Also
CollationElementIterator


 RuleBasedCollator.getCollationKey

RuleBasedCollator.getCollationKey

Syntax
public CollationKey getCollationKey( String source )
Description
Transforms the string into a series of characters that can be compared with CollationKey.compareTo. This overrides java.text.Collator.getCollationKey. It can be overriden in a subclass.

Overrides
getCollationKey in class Collator


 RuleBasedCollator.getRules

RuleBasedCollator.getRules

Syntax
public String getRules()
Returns
returns the collation rules that the table collation object was created from.
Description
Gets the table-based rules for the collation object.


 RuleBasedCollator.hashCode

RuleBasedCollator.hashCode

Syntax
public int hashCode()
Description
Generates the hash code for the table-based collation object

Overrides
hashCode in class Collator


 Class SimpleDateFormat

Class java.text.SimpleDateFormat

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.text.Format
           |
           +----java.text.DateFormat
                   |
                   +----java.text.SimpleDateFormat

public class SimpleDateFormat
extends DateFormat

SimpleDateFormat is a concrete class for formatting and parsing dates in a locale-sensitive manner. It allows for formatting (millis -> text), parsing (text -> millis), and normalization.

SimpleDateFormat allows you to start by choosing any user-defined patterns for date-time formatting. However, you are encouraged to create a date-time formatter with either getTimeInstance, getDateInstance, or getDateTimeInstance in DateFormat. Each of these class methods can return a date/time formatter initialized with a default format pattern. You may modify the format pattern using the applyPattern methods as desired. For more information on using these methods, see DateFormat.

Time Format Syntax:

To specify the time format use a time pattern string. In this pattern, all ASCII letters are reserved as pattern letters, which are defined as the following:

 Symbol   Meaning                 Presentation        Example
 ------   -------                 ------------        -------
 G        era designator          (Text)              AD
 y        year                    (Number)            1996
 M        month in year           (Text & Number)     July & 07
 d        day in month            (Number)            10
 h        hour in am/pm (1~12)    (Number)            12
 H        hour in day (0~23)      (Number)            0
 m        minute in hour          (Number)            30
 s        second in minute        (Number)            55
 S        millisecond             (Number)            978
 E        day in week             (Text)              Tuesday
 D        day in year             (Number)            189
 F        day of week in month    (Number)            2 (2nd Wed in July)
 w        week in year            (Number)            27
 W        week in month           (Number)            2
 a        am/pm marker            (Text)              PM
 k        hour in day (1~24)      (Number)            24
 K        hour in am/pm (0~11)    (Number)            0
 z        time zone               (Text)              Pacific Standard Time
 '        escape for text
 ''        single quote                              '
The count of pattern letters determine the format.

(Text): 4 or more pattern letters--use full form, < 4--use short or abbreviated form if one exists.

(Number): the minimum number of digits. Shorter numbers are zero-padded to this amount. Year is handled specially; that is, if the count of 'y' is 2, the Year will be truncated to 2 digits.

(Text & Number): 3 or over, use text, otherwise use number.

Any characters in the pattern that are not in the ranges of ['a'..'z'] and ['A'..'Z'] will be treated as quoted text. For instance, characters like ':', '.', ' ', '#' and '@' will appear in the resulting time text even they are not embraced within single quotes.

A pattern containing any invalid pattern letter will result in a thrown exception during formatting or parsing.

Examples Using the US Locale:

 Format Pattern                         Result
 --------------                         -------
 "yyyy.MM.dd G 'at' hh:mm:ss z"    ->>  1996.07.10 AD at 15:08:56 PDT
 "EEE, MMM d, ''yy"                ->>  Wed, July 10, '96
 "h:mm a"                          ->>  12:08 PM
 "hh 'o''''clock' a, zzzz"         ->>  12 o'clock PM, Pacific Daylight Time
 "K:mm a, z"                       ->>  0:00 PM, PST
 "yyyyy.MMMMM.dd GGG hh:mm aaa"    ->>  1996.July.10 AD 12:08 PM
Code Sample:

 SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, "PST");
 pdt.setStartRule(DateFields.APRIL, 1, DateFields.SUNDAY, 2*60*60*1000);
 pdt.setEndRule(DateFields.OCTOBER, -1, DateFields.SUNDAY, 2*60*60*1000);
 // Format the current time.
 SimpleDateFormat formatter
     = new SimpleDateFormat ("yyyy.mm.dd e 'at' hh:mm:ss a zzz");
 Date currentTime_1 = new Date();
 String dateString = formatter.format(currentTime_1);
 // Parse the previous string back into a Date.
 ParsePosition pos = new ParsePosition(0);
 Date currentTime_2 = formatter.parse(dateString, pos);
In the example, the time value currentTime_2 obtained from parsing will be equal to currentTime_1. However, they may not be equal if the am/pm marker 'a' is left out from the format pattern while the "hour in am/pm" pattern symbol is used. This information loss can happen when formatting the time in PM.

For time zones that have no names, use strings GMT+hours:minutes or GMT-hours:minutes.

The calendar defines what is the first day of the week, the first week of the year, whether hours are zero based or not (0 vs 12 or 24), and the time zone. There is one common decimal format to handle all the numbers; the digit count is handled programmatically according to the pattern.

See Also:
Calendar, GregorianCalendar, TimeZone, DateFormat, DateFormatSymbols, DecimalFormat


 SimpleDateFormat Members

SimpleDateFormat Members

Class Overview | This Package | All Packages

Constructors
Name | Description
SimpleDateFormat() | Construct a SimpleDateFormat using the default pattern for the default locale.
SimpleDateFormat(String) | Construct a SimpleDateFormat using the given pattern in the default locale.
SimpleDateFormat(String, DateFormatSymbols) | Construct a SimpleDateFormat using the given pattern and locale-specific symbol data.
SimpleDateFormat(String, Locale) | Construct a SimpleDateFormat using the given pattern and locale.

Methods
Name | Description
applyLocalizedPattern(String) | Apply the given localized pattern string to this date format.
applyPattern(String) | Apply the given unlocalized pattern string to this date format.
clone() | Overrides Cloneable
equals(Object) | Override equals.
format(Date, StringBuffer, FieldPosition) | Overrides DateFormat Formats a date or time, which is the standard millis since 24:00 GMT, Jan 1, 1970.
getDateFormatSymbols() | Gets the date/time formatting data.
hashCode() | Override hashCode.
parse(String, ParsePosition) | Overrides DateFormat
setDateFormatSymbols(DateFormatSymbols) | Allows you to set the date/time formatting data.
toLocalizedPattern() | Return a localized pattern string describing this date format.
toPattern() | Return a pattern string describing this date format.


 SimpleDateFormat.SimpleDateFormat

SimpleDateFormat.SimpleDateFormat

Syntax 1
public SimpleDateFormat()
Description
Construct a SimpleDateFormat using the default pattern for the default locale. Note: Not all locales support SimpleDateFormat; for full generality, use the factory methods in the DateFormat class.

See Also
DateFormat

Syntax 2
public SimpleDateFormat( String pattern )
Description
Construct a SimpleDateFormat using the given pattern in the default locale. Note: Not all locales support SimpleDateFormat; for full generality, use the factory methods in the DateFormat class.

Syntax 3
public SimpleDateFormat( String pattern, Locale loc )
Description
Construct a SimpleDateFormat using the given pattern and locale. Note: Not all locales support SimpleDateFormat; for full generality, use the factory methods in the DateFormat class.

Syntax 4
public SimpleDateFormat( String pattern, DateFormatSymbols formatData )
Description
Construct a SimpleDateFormat using the given pattern and locale-specific symbol data.


 SimpleDateFormat.applyLocalizedPattern

SimpleDateFormat.applyLocalizedPattern

Syntax
public void applyLocalizedPattern( String pattern )
Description
Apply the given localized pattern string to this date format.


 SimpleDateFormat.applyPattern

SimpleDateFormat.applyPattern

Syntax
public void applyPattern( String pattern )
Description
Apply the given unlocalized pattern string to this date format.


 SimpleDateFormat.clone

SimpleDateFormat.clone

Syntax
public Object clone()
Description
Overrides Cloneable

Overrides
clone in class DateFormat


 SimpleDateFormat.equals

SimpleDateFormat.equals

Syntax
public boolean equals( Object obj )
Description
Override equals.

Overrides
equals in class DateFormat


 SimpleDateFormat.format

SimpleDateFormat.format

Syntax
public StringBuffer format( Date date, StringBuffer toAppendTo, FieldPosition pos )
Parameters
date
the date-time value to be formatted into a date-time string.
toAppendTo
where the new date-time text is to be appended.
pos
the formatting position. On input: an alignment field, if desired. On output: the offsets of the alignment field.
Returns
the formatted date-time string.
Description
Overrides DateFormat

Formats a date or time, which is the standard millis since 24:00 GMT, Jan 1, 1970.

Example: using the US locale: "yyyy.MM.dd e 'at' HH:mm:ss zzz" ->> 1996.07.10 AD at 15:08:56 PDT

Overrides
format in class DateFormat
See Also
DateFormat


 SimpleDateFormat.getDateFormatSymbols

SimpleDateFormat.getDateFormatSymbols

Syntax
public DateFormatSymbols getDateFormatSymbols()
Returns
a copy of the date-time formatting data associated with this date-time formatter.
Description
Gets the date/time formatting data.


 SimpleDateFormat.hashCode

SimpleDateFormat.hashCode

Syntax
public int hashCode()
Description
Override hashCode. Generates the hash code for the SimpleDateFormat object

Overrides
hashCode in class DateFormat


 SimpleDateFormat.parse

SimpleDateFormat.parse

Syntax
public Date parse( String text, ParsePosition pos )
Description
Overrides DateFormat

Overrides
parse in class DateFormat
See Also
DateFormat


 SimpleDateFormat.setDateFormatSymbols

SimpleDateFormat.setDateFormatSymbols

Syntax
public void setDateFormatSymbols( DateFormatSymbols newFormatSymbols )
Parameters
newFormatData
the given date-time formatting data.
Description
Allows you to set the date/time formatting data.


 SimpleDateFormat.toLocalizedPattern

SimpleDateFormat.toLocalizedPattern

Syntax
public String toLocalizedPattern()
Description
Return a localized pattern string describing this date format.


 SimpleDateFormat.toPattern

SimpleDateFormat.toPattern

Syntax
public String toPattern()
Description
Return a pattern string describing this date format.


 Class StringCharacterIterator

Class java.text.StringCharacterIterator

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.text.StringCharacterIterator

public final class StringCharacterIterator
extends Object
implements CharacterIterator

StringCharacterIterator implements the CharacterIterater protocol for a String. The StringCharacterIterator class iterates over the entire String.

Examples:

Traverse the text from start to finish

 public void traverseForward(CharacterIterator iter) {
     for (char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
         processChar(c);
     }
 }
Traverse the text backwards, from end to start
 public void traverseBackward(CharacterIterator iter) {
     for (char c = iter.last(); c != CharacterIterator.DONE; c = iter.prev()) {
         processChar(c);
     }
 }
Traverse both forward and backward from a given position in the text.
 public void traverseOut(CharacterIterator iter, int pos) {
     for (char c = iter.setIndex(pos);
          c != CharacterIterator.DONE && notBoundary(c);
          c = iter.next()) {}
     int end = iter.getIndex();
     for (char c = iter.setIndex(pos);
          c != CharacterIterator.DONE && notBoundary(c);
          c = iter.prev()) {}
     int start = iter.getIndex();
     processSection(iter.getText.subString(start,end);
 }


 StringCharacterIterator Members

StringCharacterIterator Members

Class Overview | This Package | All Packages

Constructors
Name | Description
StringCharacterIterator(String) | Construct an iterator with an initial index of 0.
StringCharacterIterator(String, int) | Construct an iterator with the specified initial index.
StringCharacterIterator(String, int, int, int) | Construct an iterator over the given range of the given string, with the index set at the specified position.

Methods
Name | Description
clone() | Create a copy of this boundary
current() | Get the character at the current position (as returned by getIndex()).
equals(Object) | Compares the equality of two StringCharacterIterator objects.
first() | Set the position to getBeginIndex() and return the character at that position.
getBeginIndex() | Return the start index of the text.
getEndIndex() | Return the end index of the text.
getIndex() | Return the current index.
hashCode() | Compute a hashcode for this enumeration
last() | Set the position to getEndIndex() and return the character at that position.
next() | Increment the iterator's index by one and return the character at the new index.
previous() | Decrement the iterator's index by one and return the character at the new index.
setIndex(int) | Set the position to specified position in the text and return that character.


 StringCharacterIterator.StringCharacterIterator

StringCharacterIterator.StringCharacterIterator

Syntax 1
public StringCharacterIterator( String text )
Description
Construct an iterator with an initial index of 0.

Syntax 2
public StringCharacterIterator( String text, int pos )
Parameters
text
The String to be iterated over
pos
Initial iterator position
Description
Construct an iterator with the specified initial index.

Syntax 3
public StringCharacterIterator( String text, int begin, int end, int pos )
Parameters
text
The String to be iterated over
begin
Index of the first character
end
Index of the character following the last character
pos
Initial iterator position
Description
Construct an iterator over the given range of the given string, with the index set at the specified position.


 StringCharacterIterator.clone

StringCharacterIterator.clone

Syntax
public Object clone()
Returns
A copy of this
Description
Create a copy of this boundary

Overrides
clone in class Object


 StringCharacterIterator.current

StringCharacterIterator.current

Syntax
public char current()
Returns
the character at the current position or DONE if the current position is off the end of the text.
Description
Get the character at the current position (as returned by getIndex()).


 StringCharacterIterator.equals

StringCharacterIterator.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the StringCharacterIterator object to be compared with.
Returns
true if the given obj is the same as this StringCharacterIterator object; false otherwise.
Description
Compares the equality of two StringCharacterIterator objects.

Overrides
equals in class Object


 StringCharacterIterator.first

StringCharacterIterator.first

Syntax
public char first()
Description
Set the position to getBeginIndex() and return the character at that position.


 StringCharacterIterator.getBeginIndex

StringCharacterIterator.getBeginIndex

Syntax
public int getBeginIndex()
Returns
the index at which the text begins.
Description
Return the start index of the text.


 StringCharacterIterator.getEndIndex

StringCharacterIterator.getEndIndex

Syntax
public int getEndIndex()
Returns
the index at which the text end.
Description
Return the end index of the text. This index is the index of the first character following the end of the text.


 StringCharacterIterator.getIndex

StringCharacterIterator.getIndex

Syntax
public int getIndex()
Returns
the current index.
Description
Return the current index.


 StringCharacterIterator.hashCode

StringCharacterIterator.hashCode

Syntax
public int hashCode()
Returns
A hash code
Description
Compute a hashcode for this enumeration

Overrides
hashCode in class Object


 StringCharacterIterator.last

StringCharacterIterator.last

Syntax
public char last()
Description
Set the position to getEndIndex() and return the character at that position.


 StringCharacterIterator.next

StringCharacterIterator.next

Syntax
public char next()
Returns
the character at the new position or DONE if the current position is off the end of the text.
Description
Increment the iterator's index by one and return the character at the new index. If the resulting index is greater or equal to getEndIndex(), the current index is reset to getEndIndex() and a value of DONE is returned.


 StringCharacterIterator.previous

StringCharacterIterator.previous

Syntax
public char previous()
Returns
the character at the new position or DONE if the current position is off the end of the text.
Description
Decrement the iterator's index by one and return the character at the new index. If the resulting index is less than getBeginIndex(), the current index is reset to getBeginIndex() and a value of DONE is returned.


 StringCharacterIterator.setIndex

StringCharacterIterator.setIndex

Syntax
public char setIndex( int p )
Description
Set the position to specified position in the text and return that character.


 Package java.util

Package java.util

All Packages

Interfaces

  • Enumeration
  • EventListener
  • Observer

    • Classes

  • BitSet
  • Calendar
  • Date
  • Dictionary
  • EventObject
  • GregorianCalendar
  • Hashtable
  • ListResourceBundle
  • Locale
  • Observable
  • Properties
  • PropertyResourceBundle
  • Random
  • ResourceBundle
  • SimpleTimeZone
  • Stack
  • StringTokenizer
  • TimeZone
  • Vector

    • Exceptions

  • EmptyStackException
  • MissingResourceException
  • NoSuchElementException
  • TooManyListenersException


 Class BitSet

Class java.util.BitSet

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.BitSet

public final class BitSet
extends Object
implements Cloneable, Serializable

A set of bits. The set automatically grows as more bits are needed.


 BitSet Members

BitSet Members

Class Overview | This Package | All Packages

Constructors
Name | Description
BitSet() | Creates an empty set.
BitSet(int) | Creates an empty set with the specified size.

Methods
Name | Description
and(BitSet) | Logically ANDs this bit set with the specified set of bits.
clear(int) | Clears a bit.
clone() | Clones the BitSet.
equals(Object) | Compares this object against the specified object.
get(int) | Gets a bit.
hashCode() | Gets the hashcode.
or(BitSet) | Logically ORs this bit set with the specified set of bits.
set(int) | Sets a bit.
size() | Calculates and returns the set's size in bits.
toString() | Converts the BitSet to a String.
xor(BitSet) | Logically XORs this bit set with the specified set of bits.


 BitSet.BitSet

BitSet.BitSet

Syntax 1
public BitSet()
Description
Creates an empty set.

Syntax 2
public BitSet( int nbits )
Parameters
nbits
the size of the set
Description
Creates an empty set with the specified size.


 BitSet.and

BitSet.and

Syntax
public void and( BitSet set )
Parameters
set
the bit set to be ANDed with
Description
Logically ANDs this bit set with the specified set of bits.


 BitSet.clear

BitSet.clear

Syntax
public void clear( int bit )
Parameters
bit
the bit to be cleared
Description
Clears a bit.


 BitSet.clone

BitSet.clone

Syntax
public Object clone()
Description
Clones the BitSet.

Overrides
clone in class Object


 BitSet.equals

BitSet.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the object to compare with
Returns
true if the objects are the same; false otherwise.
Description
Compares this object against the specified object.

Overrides
equals in class Object


 BitSet.get

BitSet.get

Syntax
public boolean get( int bit )
Parameters
bit
the bit to be gotten
Description
Gets a bit.


 BitSet.hashCode

BitSet.hashCode

Syntax
public int hashCode()
Description
Gets the hashcode.

Overrides
hashCode in class Object


 BitSet.or

BitSet.or

Syntax
public void or( BitSet set )
Parameters
set
the bit set to be ORed with
Description
Logically ORs this bit set with the specified set of bits.


 BitSet.set

BitSet.set

Syntax
public void set( int bit )
Parameters
bit
the bit to be set
Description
Sets a bit.


 BitSet.size

BitSet.size

Syntax
public int size()
Description
Calculates and returns the set's size in bits. The maximum element in the set is the size - 1st element.


 BitSet.toString

BitSet.toString

Syntax
public String toString()
Description
Converts the BitSet to a String.

Overrides
toString in class Object


 BitSet.xor

BitSet.xor

Syntax
public void xor( BitSet set )
Parameters
set
the bit set to be XORed with
Description
Logically XORs this bit set with the specified set of bits.


 Class Calendar

Class java.util.Calendar

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.Calendar

public abstract class Calendar
extends Object
implements Serializable, Cloneable

Calendar is an abstract base class for converting between a Date object and a set of integer fields such as YEAR, MONTH, DAY, HOUR, and so on. (A Date object represents a specific instant in time with millisecond precision. See java.util.Date for information about the Date class.)

Subclasses of Calendar interpret a Date according to the rules of a specific calendar system. The JDK provides one concrete subclass of Calendar: GregorianCalendar. Future subclasses could represent the various types of lunar calendars in use in many parts of the world.

Like other locale-sensitive classes, Calendar provides a class method, getInstance, for getting a generally useful object of this type. Calendar's getInstance method returns a GregorianCalendar object whose time fields have been initialized with the current date and time:

 Calendar rightNow = Calendar.getInstance();

A Calendar object can produce all the time field values needed to implement the date-time formatting for a particular language and calendar style (for example, Japanese-Gregorian, Japanese-Traditional).

When computing a Date from time fields, two special circumstances may arise: there may be insufficient information to compute the Date (such as only year and month but no day in the month), or there may be inconsistent information (such as "Tuesday, July 15, 1996" -- July 15, 1996 is actually a Monday).

Insufficient information. The calendar will use default information to specify the missing fields. This may vary by calendar; for the Gregorian calendar, the default for a field is the same as that of the start of the epoch: i.e., YEAR = 1970, MONTH = JANUARY, DATE = 1, etc.

Inconsistent information. The calendar will give preference to the combinations of fields in the following order (and disregard other inconsistent information).

 month + day-of-month
 month + week-of-month + day-of-week
 month + day-of-week-of-month + day-of-week
 day-of-year
 day-of-week + week-of-year
 hour-of-day
 ampm + hour-of-ampm

Note: for some non-Gregorian calendars, different fields may be necessary for complete disambiguation. For example, a full specification of the historial Arabic astronomical calendar requires year, month, day-of-month and day-of-week in some cases.

Note: There are certain possible ambiguities in interpretation of certain singular times, which are resolved in the following ways:

  1. 24:00:00 "belongs" to the following day. That is, 23:59 on Dec 31, 1969 < 24:00 on Jan 1, 1970 < 24:01:00 on Jan 1, 1970
  2. Although historically not precise, midnight also belongs to "am", and noon belongs to "pm", so on the same day, 12:00 am (midnight) < 12:01 am, and 12:00 pm (noon) < 12:01 pm

The date or time format strings are not part of the definition of a calendar, as those must be modifiable or overridable by the user at runtime. Use java.text.DateFormat to format dates.

Calendar provides an API for field "rolling", where fields can be incremented or decremented, but wrap around. For example, rolling the month up in the date "September 12, 1996" results in "October 12, 1996".

Calendar also provides a date arithmetic function for adding the specified (signed) amount of time to a particular time field. For example, subtracting 5 days from the date "September 12, 1996" results in "September 7, 1996".

See Also:
Date, GregorianCalendar, TimeZone, DateFormat


 Calendar Members

Calendar Members

Class Overview | This Package | All Packages

Fields
Name | Description
AM | Useful constant for hour in 12-hour clock.
AM_PM | Useful constant for date and time.
APRIL | Useful constant for month.
areFieldsSet | The flag which tells if the time fields are set for the calendar.
AUGUST | Useful constant for month.
DATE | Useful constant for date and time.
DAY_OF_MONTH | Useful constant for date and time.
DAY_OF_WEEK | Useful constant for date and time.
DAY_OF_WEEK_IN_MONTH | Useful constant for date and time.
DAY_OF_YEAR | Useful constant for date and time.
DECEMBER | Useful constant for month.
DST_OFFSET | Useful constant for date and time.
ERA | Useful constant for date and time.
FEBRUARY | Useful constant for month.
FIELD_COUNT | Useful constant for date and time.
fields | The time fields containing values into which the millis is computed.
FRIDAY | Useful constant for days of week.
HOUR | Useful constant for date and time.
HOUR_OF_DAY | Useful constant for date and time.
isSet | The flags which tell if a specified time field for the calendar is set.
isTimeSet | The flag which indicates if the current time is set for the calendar.
JANUARY | Useful constant for month.
JULY | Useful constant for month.
JUNE | Useful constant for month.
MARCH | Useful constant for month.
MAY | Useful constant for month.
MILLISECOND | Useful constant for date and time.
MINUTE | Useful constant for date and time.
MONDAY | Useful constant for days of week.
MONTH | Useful constant for date and time.
NOVEMBER | Useful constant for month.
OCTOBER | Useful constant for month.
PM | Useful constant for hour in 12-hour clock.
SATURDAY | Useful constant for days of week.
SECOND | Useful constant for date and time.
SEPTEMBER | Useful constant for month.
SUNDAY | Useful constant for days of week.
THURSDAY | Useful constant for days of week.
time | The current time set for the calendar.
TUESDAY | Useful constant for days of week.
UNDECIMBER | Useful constant for month.
WEDNESDAY | Useful constant for days of week.
WEEK_OF_MONTH | Useful constant for date and time.
WEEK_OF_YEAR | Useful constant for date and time.
YEAR | Useful constant for date and time.
ZONE_OFFSET | Useful constant for date and time.

Constructors
Name | Description
Calendar() | Constructs a Calendar with the default time zone as returned by TimeZone.getDefault(), and the default locale.
Calendar(TimeZone, Locale) | Constructs a Calendar with the given time zone and locale.

Methods
Name | Description
add(int, int) | Date Arithmetic function.
after(Object) | Compares the time field records.
before(Object) | Compares the time field records.
clear() | Clears the values of all the time fields.
clear(int) | Clears the value in the given time field.
clone() | Overrides Cloneable
complete() | Fills in any unset fields in the time field list.
computeFields() | Converts UTC as milliseconds to time field values.
computeTime() | Converts Calendar's time field values to UTC as milliseconds.
equals(Object) | Compares the time field records.
get(int) | Gets the value for a given time field.
getAvailableLocales() | Gets the set of locales for which Calendars are installed.
getFirstDayOfWeek() | Gets what the first day of the week is; e.g., Sunday in US, Monday in France.
getGreatestMinimum(int) | Gets the highest minimum value for the given field if varies.
getInstance() | Gets a Calendar using the default timezone and locale.
getInstance(Locale) | Gets a Calendar using the default timezone and given locale.
getInstance(TimeZone) | Gets a Calendar using the given timezone and default locale.
getInstance(TimeZone, Locale) | Gets a Calendar using the given timezone and given locale.
getLeastMaximum(int) | Gets the lowest maximum value for the given field if varies.
getMaximum(int) | Gets the maximum value for the given time field.
getMinimalDaysInFirstWeek() | Gets what the minimal days required in the first week of the year are; e.g., if the first week is defined as one that contains the first day of the first month of a year, getMinimalDaysInFirstWeek returns 1.
getMinimum(int) | Gets the minimum value for the given time field.
getTime() | Gets this Calendar's current time.
getTimeInMillis() | Gets this Calendar's current time as a long.
getTimeZone() | Gets the time zone.
internalGet(int) | Gets the value for a given time field.
isLenient() | Tell whether date/time interpretation is to be lenient.
isSet(int) | Determines if the given time field has a value set.
roll(int, boolean) | Time Field Rolling function.
set(int, int) | Sets the time field with the given value.
set(int, int, int) | Sets the values for the fields year, month, and date.
set(int, int, int, int, int) | Sets the values for the fields year, month, date, hour, and minute.
set(int, int, int, int, int, int) | Sets the values for the fields year, month, date, hour, minute, and second.
setFirstDayOfWeek(int) | Sets what the first day of the week is; e.g., Sunday in US, Monday in France.
setLenient(boolean) | Specify whether or not date/time interpretation is to be lenient.
setMinimalDaysInFirstWeek(int) | Sets what the minimal days required in the first week of the year are; For example, if the first week is defined as one that contains the first day of the first month of a year, call the method with value 1.
setTime(Date) | Sets this Calendar's current time with the given Date.
setTimeInMillis(long) | Sets this Calendar's current time from the given long value.
setTimeZone(TimeZone) | Sets the time zone with the given time zone value.


 Calendar.AM

Calendar.AM

Syntax
public static final int AM
Description
Useful constant for hour in 12-hour clock. Used in GregorianCalendar.


 Calendar.AM_PM

Calendar.AM_PM

Syntax
public static final int AM_PM
Description
Useful constant for date and time. Used in time fields.


 Calendar.APRIL

Calendar.APRIL

Syntax
public static final int APRIL
Description
Useful constant for month. Used in GregorianCalendar.


 Calendar.areFieldsSet

Calendar.areFieldsSet

Syntax
protected boolean areFieldsSet
Description
The flag which tells if the time fields are set for the calendar.


 Calendar.AUGUST

Calendar.AUGUST

Syntax
public static final int AUGUST
Description
Useful constant for month. Used in GregorianCalendar.


 Calendar.DATE

Calendar.DATE

Syntax
public static final int DATE
Description
Useful constant for date and time. Used in time fields. DATE is the time field name for day-of-month.


 Calendar.DAY_OF_MONTH

Calendar.DAY_OF_MONTH

Syntax
public static final int DAY_OF_MONTH
Description
Useful constant for date and time. Used in time fields. This is a synonym for DATE.


 Calendar.DAY_OF_WEEK

Calendar.DAY_OF_WEEK

Syntax
public static final int DAY_OF_WEEK
Description
Useful constant for date and time. Used in time fields.


 Calendar.DAY_OF_WEEK_IN_MONTH

Calendar.DAY_OF_WEEK_IN_MONTH

Syntax
public static final int DAY_OF_WEEK_IN_MONTH
Description
Useful constant for date and time. Used in time fields.


 Calendar.DAY_OF_YEAR

Calendar.DAY_OF_YEAR

Syntax
public static final int DAY_OF_YEAR
Description
Useful constant for date and time. Used in time fields.


 Calendar.DECEMBER

Calendar.DECEMBER

Syntax
public static final int DECEMBER
Description
Useful constant for month. Used in GregorianCalendar.


 Calendar.DST_OFFSET

Calendar.DST_OFFSET

Syntax
public static final int DST_OFFSET
Description
Useful constant for date and time. Used in time fields.


 Calendar.ERA

Calendar.ERA

Syntax
public static final int ERA
Description
Useful constant for date and time. Used in time fields. ERA is calendar specific.


 Calendar.FEBRUARY

Calendar.FEBRUARY

Syntax
public static final int FEBRUARY
Description
Useful constant for month. Used in GregorianCalendar.


 Calendar.FIELD_COUNT

Calendar.FIELD_COUNT

Syntax
public static final int FIELD_COUNT
Description
Useful constant for date and time. FIELD_COUNT is used for the time field array creation.


 Calendar.fields

Calendar.fields

Syntax
protected int fields[]
Description
The time fields containing values into which the millis is computed.


 Calendar.FRIDAY

Calendar.FRIDAY

Syntax
public static final int FRIDAY
Description
Useful constant for days of week. Used in GregorianCalendar.


 Calendar.HOUR

Calendar.HOUR

Syntax
public static final int HOUR
Description
Useful constant for date and time. Used in time fields. HOUR is used for the 12-hour clock.


 Calendar.HOUR_OF_DAY

Calendar.HOUR_OF_DAY

Syntax
public static final int HOUR_OF_DAY
Description
Useful constant for date and time. Used in time fields. HOUR_OF_DAY is used for the 24-hour clock.


 Calendar.isSet

Calendar.isSet

Syntax
protected boolean isSet[]
Description
The flags which tell if a specified time field for the calendar is set.


 Calendar.isTimeSet

Calendar.isTimeSet

Syntax
protected boolean isTimeSet
Description
The flag which indicates if the current time is set for the calendar.


 Calendar.JANUARY

Calendar.JANUARY

Syntax
public static final int JANUARY
Description
Useful constant for month. Used in GregorianCalendar. Note: Calendar month is now 0-based.


 Calendar.JULY

Calendar.JULY

Syntax
public static final int JULY
Description
Useful constant for month. Used in GregorianCalendar.


 Calendar.JUNE

Calendar.JUNE

Syntax
public static final int JUNE
Description
Useful constant for month. Used in GregorianCalendar.


 Calendar.MARCH

Calendar.MARCH

Syntax
public static final int MARCH
Description
Useful constant for month. Used in GregorianCalendar.


 Calendar.MAY

Calendar.MAY

Syntax
public static final int MAY
Description
Useful constant for month. Used in GregorianCalendar.


 Calendar.MILLISECOND

Calendar.MILLISECOND

Syntax
public static final int MILLISECOND
Description
Useful constant for date and time. Used in time fields.


 Calendar.MINUTE

Calendar.MINUTE

Syntax
public static final int MINUTE
Description
Useful constant for date and time. Used in time fields.


 Calendar.MONDAY

Calendar.MONDAY

Syntax
public static final int MONDAY
Description
Useful constant for days of week. Used in GregorianCalendar.


 Calendar.MONTH

Calendar.MONTH

Syntax
public static final int MONTH
Description
Useful constant for date and time. Used in time fields.


 Calendar.NOVEMBER

Calendar.NOVEMBER

Syntax
public static final int NOVEMBER
Description
Useful constant for month. Used in GregorianCalendar.


 Calendar.OCTOBER

Calendar.OCTOBER

Syntax
public static final int OCTOBER
Description
Useful constant for month. Used in GregorianCalendar.


 Calendar.PM

Calendar.PM

Syntax
public static final int PM
Description
Useful constant for hour in 12-hour clock. Used in GregorianCalendar.


 Calendar.SATURDAY

Calendar.SATURDAY

Syntax
public static final int SATURDAY
Description
Useful constant for days of week. Used in GregorianCalendar.


 Calendar.SECOND

Calendar.SECOND

Syntax
public static final int SECOND
Description
Useful constant for date and time. Used in time fields.


 Calendar.SEPTEMBER

Calendar.SEPTEMBER

Syntax
public static final int SEPTEMBER
Description
Useful constant for month. Used in GregorianCalendar.


 Calendar.SUNDAY

Calendar.SUNDAY

Syntax
public static final int SUNDAY
Description
Useful constant for days of week. Used in GregorianCalendar.


 Calendar.THURSDAY

Calendar.THURSDAY

Syntax
public static final int THURSDAY
Description
Useful constant for days of week. Used in GregorianCalendar.


 Calendar.time

Calendar.time

Syntax
protected long time
Description
The current time set for the calendar.


 Calendar.TUESDAY

Calendar.TUESDAY

Syntax
public static final int TUESDAY
Description
Useful constant for days of week. Used in GregorianCalendar.


 Calendar.UNDECIMBER

Calendar.UNDECIMBER

Syntax
public static final int UNDECIMBER
Description
Useful constant for month. Used in GregorianCalendar. UNDECIMBER is an artifical name. This 13th month is for lunar calendars.


 Calendar.WEDNESDAY

Calendar.WEDNESDAY

Syntax
public static final int WEDNESDAY
Description
Useful constant for days of week. Used in GregorianCalendar.


 Calendar.WEEK_OF_MONTH

Calendar.WEEK_OF_MONTH

Syntax
public static final int WEEK_OF_MONTH
Description
Useful constant for date and time. Used in time fields.


 Calendar.WEEK_OF_YEAR

Calendar.WEEK_OF_YEAR

Syntax
public static final int WEEK_OF_YEAR
Description
Useful constant for date and time. Used in time fields.


 Calendar.YEAR

Calendar.YEAR

Syntax
public static final int YEAR
Description
Useful constant for date and time. Used in time fields.


 Calendar.ZONE_OFFSET

Calendar.ZONE_OFFSET

Syntax
public static final int ZONE_OFFSET
Description
Useful constant for date and time. Used in time fields.


 Calendar.Calendar

Calendar.Calendar

Syntax 1
protected Calendar()
Description
Constructs a Calendar with the default time zone as returned by TimeZone.getDefault(), and the default locale.

See Also
getDefault

Syntax 2
protected Calendar( TimeZone zone, Locale aLocale )
Parameters
zone
the given time zone.
Description
Constructs a Calendar with the given time zone and locale.


 Calendar.add

Calendar.add

Syntax
public abstract void add( int field, int amount )
Parameters
field
the time field.
amount
the amount of date or time to be added to the field.
Description
Date Arithmetic function. Adds the specified (signed) amount of time to the given time field, based on the calendar's rules. For example, to subtract 5 days from the current time of the calendar, you can achieve it by calling:

add(Calendar.DATE, -5).


 Calendar.after

Calendar.after

Syntax
public abstract boolean after( Object when )
Parameters
when
the Calendar to be compared with this Calendar.
Returns
true if the current time of this Calendar is after the time of Calendar when; false otherwise.
Description
Compares the time field records. Equivalent to comparing result of conversion to UTC.


 Calendar.before

Calendar.before

Syntax
public abstract boolean before( Object when )
Parameters
when
the Calendar to be compared with this Calendar.
Returns
true if the current time of this Calendar is before the time of Calendar when; false otherwise.
Description
Compares the time field records. Equivalent to comparing result of conversion to UTC.


 Calendar.clear

Calendar.clear

Syntax 1
public final void clear()
Description
Clears the values of all the time fields.

Syntax 2
public final void clear( int field )
Parameters
field
the time field to be cleared.
Description
Clears the value in the given time field.


 Calendar.clone

Calendar.clone

Syntax
public Object clone()
Description
Overrides Cloneable

Overrides
clone in class Object


 Calendar.complete

Calendar.complete

Syntax
protected void complete()
Description
Fills in any unset fields in the time field list.


 Calendar.computeFields

Calendar.computeFields

Syntax
protected abstract void computeFields()
Description
Converts UTC as milliseconds to time field values. This allows you to sync up the time field values with a new time that is set for the calendar.


 Calendar.computeTime

Calendar.computeTime

Syntax
protected abstract void computeTime()
Description
Converts Calendar's time field values to UTC as milliseconds.


 Calendar.equals

Calendar.equals

Syntax
public abstract boolean equals( Object when )
Parameters
when
the Calendar to be compared with this Calendar.
Returns
true if the current time of this Calendar is equal to the time of Calendar when; false otherwise.
Description
Compares the time field records. Equivalent to comparing result of conversion to UTC.

Overrides
equals in class Object


 Calendar.get

Calendar.get

Syntax
public final int get( int field )
Parameters
field
the given time field.
Returns
the value for the given time field.
Description
Gets the value for a given time field.


 Calendar.getAvailableLocales

Calendar.getAvailableLocales

Syntax
public static synchronized Locale[] getAvailableLocales()
Returns
the set of locales for which Calendars are installed.
Description
Gets the set of locales for which Calendars are installed.


 Calendar.getFirstDayOfWeek

Calendar.getFirstDayOfWeek

Syntax
public int getFirstDayOfWeek()
Returns
the first day of the week.
Description
Gets what the first day of the week is; e.g., Sunday in US, Monday in France.


 Calendar.getGreatestMinimum

Calendar.getGreatestMinimum

Syntax
public abstract int getGreatestMinimum( int field )
Parameters
field
the given time field.
Returns
the highest minimum value for the given time field.
Description
Gets the highest minimum value for the given field if varies. Otherwise same as getMinimum(). For Gregorian, no difference.


 Calendar.getInstance

Calendar.getInstance

Syntax 1
public static synchronized Calendar getInstance()
Returns
a Calendar.
Description
Gets a Calendar using the default timezone and locale.

Syntax 2
public static synchronized Calendar getInstance( TimeZone zone )
Parameters
zone
the given timezone.
Returns
a Calendar.
Description
Gets a Calendar using the given timezone and default locale.

Syntax 3
public static synchronized Calendar getInstance( Locale aLocale )
Parameters
aLocale
the given locale.
Returns
a Calendar.
Description
Gets a Calendar using the default timezone and given locale.

Syntax 4
public static synchronized Calendar getInstance( TimeZone zone, Locale aLocale )
Parameters
zone
the given timezone.
aLocale
the given locale.
Returns
a Calendar.
Description
Gets a Calendar using the given timezone and given locale.


 Calendar.getLeastMaximum

Calendar.getLeastMaximum

Syntax
public abstract int getLeastMaximum( int field )
Parameters
field
the given time field.
Returns
the lowest maximum value for the given time field.
Description
Gets the lowest maximum value for the given field if varies. Otherwise same as getMaximum(). e.g., for Gregorian DAY_OF_MONTH, 28.


 Calendar.getMaximum

Calendar.getMaximum

Syntax
public abstract int getMaximum( int field )
Parameters
field
the given time field.
Returns
the maximum value for the given time field.
Description
Gets the maximum value for the given time field. e.g. for Gregorian DAY_OF_MONTH, 31.


 Calendar.getMinimalDaysInFirstWeek

Calendar.getMinimalDaysInFirstWeek

Syntax
public int getMinimalDaysInFirstWeek()
Returns
the minimal days required in the first week of the year.
Description
Gets what the minimal days required in the first week of the year are; e.g., if the first week is defined as one that contains the first day of the first month of a year, getMinimalDaysInFirstWeek returns 1. If the minimal days required must be a full week, getMinimalDaysInFirstWeek returns 7.


 Calendar.getMinimum

Calendar.getMinimum

Syntax
public abstract int getMinimum( int field )
Parameters
field
the given time field.
Returns
the minimum value for the given time field.
Description
Gets the minimum value for the given time field. e.g., for Gregorian DAY_OF_MONTH, 1.


 Calendar.getTime

Calendar.getTime

Syntax
public final Date getTime()
Returns
the current time.
Description
Gets this Calendar's current time.


 Calendar.getTimeInMillis

Calendar.getTimeInMillis

Syntax
protected long getTimeInMillis()
Returns
the current time as milliseconds from the epoch.
Description
Gets this Calendar's current time as a long.


 Calendar.getTimeZone

Calendar.getTimeZone

Syntax
public TimeZone getTimeZone()
Returns
the time zone object associated with this calendar.
Description
Gets the time zone.


 Calendar.internalGet

Calendar.internalGet

Syntax
protected final int internalGet( int field )
Parameters
field
the given time field.
Returns
the value for the given time field.
Description
Gets the value for a given time field. This is an internal fast time field value getter for the subclasses.


 Calendar.isLenient

Calendar.isLenient

Syntax
public boolean isLenient()
Description
Tell whether date/time interpretation is to be lenient.


 Calendar.isSet

Calendar.isSet

Syntax
public final boolean isSet( int field )
Returns
true if the given time field has a value set; false otherwise.
Description
Determines if the given time field has a value set.


 Calendar.roll

Calendar.roll

Syntax
public abstract void roll( int field, boolean up )
Parameters
field
the time field.
up
indicates if the value of the specified time field is to be rolled up or rolled down. Use true if rolling up, false otherwise.
Description
Time Field Rolling function. Rolls (up/down) a single unit of time on the given time field. For example, to roll the current date up by one day, you can achieve it by calling:

roll(Calendar.DATE, true). When rolling on the year or Calendar.YEAR field, it will roll the year value in the range between 1 and the value returned by calling getMaximum(Calendar.YEAR). When rolling on the month or Calendar.MONTH field, other fields like date might conflict and, need to be changed. For instance, rolling the month on the date 01/31/96 will result in 03/02/96. When rolling on the hour-in-day or Calendar.HOUR_OF_DAY field, it will roll the hour value in the range between 0 and 23, which is zero-based.


 Calendar.set

Calendar.set

Syntax 1
public final void set( int field, int value )
Parameters
field
the given time field.
value
the value to be set for the given time field.
Description
Sets the time field with the given value.

Syntax 2
public final void set( int year, int month, int date )
Parameters
year
the value used to set the YEAR time field.
month
the value used to set the MONTH time field. Month value is 0-based. e.g., 0 for January.
date
the value used to set the DATE time field.
Description
Sets the values for the fields year, month, and date.

Syntax 3
public final void set( int year, int month, int date, int hour, int minute )
Parameters
year
the value used to set the YEAR time field.
month
the value used to set the MONTH time field. Month value is 0-based. e.g., 0 for January.
date
the value used to set the DATE time field.
hour
the value used to set the HOUR_OF_DAY time field.
minute
the value used to set the MINUTE time field.
Description
Sets the values for the fields year, month, date, hour, and minute.

Syntax 4
public final void set( int year, int month, int date, int hour, int minute, int second )
Parameters
year
the value used to set the YEAR time field.
month
the value used to set the MONTH time field. Month value is 0-based. e.g., 0 for January.
date
the value used to set the DATE time field.
hour
the value used to set the HOUR_OF_DAY time field.
minute
the value used to set the MINUTE time field.
second
the value used to set the SECOND time field.
Description
Sets the values for the fields year, month, date, hour, minute, and second.


 Calendar.setFirstDayOfWeek

Calendar.setFirstDayOfWeek

Syntax
public void setFirstDayOfWeek( int value )
Parameters
value
the given first day of the week.
Description
Sets what the first day of the week is; e.g., Sunday in US, Monday in France.


 Calendar.setLenient

Calendar.setLenient

Syntax
public void setLenient( boolean lenient )
Description
Specify whether or not date/time interpretation is to be lenient. With lenient interpretation, a date such as "February 942, 1996" will be treated as being equivalent to the 941st day after February 1, 1996. With strict interpretation, such dates will cause an exception to be thrown.

See Also
setLenient


 Calendar.setMinimalDaysInFirstWeek

Calendar.setMinimalDaysInFirstWeek

Syntax
public void setMinimalDaysInFirstWeek( int value )
Parameters
value
the given minimal days required in the first week of the year.
Description
Sets what the minimal days required in the first week of the year are; For example, if the first week is defined as one that contains the first day of the first month of a year, call the method with value 1. If it must be a full week, use value 7.


 Calendar.setTime

Calendar.setTime

Syntax
public final void setTime( Date date )
Parameters
date
the given Date.
Description
Sets this Calendar's current time with the given Date.


 Calendar.setTimeInMillis

Calendar.setTimeInMillis

Syntax
protected void setTimeInMillis( long millis )
Parameters
date
the new time in milliseconds from the epoch.
Description
Sets this Calendar's current time from the given long value.


 Calendar.setTimeZone

Calendar.setTimeZone

Syntax
public void setTimeZone( TimeZone value )
Parameters
value
the given time zone.
Description
Sets the time zone with the given time zone value.


 Class Date

Class java.util.Date

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.Date

public class Date
extends Object
implements Serializable, Cloneable

The class Date represents a specific instant in time, with millisecond precision.

Prior to JDK 1.1, the class Date had two additional functions. It allowed the interpretation of dates as year, month, day, hour, minute, and second values. It also allowed the formatting and parsing of date strings. Unfortunately, the API for these functions was not amenable to internationalization. As of JDK 1.1, the Calendar class should be used to convert between dates and time fields and the DateFormat class should be used to format and parse date strings. The corresponding methods in Date are deprecated.

Although the Date class is intended to reflect coordinated universal time (UTC), it may not do so exactly, depending on the host environment of the Java Virtual Machine. Nearly all modern operating systems assume that 1 day = 24 × 60 × 60 = 86400 seconds in all cases. In UTC, however, about once every year or two there is an extra second, called a "leap second." The leap second is always added as the last second of the day, and always on December 31 or June 30. For example, the last minute of the year 1995 was 61 seconds long, thanks to an added leap second. Most computer clocks are not accurate enough to be able to reflect the leap-second distinction.

Some computer standards are defined in terms of Greenwich mean time (GMT), which is equivalent to universal time (UT). GMT is the "civil" name for the standard; UT is the "scientific" name for the same standard. The distinction between UTC and UT is that UTC is based on an atomic clock and UT is based on astronomical observations, which for all practical purposes is an invisibly fine hair to split. Because the earth's rotation is not uniform (it slows down and speeds up in complicated ways), UT does not always flow uniformly. Leap seconds are introduced as needed into UTC so as to keep UTC within 0.9 seconds of UT1, which is a version of UT with certain corrections applied. There are other time and date systems as well; for example, the time scale used by the satellite-based global positioning system (GPS) is synchronized to UTC but is not adjusted for leap seconds. An interesting source of further information is the U.S. Naval Observatory, particularly the Directorate of Time at:

    http://tycho.usno.navy.mil

and their definitions of "Systems of Time" at:

    http://tycho.usno.navy.mil/systime.html

In all methods of class Date that accept or return year, month, date, hours, minutes, and seconds values, the following representations are used:

  • A year y is represented by the integer y - 1900.
  • A month is represented by an integer form 0 to 11; 0 is January, 1 is February, and so forth; thus 11 is December.
  • A date (day of month) is represented by an integer from 1 to 31 in the usual manner.
  • An hour is represented by an integer from 0 to 23. Thus, the hour from midnight to 1 a.m. is hour 0, and the hour from noon to 1 p.m. is hour 12.
  • A minute is represented by an integer from 0 to 59 in the usual manner.
  • A second is represented by an integer from 0 to 60; the value 60 occurs only for leap seconds and even then only in Java implementations that actually track leap seconds correctly.

In all cases, arguments given to methods for these purposes need not fall within the indicated ranges; for example, a date may be specified as January 32 and is interpreted as meaning February 1.

See Also:
DateFormat, Calendar, TimeZone


 Date Members

Date Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Date() | Allocates a Date object and initializes it so that it represents the time at which it was allocated measured to the nearest millisecond.
Date(int, int, int) | Allocates a Date object and initializes it so that it represents midnight, local time, at the beginning of the day specified by the year, month, and date arguments. Deprecated.
Date(int, int, int, int, int) | Allocates a Date object and initializes it so that it represents the specified hour and minute, local time, of the date specified by the year, month, date, hrs, and min arguments. Deprecated.
Date(int, int, int, int, int, int) | Allocates a Date object and initializes it so that it represents the specified hour, minute, and second, local time of the date specified by the year, month, date, hrs, min, and sec arguments. Deprecated.
Date(long) | Allocates a Date object and initializes it to represent the specified number of milliseconds since January 1, 1970, 00:00:00 GMT.
Date(String) | Allocates a Date object and initializes it so that it represents the date and time indicated by the string s, which is interpreted as if by the parse method. Deprecated.

Methods
Name | Description
after(Date) | Tests if this date is after the specified date.
before(Date) | Tests if this date is before the specified date.
equals(Object) | Compares two dates.
getDate() | Returns the day of the month represented by this date. Deprecated.
getDay() | Returns the day of the week represented by this date. Deprecated.
getHours() | Returns the hour represented by this date. Deprecated.
getMinutes() | Returns the number of minutes past the hour represented by this date. Deprecated.
getMonth() | Returns the month represented by this date. Deprecated.
getSeconds() | Returns the number of seconds past the minute represented by this date. Deprecated.
getTime() | Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this date.
getTimezoneOffset() | Returns the local time-zone offset. Deprecated.
getYear() | Returns the year represented by this date, minus 1900. Deprecated.
hashCode() | Returns a hash code value for this object.
parse(String) | Given a string representing a time, parse it and return the time value. Deprecated.
setDate(int) | Sets the day of the month of this date to the specified value. Deprecated.
setHours(int) | Sets the hour of this date to the specified value. Deprecated.
setMinutes(int) | Sets the minutes of this date to the specified value. Deprecated.
setMonth(int) | Sets the month of this date to the specified value. Deprecated.
setSeconds(int) | Sets the seconds of this date to the specified value. Deprecated.
setTime(long) | Sets this date to represent the specified number of milliseconds since January 1, 1970 00:00:00 GMT.
setYear(int) | Sets the year of this date to be the specified value plus 1900. Deprecated.
toGMTString() | Creates a string representation of this date. Deprecated.
toLocaleString() | Creates a string representation of this date in an implementation-dependent form. Deprecated.
toString() | Creates a canonical string representation of the date.
UTC(int, int, int, int, int, int) | Determines the date and time based on the arguments. Deprecated.


 Date.Date

Date.Date

Syntax 1
public Date()
Description
Allocates a Date object and initializes it so that it represents the time at which it was allocated measured to the nearest millisecond.

See Also
currentTimeMillis

Syntax 2
public Date( long date )
Parameters
date
the milliseconds since January 1, 1970, 00:00:00 GMT.
Description
Allocates a Date object and initializes it to represent the specified number of milliseconds since January 1, 1970, 00:00:00 GMT.

See Also
currentTimeMillis

Syntax 3
public Date( int year, int month, int date )
Parameters
year
the year minus 1900.
month
the month between 0-11.
date
the day of the month between 1-31.
Description
Note: Date() is deprecated.

Allocates a Date object and initializes it so that it represents midnight, local time, at the beginning of the day specified by the year, month, and date arguments.

See Also
Calendar

Syntax 4
public Date( int year, int month, int date, int hrs, int min )
Parameters
year
the year minus 1900.
month
the month between 0-11.
date
the day of the month between 1-31.
hrs
the hours between 0-23.
min
the minutes between 0-59.
Description
Note: Date() is deprecated.

Allocates a Date object and initializes it so that it represents the specified hour and minute, local time, of the date specified by the year, month, date, hrs, and min arguments.

See Also
Calendar

Syntax 5
public Date( int year, int month, int date, int hrs, int min, int sec )
Parameters
year
the year minus 1900.
month
the month between 0-11.
date
the day of the month between 1-31.
hrs
the hours between 0-23.
min
the minutes between 0-59.
sec
the seconds between 0-59.
Description
Note: Date() is deprecated.

Allocates a Date object and initializes it so that it represents the specified hour, minute, and second, local time of the date specified by the year, month, date, hrs, min, and sec arguments.

See Also
Calendar

Syntax 6
public Date( String s )
Parameters
s
a string representation of the date.
Description
Note: Date() is deprecated.

Allocates a Date object and initializes it so that it represents the date and time indicated by the string s, which is interpreted as if by the parse method.

See Also
DateFormat, parse


 Date.after

Date.after

Syntax
public boolean after( Date when )
Parameters
when
a date.
Returns
true if this date is after the argument date; false otherwise.
Description
Tests if this date is after the specified date.


 Date.before

Date.before

Syntax
public boolean before( Date when )
Parameters
when
a date.
Returns
true if this date is before the argument date; false otherwise.
Description
Tests if this date is before the specified date.


 Date.equals

Date.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the object to compare with.
Returns
true if the objects are the same; false otherwise.
Description
Compares two dates. The result is true if and only if the argument is not null and is a Date object that represents the same point in time, to the millisecond, as this object.

Thus, two Date objects are equal if and only if the getTime method returns the same long value for both.

Overrides
equals in class Object
See Also
getTime


 Date.getDate

Date.getDate

Syntax
public int getDate()
Returns
the day of the month represented by this date.
Description
Note: getDate() is deprecated.

Returns the day of the month represented by this date. The value returned is between 1 and 31.

See Also
Calendar


 Date.getDay

Date.getDay

Syntax
public int getDay()
Returns
the day of the week represented by this date.
Description
Note: getDay() is deprecated.

Returns the day of the week represented by this date. The value returned is between 0 and 6, where 0 represents Sunday.

See Also
Calendar


 Date.getHours

Date.getHours

Syntax
public int getHours()
Returns
the hour represented by this date.
Description
Note: getHours() is deprecated.

Returns the hour represented by this date. The value returned is between 0 and 23, where 0 represents midnight.

See Also
Calendar


 Date.getMinutes

Date.getMinutes

Syntax
public int getMinutes()
Returns
the number of minutes past the hour represented by this date.
Description
Note: getMinutes() is deprecated.

Returns the number of minutes past the hour represented by this date. The value returned is between 0 and 59.

See Also
Calendar


 Date.getMonth

Date.getMonth

Syntax
public int getMonth()
Returns
the month represented by this date.
Description
Note: getMonth() is deprecated.

Returns the month represented by this date. The value returned is between 0 and 11, with the value 0 representing January.

See Also
Calendar


 Date.getSeconds

Date.getSeconds

Syntax
public int getSeconds()
Returns
the number of seconds past the minute represented by this date.
Description
Note: getSeconds() is deprecated.

Returns the number of seconds past the minute represented by this date. The value returned is between 0 and 60. The value 60 can only occur on those Java Virtual Machines that take leap seconds into account.

See Also
Calendar


 Date.getTime

Date.getTime

Syntax
public long getTime()
Returns
the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this date.
Description
Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this date.


 Date.getTimezoneOffset

Date.getTimezoneOffset

Syntax
public int getTimezoneOffset()
Returns
the time-zone offset, in minutes, for the current locale.
Description
Note: getTimezoneOffset() is deprecated.

Returns the local time-zone offset. The time-zone offset is the number of minutes that must be added to GMT to give the local time zone. This value includes the correction, if necessary, for daylight saving time.

See Also
Calendar, TimeZone


 Date.getYear

Date.getYear

Syntax
public int getYear()
Returns
the year represented by this date, minus 1900.
Description
Note: getYear() is deprecated.

Returns the year represented by this date, minus 1900.

See Also
Calendar


 Date.hashCode

Date.hashCode

Syntax
public int hashCode()
Returns
a hash code value for this object.
Description
Returns a hash code value for this object.

Overrides
hashCode in class Object


 Date.parse

Date.parse

Syntax
public static long parse( String s )
Parameters
s
a string to be parsed as a date.
Returns
the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by the string argument.
Description
Note: parse() is deprecated.

Given a string representing a time, parse it and return the time value. This method recognizes most standard syntaxes.

It accepts many syntaxes; in particular, it recognizes the IETF standard date syntax: "Sat, 12 Aug 1995 13:30:00 GMT". It also understands the continental U.S. time-zone abbreviations, but for general use, a time-zone offset should be used: "Sat, 12 Aug 1995 13:30:00 GMT+0430" (4 hours, 30 minutes west of the Greenwich meridian). If no time zone is specified, the local time zone is assumed. GMT and UTC are considered equivalent.

See Also
DateFormat


 Date.setDate

Date.setDate

Syntax
public void setDate( int date )
Parameters
date
the day of the month value between 1-31.
Description
Note: setDate() is deprecated.

Sets the day of the month of this date to the specified value.

See Also
Calendar


 Date.setHours

Date.setHours

Syntax
public void setHours( int hours )
Parameters
hours
the hour value.
Description
Note: setHours() is deprecated.

Sets the hour of this date to the specified value.

See Also
Calendar


 Date.setMinutes

Date.setMinutes

Syntax
public void setMinutes( int minutes )
Parameters
minutes
the value of the minutes.
Description
Note: setMinutes() is deprecated.

Sets the minutes of this date to the specified value.

See Also
Calendar


 Date.setMonth

Date.setMonth

Syntax
public void setMonth( int month )
Parameters
month
the month value between 0-11.
Description
Note: setMonth() is deprecated.

Sets the month of this date to the specified value.

See Also
Calendar


 Date.setSeconds

Date.setSeconds

Syntax
public void setSeconds( int seconds )
Parameters
seconds
the seconds value.
Description
Note: setSeconds() is deprecated.

Sets the seconds of this date to the specified value.

See Also
Calendar


 Date.setTime

Date.setTime

Syntax
public void setTime( long time )
Parameters
time
the number of milliseconds.
Description
Sets this date to represent the specified number of milliseconds since January 1, 1970 00:00:00 GMT.


 Date.setYear

Date.setYear

Syntax
public void setYear( int year )
Parameters
year
the year value.
Description
Note: setYear() is deprecated.

Sets the year of this date to be the specified value plus 1900.

See Also
Calendar


 Date.toGMTString

Date.toGMTString

Syntax
public String toGMTString()
Returns
a string representation of this date, using the Internet GMT conventions.
Description
Note: toGMTString() is deprecated.

Creates a string representation of this date. The result is of the form:

    "12 Aug 1995 02:30:00 GMT"

in which the day of the month is always one or two digits. The other fields have exactly the width shown. The time zone is always given as "GMT".

See Also
DateFormat


 Date.toLocaleString

Date.toLocaleString

Syntax
public String toLocaleString()
Returns
a string representation of this date, using the locale conventions.
Description
Note: toLocaleString() is deprecated.

Creates a string representation of this date in an implementation-dependent form. The intent is that the form should be familiar to the user of the Java application, wherever it may happen to be running. The intent is comparable to that of the "%c" format supported by the strftime() function of ISO C.

See Also
DateFormat


 Date.toString

Date.toString

Syntax
public String toString()
Returns
a string representation of this date.
Description
Creates a canonical string representation of the date. The result is of the form "Sat Aug 12 02:30:00 PDT 1995".

Overrides
toString in class Object


 Date.UTC

Date.UTC

Syntax
public static long UTC( int year, int month, int date, int hrs, int min, int sec )
Parameters
year
the year minus 1900.
month
the month between 0-11.
date
the day of the month between 1-31.
hrs
the hours between 0-23.
min
the minutes between 0-59.
sec
the seconds between 0-59.
Returns
the number of seconds since January 1, 1970, 00:00:00 GMT for the date and time specified by the arguments.
Description
Note: UTC() is deprecated.

Determines the date and time based on the arguments. The arguments are interpreted in UTC, not in the local time zone

See Also
Calendar


 Class Dictionary

Class java.util.Dictionary

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.Dictionary

public abstract class Dictionary
extends Object

The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to values. Any non-null object can be used as a key and as a value.

As a rule, the equals method should be used by implementations of this class to decide if two keys are the same.

See Also:
equals, hashCode, Hashtable


 Dictionary Members

Dictionary Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Dictionary() |

Methods
Name | Description
elements() | Returns an enumeration of the values in this dictionary.
get(Object) | Returns the value to which the key is mapped in this dictionary.
isEmpty() | Tests if this dictionary maps no keys to value.
keys() | Returns an enumeration of the keys in this dictionary.
put(Object, Object) | Maps the specified key to the specified value in this dictionary.
remove(Object) | Removes the key (and its corresponding value) from this dictionary.
size() | Returns the number of keys in this dictionary.


 Dictionary.Dictionary

Dictionary.Dictionary

Syntax
public Dictionary()


 Dictionary.elements

Dictionary.elements

Syntax
public abstract Enumeration elements()
Returns
an enumeration of the values in this dictionary.
Description
Returns an enumeration of the values in this dictionary. the Enumeration methods on the returned object to fetch the elements sequentially.

See Also
keys, Enumeration


 Dictionary.get

Dictionary.get

Syntax
public abstract Object get( Object key )
Parameters
key
a key in this dictionary. null if the key is not mapped to any value in this dictionary.
Returns
the value to which the key is mapped in this dictionary;
Description
Returns the value to which the key is mapped in this dictionary.

See Also
put


 Dictionary.isEmpty

Dictionary.isEmpty

Syntax
public abstract boolean isEmpty()
Returns
true if this dictionary maps no keys to values; false otherwise.
Description
Tests if this dictionary maps no keys to value.


 Dictionary.keys

Dictionary.keys

Syntax
public abstract Enumeration keys()
Returns
an enumeration of the keys in this dictionary.
Description
Returns an enumeration of the keys in this dictionary.

See Also
elements, Enumeration


 Dictionary.put

Dictionary.put

Syntax
public abstract Object put( Object key, Object value )
Parameters
key
the hashtable key.
value
the value.
Returns
the previous value to which the key was mapped in this dictionary, or null if the key did not have a previous mapping.
Description
Maps the specified key to the specified value in this dictionary. Neither the key nor the value can be null.

The value can be retrieved by calling the get method with a key that is equal to the original key.

Exceptions
NullPointerException if the key or value is null.
See Also
equals, get


 Dictionary.remove

Dictionary.remove

Syntax
public abstract Object remove( Object key )
Parameters
key
the key that needs to be removed.
Returns
the value to which the key had been mapped in this dictionary, or null if the key did not have a mapping.
Description
Removes the key (and its corresponding value) from this dictionary. This method does nothing if the key is not in this dictionary.


 Dictionary.size

Dictionary.size

Syntax
public abstract int size()
Returns
the number of keys in this dictionary.
Description
Returns the number of keys in this dictionary.


 Class EmptyStackException

Class java.util.EmptyStackException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.util.EmptyStackException

public class EmptyStackException
extends RuntimeException

Thrown by methods in the Stack class to indicate that the stack is empty.

See Also:
Stack


 EmptyStackException Members

EmptyStackException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
EmptyStackException() | Constructs a new EmptyStackException with no detail message.


 EmptyStackException.EmptyStackException

EmptyStackException.EmptyStackException

Syntax
public EmptyStackException()
Description
Constructs a new EmptyStackException with no detail message.


 Interface Enumeration

Interface java.util.Enumeration

Interface Members | This Package | All Packages

public interface Enumeration

An object that implements the Enumeration interface generates a series of elements, one at a time. Successive calls to the nextElement method return successive elements of the series.

For example, to print all elements of a vector v:

     for (Enumeration e = v.elements() ; e.hasMoreElements() ;) {
         System.out.println(e.nextElement());

     }

Methods are provided to enumerate through the elements of a vector, the keys of a hashtable, and the values in a hashtable. Enumerations are also used to specify the input streams to a SequenceInputStream.

See Also:
SequenceInputStream, nextElement, Hashtable, elements, keys, Vector, elements


 Enumeration Members

Enumeration Members

Interface Overview | This Package | All Packages

Methods
Name | Description
hasMoreElements() | Tests if this enumeration contains more elements.
nextElement() | Returns the next element of this enumeration.


 Enumeration.hasMoreElements

Enumeration.hasMoreElements

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract boolean hasMoreElements()
Returns
true if this enumeration contains more elements; false otherwise.
Description
Tests if this enumeration contains more elements.


 Enumeration.nextElement

Enumeration.nextElement

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract Object nextElement()
Returns
the next element of this enumeration.
Description
Returns the next element of this enumeration.

Exceptions
NoSuchElementException if no more elements exist.


 Interface EventListener

Interface java.util.EventListener

This Package | All Packages

public interface EventListener

A tagging interface that all event listener interfaces must extend


 Class EventObject

Class java.util.EventObject

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.EventObject

public class EventObject
extends Object
implements Serializable


 EventObject Members

EventObject Members

Class Overview | This Package | All Packages

Fields
Name | Description
source |

Constructors
Name | Description
EventObject(Object) |

Methods
Name | Description
getSource() |
toString() | Returns a string representation of the object.


 EventObject.source

EventObject.source

Syntax
protected transient Object source


 EventObject.EventObject

EventObject.EventObject

Syntax
public EventObject( Object source )


 EventObject.getSource

EventObject.getSource

Syntax
public Object getSource()


 EventObject.toString

EventObject.toString

Syntax
public String toString()
Description
Returns a string representation of the object.

Overrides
toString in class Object


 Class GregorianCalendar

Class java.util.GregorianCalendar

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.Calendar
           |
           +----java.util.GregorianCalendar

public class GregorianCalendar
extends Calendar

GregorianCalendar is a concrete subclass of Calendar and provides the standard calendar used by most of the world.

The standard (Gregorian) calendar has 2 eras, BC and AD.

This implementation handles a single discontinuity, which corresponds by default to the date the Gregorian calendar was instituted (October 15, 1582 in some countries, later in others). This cutover date may be changed by the caller.

Prior to the institution of the Gregorian calendar, New Year's Day was March 25. To avoid confusion, this calendar always uses January 1. A manual adjustment may be made if desired for dates that are prior to the Gregorian changeover and which fall between January 1 and March 24.

Example:

     // get the supported ids for GMT-08:00 (Pacific Standard Time)
 String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
     // if no ids were returned, something is wrong. get out.
 if (ids.length == 0)
     System.exit(0);
     // begin output
 System.out.println("Current Time");
     // create a Pacific Standard Time time zone
 SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
     // set up rules for daylight savings time
 pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
 pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
     // create a GregorianCalendar with the Pacific Daylight time zone
    // and the current date and time
 Calendar calendar = new GregorianCalendar(pdt);
 Date trialTime = new Date();
 calendar.setTime(trialTime);
    // print out a bunch of interesting things
 System.out.println("ERA: " + calendar.get(Calendar.ERA));
 System.out.println("YEAR: " + calendar.get(Calendar.YEAR));
 System.out.println("MONTH: " + calendar.get(Calendar.MONTH));
 System.out.println("WEEK_OF_YEAR: " + calendar.get(Calendar.WEEK_OF_YEAR));
 System.out.println("WEEK_OF_MONTH: " + calendar.get(Calendar.WEEK_OF_MONTH));
 System.out.println("DATE: " + calendar.get(Calendar.DATE));
 System.out.println("DAY_OF_MONTH: " + calendar.get(Calendar.DAY_OF_MONTH));
 System.out.println("DAY_OF_YEAR: " + calendar.get(Calendar.DAY_OF_YEAR));
 System.out.println("DAY_OF_WEEK: " + calendar.get(Calendar.DAY_OF_WEEK));
 System.out.println("DAY_OF_WEEK_IN_MONTH: "
                    + calendar.get(Calendar.DAY_OF_WEEK_IN_MONTH));
 System.out.println("AM_PM: " + calendar.get(Calendar.AM_PM));
 System.out.println("HOUR: " + calendar.get(Calendar.HOUR));
 System.out.println("HOUR_OF_DAY: " + calendar.get(Calendar.HOUR_OF_DAY));
 System.out.println("MINUTE: " + calendar.get(Calendar.MINUTE));
 System.out.println("SECOND: " + calendar.get(Calendar.SECOND));
 System.out.println("MILLISECOND: " + calendar.get(Calendar.MILLISECOND));
 System.out.println("ZONE_OFFSET: "
                    + (calendar.get(Calendar.ZONE_OFFSET)/(60*60*1000)));
 System.out.println("DST_OFFSET: "
                    + (calendar.get(Calendar.DST_OFFSET)/(60*60*1000)));
 System.out.println("Current Time, with hour reset to 3");
 calendar.clear(Calendar.HOUR_OF_DAY); // so doesn't override
 calendar.set(Calendar.HOUR, 3);
 System.out.println("ERA: " + calendar.get(Calendar.ERA));
 System.out.println("YEAR: " + calendar.get(Calendar.YEAR));
 System.out.println("MONTH: " + calendar.get(Calendar.MONTH));
 System.out.println("WEEK_OF_YEAR: " + calendar.get(Calendar.WEEK_OF_YEAR));
 System.out.println("WEEK_OF_MONTH: " + calendar.get(Calendar.WEEK_OF_MONTH));
 System.out.println("DATE: " + calendar.get(Calendar.DATE));
 System.out.println("DAY_OF_MONTH: " + calendar.get(Calendar.DAY_OF_MONTH));
 System.out.println("DAY_OF_YEAR: " + calendar.get(Calendar.DAY_OF_YEAR));
 System.out.println("DAY_OF_WEEK: " + calendar.get(Calendar.DAY_OF_WEEK));
 System.out.println("DAY_OF_WEEK_IN_MONTH: "
                    + calendar.get(Calendar.DAY_OF_WEEK_IN_MONTH));
 System.out.println("AM_PM: " + calendar.get(Calendar.AM_PM));
 System.out.println("HOUR: " + calendar.get(Calendar.HOUR));
 System.out.println("HOUR_OF_DAY: " + calendar.get(Calendar.HOUR_OF_DAY));
 System.out.println("MINUTE: " + calendar.get(Calendar.MINUTE));
 System.out.println("SECOND: " + calendar.get(Calendar.SECOND));
 System.out.println("MILLISECOND: " + calendar.get(Calendar.MILLISECOND));
 System.out.println("ZONE_OFFSET: "
        + (calendar.get(Calendar.ZONE_OFFSET)/(60*60*1000))); // in hours
 System.out.println("DST_OFFSET: "
        + (calendar.get(Calendar.DST_OFFSET)/(60*60*1000))); // in hours

See Also:
Calendar, TimeZone


 GregorianCalendar Members

GregorianCalendar Members

Class Overview | This Package | All Packages

Fields
Name | Description
AD | Useful constant for GregorianCalendar.
BC | Useful constant for GregorianCalendar.

Constructors
Name | Description
GregorianCalendar() | Constructs a default GregorianCalendar using the current time in the default time zone with the default locale.
GregorianCalendar(int, int, int) | Constructs a GregorianCalendar with the given date set in the default time zone with the default locale.
GregorianCalendar(int, int, int, int, int) | Constructs a GregorianCalendar with the given date and time set for the default time zone with the default locale.
GregorianCalendar(int, int, int, int, int, int) | Constructs a GregorianCalendar with the given date and time set for the default time zone with the default locale.
GregorianCalendar(Locale) | Constructs a GregorianCalendar based on the current time in the default time zone with the given locale.
GregorianCalendar(TimeZone) | Constructs a GregorianCalendar based on the current time in the given time zone with the default locale.
GregorianCalendar(TimeZone, Locale) | Constructs a GregorianCalendar based on the current time in the given time zone with the given locale.

Methods
Name | Description
add(int, int) | Overrides Calendar Date Arithmetic function.
after(Object) | Overrides Calendar Compares the time field records.
before(Object) | Overrides Calendar Compares the time field records.
clone() | Overrides Cloneable
computeFields() | Overrides Calendar Converts UTC as milliseconds to time field values.
computeTime() | Overrides Calendar Converts time field values to UTC as milliseconds.
equals(Object) | Overrides Calendar Compares the time field records.
getGreatestMinimum(int) | Returns highest minimum value for the given field if varies.
getGregorianChange() | Gets the Gregorian Calendar change date.
getLeastMaximum(int) | Returns lowest maximum value for the given field if varies.
getMaximum(int) | Returns maximum value for the given field.
getMinimum(int) | Returns minimum value for the given field.
hashCode() | Override hashCode.
isLeapYear(int) | Determines if the given year is a leap year.
roll(int, boolean) | Overrides Calendar Time Field Rolling function.
setGregorianChange(Date) | Sets the GregorianCalendar change date.


 GregorianCalendar.AD

GregorianCalendar.AD

Syntax
public static final int AD
Description
Useful constant for GregorianCalendar.


 GregorianCalendar.BC

GregorianCalendar.BC

Syntax
public static final int BC
Description
Useful constant for GregorianCalendar.


 GregorianCalendar.GregorianCalendar

GregorianCalendar.GregorianCalendar

Syntax 1
public GregorianCalendar()
Description
Constructs a default GregorianCalendar using the current time in the default time zone with the default locale.

Syntax 2
public GregorianCalendar( TimeZone zone )
Parameters
zone
the given time zone.
Description
Constructs a GregorianCalendar based on the current time in the given time zone with the default locale.

Syntax 3
public GregorianCalendar( Locale aLocale )
Parameters
aLocale
the given locale.
Description
Constructs a GregorianCalendar based on the current time in the default time zone with the given locale.

Syntax 4
public GregorianCalendar( TimeZone zone, Locale aLocale )
Parameters
zone
the given time zone.
aLocale
the given locale.
Description
Constructs a GregorianCalendar based on the current time in the given time zone with the given locale.

Syntax 5
public GregorianCalendar( int year, int month, int date )
Parameters
year
the value used to set the YEAR time field in the calendar.
month
the value used to set the MONTH time field in the calendar. Month value is 0-based. e.g., 0 for January.
date
the value used to set the DATE time field in the calendar.
Description
Constructs a GregorianCalendar with the given date set in the default time zone with the default locale.

Syntax 6
public GregorianCalendar( int year, int month, int date, int hour, int minute )
Parameters
year
the value used to set the YEAR time field in the calendar.
month
the value used to set the MONTH time field in the calendar. Month value is 0-based. e.g., 0 for January.
date
the value used to set the DATE time field in the calendar.
hour
the value used to set the HOUR_OF_DAY time field in the calendar.
minute
the value used to set the MINUTE time field in the calendar.
Description
Constructs a GregorianCalendar with the given date and time set for the default time zone with the default locale.

Syntax 7
public GregorianCalendar( int year, int month, int date, int hour, int minute, int second )
Parameters
year
the value used to set the YEAR time field in the calendar.
month
the value used to set the MONTH time field in the calendar. Month value is 0-based. e.g., 0 for January.
date
the value used to set the DATE time field in the calendar.
hour
the value used to set the HOUR_OF_DAY time field in the calendar.
minute
the value used to set the MINUTE time field in the calendar.
second
the value used to set the SECOND time field in the calendar.
Description
Constructs a GregorianCalendar with the given date and time set for the default time zone with the default locale.


 GregorianCalendar.add

GregorianCalendar.add

Syntax
public void add( int field, int amount )
Parameters
field
the time field.
amount
the amount of date or time to be added to the field.
Description
Overrides Calendar Date Arithmetic function. Adds the specified (signed) amount of time to the given time field, based on the calendar's rules.

Exceptions
IllegalArgumentException if an unknown field is given.
Overrides
add in class Calendar


 GregorianCalendar.after

GregorianCalendar.after

Syntax
public boolean after( Object when )
Description
Overrides Calendar Compares the time field records. Equivalent to comparing result of conversion to UTC. Please see Calendar.after for descriptions on parameters and the return value.

Overrides
after in class Calendar


 GregorianCalendar.before

GregorianCalendar.before

Syntax
public boolean before( Object when )
Description
Overrides Calendar Compares the time field records. Equivalent to comparing result of conversion to UTC. Please see Calendar.before for descriptions on parameters and the return value.

Overrides
before in class Calendar


 GregorianCalendar.clone

GregorianCalendar.clone

Syntax
public Object clone()
Description
Overrides Cloneable

Overrides
clone in class Calendar


 GregorianCalendar.computeFields

GregorianCalendar.computeFields

Syntax
protected void computeFields()
Description
Overrides Calendar Converts UTC as milliseconds to time field values.

Overrides
computeFields in class Calendar


 GregorianCalendar.computeTime

GregorianCalendar.computeTime

Syntax
protected void computeTime()
Description
Overrides Calendar Converts time field values to UTC as milliseconds.

Exceptions
IllegalArgumentException if an unknown field is given.
Overrides
computeTime in class Calendar


 GregorianCalendar.equals

GregorianCalendar.equals

Syntax
public boolean equals( Object obj )
Description
Overrides Calendar Compares the time field records. Equivalent to comparing result of conversion to UTC. Please see Calendar.equals for descriptions on parameters and the return value.

Overrides
equals in class Calendar


 GregorianCalendar.getGreatestMinimum

GregorianCalendar.getGreatestMinimum

Syntax
public int getGreatestMinimum( int field )
Description
Returns highest minimum value for the given field if varies. Otherwise same as getMinimum(). For Gregorian, no difference. Please see Calendar.getGreatestMinimum for descriptions on parameters and the return value.

Overrides
getGreatestMinimum in class Calendar


 GregorianCalendar.getGregorianChange

GregorianCalendar.getGregorianChange

Syntax
public final Date getGregorianChange()
Returns
the Gregorian cutover time for this calendar.
Description
Gets the Gregorian Calendar change date. This is the point when the switch from Julian dates to Gregorian dates occurred. Default is 00:00:00 local time, October 15, 1582. Previous to this time and date will be Julian dates.


 GregorianCalendar.getLeastMaximum

GregorianCalendar.getLeastMaximum

Syntax
public int getLeastMaximum( int field )
Description
Returns lowest maximum value for the given field if varies. Otherwise same as getMaximum(). For Gregorian DAY_OF_MONTH, 28 Please see Calendar.getLeastMaximum for descriptions on parameters and the return value.

Overrides
getLeastMaximum in class Calendar


 GregorianCalendar.getMaximum

GregorianCalendar.getMaximum

Syntax
public int getMaximum( int field )
Description
Returns maximum value for the given field. e.g. for Gregorian DAY_OF_MONTH, 31 Please see Calendar.getMaximum for descriptions on parameters and the return value.

Overrides
getMaximum in class Calendar


 GregorianCalendar.getMinimum

GregorianCalendar.getMinimum

Syntax
public int getMinimum( int field )
Description
Returns minimum value for the given field. e.g. for Gregorian DAY_OF_MONTH, 1 Please see Calendar.getMinimum for descriptions on parameters and the return value.

Overrides
getMinimum in class Calendar


 GregorianCalendar.hashCode

GregorianCalendar.hashCode

Syntax
public synchronized int hashCode()
Description
Override hashCode. Generates the hash code for the GregorianCalendar object

Overrides
hashCode in class Object


 GregorianCalendar.isLeapYear

GregorianCalendar.isLeapYear

Syntax
public boolean isLeapYear( int year )
Parameters
year
the given year.
Returns
true if the given year is a leap year; false otherwise.
Description
Determines if the given year is a leap year. Returns true if the given year is a leap year.


 GregorianCalendar.roll

GregorianCalendar.roll

Syntax
public void roll( int field, boolean up )
Parameters
field
the time field.
up
Indicates if rolling up or rolling down the field value.
Description
Overrides Calendar Time Field Rolling function. Rolls (up/down) a single unit of time on the given time field.

Exceptions
IllegalArgumentException if an unknown field value is given.
Overrides
roll in class Calendar


 GregorianCalendar.setGregorianChange

GregorianCalendar.setGregorianChange

Syntax
public void setGregorianChange( Date date )
Parameters
date
the given Gregorian cutover date.
Description
Sets the GregorianCalendar change date. This is the point when the switch from Julian dates to Gregorian dates occurred. Default is 00:00:00 local time, October 15, 1582. Previous to this time and date will be Julian dates.


 Class Hashtable

Class java.util.Hashtable

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.Dictionary
           |
           +----java.util.Hashtable

public class Hashtable
extends Dictionary
implements Cloneable, Serializable

This class implements a hashtable, which maps keys to values. Any non-null object can be used as a key or as a value.

To successfully store and retrieve objects from a hashtable, the objects used as keys must implement the hashCode method and the equals method.

An instance of Hashtable has two parameters that affect its efficiency: its capacity and its load factor. The load factor should be between 0.0 and 1.0. When the number of entries in the hashtable exceeds the product of the load factor and the current capacity, the capacity is increased by calling the rehash method. Larger load factors use memory more efficiently, at the expense of larger expected time per lookup.

If many entries are to be made into a Hashtable, creating it with a sufficiently large capacity may allow the entries to be inserted more efficiently than letting it perform automatic rehashing as needed to grow the table.

This example creates a hashtable of numbers. It uses the names of the numbers as keys:

     Hashtable numbers = new Hashtable();
     numbers.put("one", new Integer(1));
     numbers.put("two", new Integer(2));
     numbers.put("three", new Integer(3));

To retrieve a number, use the following code:

     Integer n = (Integer)numbers.get("two");
     if (n != null) {
         System.out.println("two = " + n);
     }

See Also:
equals, hashCode, rehash


 Hashtable Members

Hashtable Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Hashtable() | Constructs a new, empty hashtable with a default capacity and load factor.
Hashtable(int) | Constructs a new, empty hashtable with the specified initial capacity and default load factor.
Hashtable(int, float) | Constructs a new, empty hashtable with the specified initial capacity and the specified load factor.

Methods
Name | Description
clear() | Clears this hashtable so that it contains no keys.
clone() | Creates a shallow copy of this hashtable.
contains(Object) | Tests if some key maps into the specified value in this hashtable.
containsKey(Object) | Tests if the specified object is a key in this hashtable.
elements() | Returns an enumeration of the values in this hashtable.
get(Object) | Returns the value to which the specified key is mapped in this hashtable.
isEmpty() | Tests if this hashtable maps no keys to values.
keys() | Returns an enumeration of the keys in this hashtable.
put(Object, Object) | Maps the specified key to the specified value in this hashtable.
rehash() | Rehashes the contents of the hashtable into a hashtable with a larger capacity.
remove(Object) | Removes the key (and its corresponding value) from this hashtable.
size() | Returns the number of keys in this hashtable.
toString() | Returns a rather long string representation of this hashtable.


 Hashtable.Hashtable

Hashtable.Hashtable

Syntax 1
public Hashtable( int initialCapacity, float loadFactor )
Parameters
initialCapacity
the initial capacity of the hashtable.
loadFactor
a number between 0.0 and 1.0.
Description
Constructs a new, empty hashtable with the specified initial capacity and the specified load factor.

Exceptions
IllegalArgumentException if the initial capacity is less than or equal to zero, or if the load factor is less than or equal to zero.

Syntax 2
public Hashtable( int initialCapacity )
Parameters
initialCapacity
the initial capacity of the hashtable.
Description
Constructs a new, empty hashtable with the specified initial capacity and default load factor.

Syntax 3
public Hashtable()
Description
Constructs a new, empty hashtable with a default capacity and load factor.


 Hashtable.clear

Hashtable.clear

Syntax
public synchronized void clear()
Description
Clears this hashtable so that it contains no keys.


 Hashtable.clone

Hashtable.clone

Syntax
public synchronized Object clone()
Returns
a clone of the hashtable.
Description
Creates a shallow copy of this hashtable. The keys and values themselves are not cloned. This is a relatively expensive operation.

Overrides
clone in class Object


 Hashtable.contains

Hashtable.contains

Syntax
public synchronized boolean contains( Object value )
Parameters
value
a value to search for.
Returns
true if some key maps to the value argument in this hashtable; false otherwise.
Description
Tests if some key maps into the specified value in this hashtable. This operation is more expensive than the containsKey method.

Exceptions
NullPointerException if the value is null.
See Also
containsKey


 Hashtable.containsKey

Hashtable.containsKey

Syntax
public synchronized boolean containsKey( Object key )
Parameters
key
possible key.
Returns
true if the specified object is a key in this hashtable; false otherwise.
Description
Tests if the specified object is a key in this hashtable.

See Also
contains


 Hashtable.elements

Hashtable.elements

Syntax
public synchronized Enumeration elements()
Returns
an enumeration of the values in this hashtable.
Description
Returns an enumeration of the values in this hashtable. Use the Enumeration methods on the returned object to fetch the elements sequentially.

Overrides
elements in class Dictionary
See Also
Enumeration, keys


 Hashtable.get

Hashtable.get

Syntax
public synchronized Object get( Object key )
Parameters
key
a key in the hashtable.
Returns
the value to which the key is mapped in this hashtable; null if the key is not mapped to any value in this hashtable.
Description
Returns the value to which the specified key is mapped in this hashtable.

Overrides
get in class Dictionary
See Also
put


 Hashtable.isEmpty

Hashtable.isEmpty

Syntax
public boolean isEmpty()
Returns
true if this hashtable maps no keys to values; false otherwise.
Description
Tests if this hashtable maps no keys to values.

Overrides
isEmpty in class Dictionary


 Hashtable.keys

Hashtable.keys

Syntax
public synchronized Enumeration keys()
Returns
an enumeration of the keys in this hashtable.
Description
Returns an enumeration of the keys in this hashtable.

Overrides
keys in class Dictionary
See Also
Enumeration, elements


 Hashtable.put

Hashtable.put

Syntax
public synchronized Object put( Object key, Object value )
Parameters
key
the hashtable key.
value
the value.
Returns
the previous value of the specified key in this hashtable, or null if it did not have one.
Description
Maps the specified key to the specified value in this hashtable. Neither the key nor the value can be null.

The value can be retrieved by calling the get method with a key that is equal to the original key.

Exceptions
NullPointerException if the key or value is null.
Overrides
put in class Dictionary
See Also
equals, get


 Hashtable.rehash

Hashtable.rehash

Syntax
protected void rehash()
Description
Rehashes the contents of the hashtable into a hashtable with a larger capacity. This method is called automatically when the number of keys in the hashtable exceeds this hashtable's capacity and load factor.


 Hashtable.remove

Hashtable.remove

Syntax
public synchronized Object remove( Object key )
Parameters
key
the key that needs to be removed.
Returns
the value to which the key had been mapped in this hashtable, or null if the key did not have a mapping.
Description
Removes the key (and its corresponding value) from this hashtable. This method does nothing if the key is not in the hashtable.

Overrides
remove in class Dictionary


 Hashtable.size

Hashtable.size

Syntax
public int size()
Returns
the number of keys in this hashtable.
Description
Returns the number of keys in this hashtable.

Overrides
size in class Dictionary


 Hashtable.toString

Hashtable.toString

Syntax
public synchronized String toString()
Returns
a string representation of this hashtable.
Description
Returns a rather long string representation of this hashtable.

Overrides
toString in class Object


 Class ListResourceBundle

Class java.util.ListResourceBundle

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.ResourceBundle
           |
           +----java.util.ListResourceBundle

public abstract class ListResourceBundle
extends ResourceBundle

ListResourceBundle is a abstract subclass of ResourceBundle that manages resources for a locale in a convenient and easy to use list. See ResourceBundle for more information about resource bundles in general.

Subclasses must override getContents and provide an array, where each item in the array is a pair of objects. The first element of each pair is a String key, and the second is the value associated with that key.

In the following example, the keys are of the form "s1"... The actual keys are entirely up to your choice, so long as they are the same as the keys you use in your program to retrieve the objects from the bundle. Keys are case-sensitive. MyResource is the default version of the bundle family, and MyResource_fr is the french version:

 //====================
 class MyResource extends ListResourceBundle {
     public Object[][] getContents() {
         return contents;
     }
     static final Object[][] contents = {
     // LOCALIZE THIS
         {"s1", "3"},		// starting value in choice field
         {"s2", "MyDisk"},	// starting value in string field
         {"s3", "3 Mar 96"},	// starting value in date field
         {"s4", "The disk '{1}' contained {0} on {2}."},	// initial pattern
         {"s5", "0"},		// first choice number
         {"s6", "no files"},	// first choice value
         {"s7", "1"},		// second choice number
         {"s8", "one file"},	// second choice value
         {"s9", "2"},		// third choice number
         {"s10", "{0}|3 files"},	// third choice value
         {"s11", "format threw an exception: {0}"},	// generic exception message
         {"s12", "ERROR"},	// what to show in field in case of error
         {"s14", "Result"},	// label for formatted stuff
         {"s13", "Dialog"},	// standard font
         {"s15", "Pattern"},	// label for standard pattern
         {"s16", new Dimension(1,5)}	// real object, not just string
     // END OF MATERIAL TO LOCALIZE
     };
 }
 //====================
 class MyResource_fr  extends ListResourceBundle {
     public Object[][] getContents() {
         return contents;
}
     static final Object[][] contents = {
     // LOCALIZE THIS
         {"s1", "3"},		// starting value in choice field
         {"s2", "MonDisk"},	// starting value in string field
         {"s3", "3 Mar 96"},	// starting value in date field
         {"s4", "Le disk '{1}' a {0} a {2}."},	// initial pattern
         {"s5", "0"},		// first choice number
         {"s6", "pas de files"},	// first choice value
         {"s7", "1"},		// second choice number
         {"s8", "une file"},	// second choice value
         {"s9", "2"},		// third choice number
         {"s10", "{0}|3 files"},	// third choice value
         {"s11", "Le format a jete une exception: {0}"},	// generic exception message
         {"s12", "ERROR"},	// what to show in field in case of error
         {"s14", "Resulte"},	// label for formatted stuff
         {"s13", "Dialogue"},	// standard font
         {"s15", "Pattern"},	// label for standard pattern
         {"s16", new Dimension(1,3)}	// real object, not just string
     // END OF MATERIAL TO LOCALIZE
     };
 }

See Also:
ResourceBundle, PropertyResourceBundle


 ListResourceBundle Members

ListResourceBundle Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ListResourceBundle() |

Methods
Name | Description
getContents() | See class description.
getKeys() | Implementation of ResourceBundle.getKeys.
handleGetObject(String) | Override of ResourceBundle, same semantics


 ListResourceBundle.ListResourceBundle

ListResourceBundle.ListResourceBundle

Syntax
public ListResourceBundle()


 ListResourceBundle.getContents

ListResourceBundle.getContents

Syntax
protected abstract Object[][] getContents()
Description
See class description.


 ListResourceBundle.getKeys

ListResourceBundle.getKeys

Syntax
public Enumeration getKeys()
Description
Implementation of ResourceBundle.getKeys.

Overrides
getKeys in class ResourceBundle


 ListResourceBundle.handleGetObject

ListResourceBundle.handleGetObject

Syntax
public final Object handleGetObject( String key )
Description
Override of ResourceBundle, same semantics

Overrides
handleGetObject in class ResourceBundle


 Class Locale

Class java.util.Locale

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.Locale

public final class Locale
extends Object
implements Cloneable, Serializable

A Locale object represents a specific geographical, political, or cultural region. An operation that requires a Locale to perform its task is called locale-sensitive and uses the Locale to tailor information for the user. For example, displaying a number is a locale-sensitive operation--the number should be formatted according to the customs/conventions of the user's native country, region, or culture.

You create a Locale object using one of the two constructors in this class:

 Locale(String language, String country)
 Locale(String language, String country, String variant)
The first argument to both constructors is a valid ISO Language Code. These codes are the lower-case two-letter codes as defined by ISO-639. You can find a full list of these codes at a number of sites, such as:
http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt

The second argument to both constructors is a valid ISO Country Code. These codes are the upper-case two-letter codes as defined by ISO-3166. You can find a full list of these codes at a number of sites, such as:
http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html

The second constructor requires a third argument--the Variant. The Variant codes are vendor and browser-specific. For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX. Where there are two variants, separate them with an underscore, and put the most important one first. For example, a Traditional Spanish collation might be referenced, with "ES", "ES", "Traditional_WIN".

Because a Locale object is just an identifier for a region, no validity check is performed when you construct a Locale. If you want to see whether particular resources are available for the Locale you construct, you must query those resources. For example, ask the NumberFormat for the locales it supports using its getAvailableLocales method.
Note: When you ask for a resource for a particular locale, you get back the best available match, not necessarily precisely what you asked for. For more information, look at ResourceBundle.

The Locale class provides a number of convenient constants that you can use to create Locale objects for commonly used locales. For example, the following creates a Locale object for the United States:

 Locale.US

Once you've created a Locale you can query it for information about itself. Use getCountry to get the ISO Country Code and getLanguage to get the ISO Language Code. You can use getDisplayCountry to get the name of the country suitable for displaying to the user. Similarly, you can use getDisplayLanguage to get the name of the language suitable for displaying to the user. Interestingly, the getDisplayXXX methods are themselves locale-sensitive and have two versions: one that uses the default locale and one that uses the locale specified as an argument.

The JDK provides a number of classes that perform locale-sensitive operations. For example, the NumberFormat class formats numbers, currency, or percentages in a locale-sensitive manner. Classes such as NumberFormat have a number of convenience methods for creating a default object of that type. For example, the NumberFormat class provides these three convenience methods for creating a default NumberFormat object:

 NumberFormat.getInstance()
 NumberFormat.getCurrencyInstance()
 NumberFormat.getPercentInstance()
These methods have two variants; one with an explicit locale and one without; the latter using the default locale.
 NumberFormat.getInstance(myLocale)
 NumberFormat.getCurrencyInstance(myLocale)
 NumberFormat.getPercentInstance(myLocale)
A Locale is the mechanism for identifying the kind of object (NumberFormat) that you would like to get. The locale is just a mechanism for identifying objects, not a container for the objects themselves.

Each class that performs locale-sensitive operations allows you to get all the available objects of that type. You can sift through these objects by language, country, or variant, and use the display names to present a menu to the user. For example, you can create a menu of all the collation objects suitable for a given language. Such classes must implement these three class methods:

 public static Locale[] getAvailableLocales()
 public static String getDisplayName(Locale objectLocale,
                                     Locale displayLocale)
 public static final String getDisplayName(Locale objectLocale)
     // getDisplayName will throw MissingResourceException if the locale
     // is not one of the available locales.

See Also:
ResourceBundle, Format, NumberFormat, Collation


 Locale Members

Locale Members

Class Overview | This Package | All Packages

Fields
Name | Description
CANADA | Useful constant for country.
CANADA_FRENCH | Useful constant for country.
CHINA | Useful constant for country.
CHINESE | Useful constant for language.
ENGLISH | Useful constant for language.
FRANCE | Useful constant for country.
FRENCH | Useful constant for language.
GERMAN | Useful constant for language.
GERMANY | Useful constant for country.
ITALIAN | Useful constant for language.
ITALY | Useful constant for country.
JAPAN | Useful constant for country.
JAPANESE | Useful constant for language.
KOREA | Useful constant for country.
KOREAN | Useful constant for language.
PRC | Useful constant for country.
SIMPLIFIED_CHINESE | Useful constant for language.
TAIWAN | Useful constant for region.
TRADITIONAL_CHINESE | Useful constant for language.
UK | Useful constant for country.
US | Useful constant for country.

Constructors
Name | Description
Locale(String, String) | Construct a locale from language, country.
Locale(String, String, String) | Construct a locale from language, country, variant.

Methods
Name | Description
clone() | Overrides Cloneable
equals(Object) | Compares two Objects for equality.
getCountry() | Getter for programmatic name of field, an uppercased two-letter ISO-3166 code.
getDefault() | Common method of getting the current default Locale.
getDisplayCountry() | Getter for display of field to user.
getDisplayCountry(Locale) | Getter for display of field to user.
getDisplayLanguage() | Getter for display of field to user.
getDisplayLanguage(Locale) | Getter for display of field to user.
getDisplayName() | Getter for display of the entire locale to user.
getDisplayName(Locale) | Getter for display of the entire locale to user.
getDisplayVariant() | Getter for display of field to user.
getDisplayVariant(Locale) | Getter for display of field to user If the localized name is not found, returns the variant code.
getISO3Country() | Getter for the three-letter ISO country abbreviation of the locale.
getISO3Language() | Getter for the three-letter ISO language abbreviation of the locale.
getLanguage() | Getter for programmatic name of field, an lowercased two-letter ISO-639 code.
getVariant() | Getter for programmatic name of field.
hashCode() | Override hashCode.
setDefault(Locale) | Sets the default.
toString() | Getter for the programmatic name of the entire locale, with the language, country and variant separated by underbars.


 Locale.CANADA

Locale.CANADA

Syntax
public static final Locale CANADA
Description
Useful constant for country.


 Locale.CANADA_FRENCH

Locale.CANADA_FRENCH

Syntax
public static final Locale CANADA_FRENCH
Description
Useful constant for country.


 Locale.CHINA

Locale.CHINA

Syntax
public static final Locale CHINA
Description
Useful constant for country.


 Locale.CHINESE

Locale.CHINESE

Syntax
public static final Locale CHINESE
Description
Useful constant for language.


 Locale.ENGLISH

Locale.ENGLISH

Syntax
public static final Locale ENGLISH
Description
Useful constant for language.


 Locale.FRANCE

Locale.FRANCE

Syntax
public static final Locale FRANCE
Description
Useful constant for country.


 Locale.FRENCH

Locale.FRENCH

Syntax
public static final Locale FRENCH
Description
Useful constant for language.


 Locale.GERMAN

Locale.GERMAN

Syntax
public static final Locale GERMAN
Description
Useful constant for language.


 Locale.GERMANY

Locale.GERMANY

Syntax
public static final Locale GERMANY
Description
Useful constant for country.


 Locale.ITALIAN

Locale.ITALIAN

Syntax
public static final Locale ITALIAN
Description
Useful constant for language.


 Locale.ITALY

Locale.ITALY

Syntax
public static final Locale ITALY
Description
Useful constant for country.


 Locale.JAPAN

Locale.JAPAN

Syntax
public static final Locale JAPAN
Description
Useful constant for country.


 Locale.JAPANESE

Locale.JAPANESE

Syntax
public static final Locale JAPANESE
Description
Useful constant for language.


 Locale.KOREA

Locale.KOREA

Syntax
public static final Locale KOREA
Description
Useful constant for country.


 Locale.KOREAN

Locale.KOREAN

Syntax
public static final Locale KOREAN
Description
Useful constant for language.


 Locale.PRC

Locale.PRC

Syntax
public static final Locale PRC
Description
Useful constant for country.


 Locale.SIMPLIFIED_CHINESE

Locale.SIMPLIFIED_CHINESE

Syntax
public static final Locale SIMPLIFIED_CHINESE
Description
Useful constant for language.


 Locale.TAIWAN

Locale.TAIWAN

Syntax
public static final Locale TAIWAN
Description
Useful constant for region.


 Locale.TRADITIONAL_CHINESE

Locale.TRADITIONAL_CHINESE

Syntax
public static final Locale TRADITIONAL_CHINESE
Description
Useful constant for language.


 Locale.UK

Locale.UK

Syntax
public static final Locale UK
Description
Useful constant for country.


 Locale.US

Locale.US

Syntax
public static final Locale US
Description
Useful constant for country.


 Locale.Locale

Locale.Locale

Syntax 1
public Locale( String language, String country, String variant )
Parameters
language
lowercase two-letter ISO-639 code.
country
uppercase two-letter ISO-3166 code.
variant
vendor and browser specific code. See class description.
Description
Construct a locale from language, country, variant.

Syntax 2
public Locale( String language, String country )
Parameters
language
lowercase two-letter ISO-639 code.
country
uppercase two-letter ISO-3166 code.
Description
Construct a locale from language, country.


 Locale.clone

Locale.clone

Syntax
public Object clone()
Description
Overrides Cloneable

Overrides
clone in class Object


 Locale.equals

Locale.equals

Syntax
public boolean equals( Object obj )
Description
Compares two Objects for equality.

Overrides
equals in class Object


 Locale.getCountry

Locale.getCountry

Syntax
public String getCountry()
Description
Getter for programmatic name of field, an uppercased two-letter ISO-3166 code.

See Also
getDisplayCountry


 Locale.getDefault

Locale.getDefault

Syntax
public static synchronized Locale getDefault()
Description
Common method of getting the current default Locale. Used for the presentation: menus, dialogs, etc. Generally set once when your applet or application is initialized, then never reset. (If you do reset the default locale, you probably want to reload your GUI, so that the change is reflected in your interface.)

More advanced programs will allow users to use different locales for different fields, e.g. in a spreadsheet.
Note that the initial setting will match the host system.


 Locale.getDisplayCountry

Locale.getDisplayCountry

Syntax 1
public final String getDisplayCountry()
Description
Getter for display of field to user. If the localized name is not found, returns the ISO code. The default locale is used for the presentation language.

Syntax 2
public String getDisplayCountry( Locale inLocale )
Parameters
inLocale
specifies the desired user language.
Description
Getter for display of field to user. If the localized name is not found, returns the ISO code.


 Locale.getDisplayLanguage

Locale.getDisplayLanguage

Syntax 1
public final String getDisplayLanguage()
Description
Getter for display of field to user. If the localized name is not found, returns the ISO code. The desired user language is from the default locale.

Syntax 2
public String getDisplayLanguage( Locale inLocale )
Parameters
inLocale
specifies the desired user language.
Description
Getter for display of field to user. If the localized name is not found, returns the ISO codes. Example: "English (UK)", "Deutch", "Germany"


 Locale.getDisplayName

Locale.getDisplayName

Syntax 1
public final String getDisplayName()
Description
Getter for display of the entire locale to user. If the localized name is not found, uses the ISO codes. The default locale is used for the presentation language.

Syntax 2
public String getDisplayName( Locale inLocale )
Parameters
inLocale
specifies the desired user language.
Description
Getter for display of the entire locale to user. If the localized name is not found, uses the ISO codes


 Locale.getDisplayVariant

Locale.getDisplayVariant

Syntax 1
public final String getDisplayVariant()
Description
Getter for display of field to user. If the localized name is not found, returns the variant code. The default locale is used for the presentation language.

Syntax 2
public String getDisplayVariant( Locale inLocale )
Parameters
inLocale
specifies the desired user language.
Description
Getter for display of field to user If the localized name is not found, returns the variant code.


 Locale.getISO3Country

Locale.getISO3Country

Syntax
public String getISO3Country() throws MissingResourceException
Description
Getter for the three-letter ISO country abbreviation of the locale.

Exceptions
MissingResourceException Throws MissingResourceException if the three-letter language abbreviation is not available for this locale.


 Locale.getISO3Language

Locale.getISO3Language

Syntax
public String getISO3Language() throws MissingResourceException
Description
Getter for the three-letter ISO language abbreviation of the locale.

Exceptions
MissingResourceException Throws MissingResourceException if the three-letter language abbreviation is not available for this locale.


 Locale.getLanguage

Locale.getLanguage

Syntax
public String getLanguage()
Description
Getter for programmatic name of field, an lowercased two-letter ISO-639 code.

See Also
getDisplayLanguage


 Locale.getVariant

Locale.getVariant

Syntax
public String getVariant()
Description
Getter for programmatic name of field.

See Also
getDisplayVariant


 Locale.hashCode

Locale.hashCode

Syntax
public synchronized int hashCode()
Description
Override hashCode. Since Locales are often used in hashtables, caches the value for speed.

Overrides
hashCode in class Object


 Locale.setDefault

Locale.setDefault

Syntax
public static synchronized void setDefault( Locale newLocale )
Parameters
newLocale
Locale to set to.
Description
Sets the default. Normally set once at the beginning of applet or application, then never reset. setDefault does not reset the host locale.


 Locale.toString

Locale.toString

Syntax
public final String toString()
Description
Getter for the programmatic name of the entire locale, with the language, country and variant separated by underbars. If a field is missing, at most one underbar will occur. Example: "EN", "DE_DE", "EN_US_WIN", "DE_POSIX", "FR_MAC"

Overrides
toString in class Object
See Also
getDisplayName


 Class MissingResourceException

Class java.util.MissingResourceException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.util.MissingResourceException

public class MissingResourceException
extends RuntimeException

Signals that a resource is missing.

See Also:
Exception, ResourceBundle


 MissingResourceException Members

MissingResourceException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
MissingResourceException(String, String, String) | Constructs a MissingResourceException with the specified information.

Methods
Name | Description
getClassName() | Gets parameter passed by constructor.
getKey() | Gets parameter passed by constructor.


 MissingResourceException.MissingResourceException

MissingResourceException.MissingResourceException

Syntax
public MissingResourceException( String s, String className, String key )
Parameters
s
the detail message
classname
the name of the resource class
key
the key for the missing resource.
Description
Constructs a MissingResourceException with the specified information. A detail message is a String that describes this particular exception.


 MissingResourceException.getClassName

MissingResourceException.getClassName

Syntax
public String getClassName()
Description
Gets parameter passed by constructor.


 MissingResourceException.getKey

MissingResourceException.getKey

Syntax
public String getKey()
Description
Gets parameter passed by constructor.


 Class NoSuchElementException

Class java.util.NoSuchElementException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.lang.RuntimeException
                           |
                           +----java.util.NoSuchElementException

public class NoSuchElementException
extends RuntimeException

Thrown by the nextElement method of an Enumeration to indicate that there are no more elements in the enumeration.

See Also:
Enumeration, nextElement


 NoSuchElementException Members

NoSuchElementException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
NoSuchElementException() | Constructs a NoSuchElementException with no detail message.
NoSuchElementException(String) | Constructs a NoSuchElementException with the specified detail message.


 NoSuchElementException.NoSuchElementException

NoSuchElementException.NoSuchElementException

Syntax 1
public NoSuchElementException()
Description
Constructs a NoSuchElementException with no detail message.

Syntax 2
public NoSuchElementException( String s )
Parameters
s
the detail message.
Description
Constructs a NoSuchElementException with the specified detail message.


 Class Observable

Class java.util.Observable

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.Observable

public class Observable
extends Object

This class represents an observable object, or "data" in the model-view paradigm. It can be subclassed to represent an object that the application wants to have observed.

An observable object can have one or more observers. After an observable instance changes, an application calling the Observable's notifyObservers method causes all of its observers to be notified of the change by a call to their update method.

See Also:
notifyObservers, notifyObservers, Observer, update


 Observable Members

Observable Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Observable() | Construct an Observable with zero Observers

Methods
Name | Description
addObserver(Observer) | Adds an observer to the set of observers for this object.
clearChanged() | Indicates that this object has no longer changed, or that it has already notified all of its observers of its most recent change.
countObservers() | Returns the number of observers of this object.
deleteObserver(Observer) | Deletes an observer from the set of observers of this object.
deleteObservers() | Clears the observer list so that this object no longer has any observers.
hasChanged() | Tests if this object has changed.
notifyObservers() | If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed.
notifyObservers(Object) | If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed.
setChanged() | Indicates that this object has changed.


 Observable.Observable

Observable.Observable

Syntax
public Observable()
Description
Construct an Observable with zero Observers


 Observable.addObserver

Observable.addObserver

Syntax
public synchronized void addObserver( Observer o )
Parameters
o
an observer to be added.
Description
Adds an observer to the set of observers for this object.


 Observable.clearChanged

Observable.clearChanged

Syntax
protected synchronized void clearChanged()
Description
Indicates that this object has no longer changed, or that it has already notified all of its observers of its most recent change. This method is called automatically by the notifyObservers methods.

See Also
notifyObservers, notifyObservers


 Observable.countObservers

Observable.countObservers

Syntax
public synchronized int countObservers()
Returns
the number of observers of this object.
Description
Returns the number of observers of this object.


 Observable.deleteObserver

Observable.deleteObserver

Syntax
public synchronized void deleteObserver( Observer o )
Parameters
o
the observer to be deleted.
Description
Deletes an observer from the set of observers of this object.


 Observable.deleteObservers

Observable.deleteObservers

Syntax
public synchronized void deleteObservers()
Description
Clears the observer list so that this object no longer has any observers.


 Observable.hasChanged

Observable.hasChanged

Syntax
public synchronized boolean hasChanged()
Returns
true if the setChanged method has been called more recently than the clearChanged method on this object; false otherwise.
Description
Tests if this object has changed.

See Also
clearChanged, setChanged


 Observable.notifyObservers

Observable.notifyObservers

Syntax 1
public void notifyObservers()
Description
If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed.

Each observer has its update method called with two arguments: this observable object and null.

See Also
clearChanged, hasChanged, update

Syntax 2
public void notifyObservers( Object arg )
Parameters
arg
any object.
Description
If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed.

Each observer has its update method called with two arguments: this observable object and the arg argument.

See Also
clearChanged, hasChanged, update


 Observable.setChanged

Observable.setChanged

Syntax
protected synchronized void setChanged()
Description
Indicates that this object has changed.


 Interface Observer

Interface java.util.Observer

Interface Members | This Package | All Packages

public interface Observer

A class can implement the Observer interface when it wants to be informed of changes in observable objects.

See Also:
Observable


 Observer Members

Observer Members

Interface Overview | This Package | All Packages

Methods
Name | Description
update(Observable, Object) | This method is called whenever the observed object is changed.


 Observer.update

Observer.update

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void update( Observable o, Object arg )
Parameters
o
the observable object.
arg
an argument passed to the notifyObservers method.
Description
This method is called whenever the observed object is changed. An application calls an observable object's notifyObservers method to have all the object's observers notified of the change.


 Class Properties

Class java.util.Properties

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.Dictionary
           |
           +----java.util.Hashtable
                   |
                   +----java.util.Properties

public class Properties
extends Hashtable

The Properties class represents a persistent set of properties. The Properties can be saved to a stream or loaded from a stream. Each key and its corresponding value in the property list is a string.

A property list can contain another property list as its "defaults"; this second property list is searched if the property key is not found in the original property list.


 Properties Members

Properties Members

Class Overview | This Package | All Packages

Fields
Name | Description
defaults | A property list that contains default values for any keys not found in this property list.

Constructors
Name | Description
Properties() | Creates an empty property list with no default values.
Properties(Properties) | Creates an empty property list with the specified defaults.

Methods
Name | Description
getProperty(String) | Searches for the property with the specified key in this property list.
getProperty(String, String) | Searches for the property with the specified key in this property list.
list(PrintStream) | Prints this property list out to the specified output stream.
list(PrintWriter) | Prints this property list out to the specified output stream.
load(InputStream) | Reads a property list from an input stream.
propertyNames() | Returns an enumeration of all the keys in this property list, including the keys in the default property list.
save(OutputStream, String) | Stores this property list to the specified output stream.


 Properties.defaults

Properties.defaults

Syntax
protected Properties defaults
Description
A property list that contains default values for any keys not found in this property list.


 Properties.Properties

Properties.Properties

Syntax 1
public Properties()
Description
Creates an empty property list with no default values.

Syntax 2
public Properties( Properties defaults )
Parameters
defaults
the defaults.
Description
Creates an empty property list with the specified defaults.


 Properties.getProperty

Properties.getProperty

Syntax 1
public String getProperty( String key )
Parameters
key
the property key.
Returns
the value in this property list with the specified key value.
Description
Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns null if the property is not found.

See Also
defaults

Syntax 2
public String getProperty( String key, String defaultValue )
Parameters
key
the hashtable key.
defaultValue
a default value.
Returns
the value in this property list with the specified key value.
Description
Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns the default value argument if the property is not found.

See Also
defaults


 Properties.list

Properties.list

Syntax 1
public void list( PrintStream out )
Parameters
out
an output stream.
Description
Prints this property list out to the specified output stream. This method is useful for debugging.

Syntax 2
public void list( PrintWriter out )
Parameters
out
an output stream.
Description
Prints this property list out to the specified output stream. This method is useful for debugging.


 Properties.load

Properties.load

Syntax
public synchronized void load( InputStream in ) throws IOException
Parameters
in
the input stream.
Description
Reads a property list from an input stream.

Exceptions
IOException if an error occurred when reading from the input stream.


 Properties.propertyNames

Properties.propertyNames

Syntax
public Enumeration propertyNames()
Returns
an enumeration of all the keys in this property list, including the keys in the default property list.
Description
Returns an enumeration of all the keys in this property list, including the keys in the default property list.

See Also
Enumeration, defaults


 Properties.save

Properties.save

Syntax
public synchronized void save( OutputStream out, String header )
Parameters
out
an output stream.
header
a description of the property list.
Description
Stores this property list to the specified output stream. The string header is printed as a comment at the beginning of the stream.


 Class PropertyResourceBundle

Class java.util.PropertyResourceBundle

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.ResourceBundle
           |
           +----java.util.PropertyResourceBundle

public class PropertyResourceBundle
extends ResourceBundle

PropertyResourceBundle is an abstract subclass of ResourceBundle that manages resources for a locale using a set of static strings from a property file. See ResourceBundle for more information about resource bundles in general.

The property file contains the keys that you use in your source code in calls to ResourceBundle.getString and similar methods, and their corresponding values, etc. The name of the property file indicates the resource bundle's family and locale.

In the following example, the keys are of the form "s1"... The actual keys are entirely up to your choice, so long as they are the same as the keys you use in your program to retrieve the objects from the bundle. Keys are case-sensitive.

 s1=3
 s2=MeinDisk
 s3=3 Mar 96
 s4=Der disk '{1}' a {0} a {2}.
 s5=0
 s6=keine Datein
 s7=1
 s8=ein Datei
 s9=2
 s10={0}|3 Datein
 s11=Der Format worf ein Exception: {0}
 s12=ERROR
 s14=Resulte
 s13=Dialogue
 s15=Pattern
 s16=1,3

See Also:
ResourceBundle, ListResourceBundle


 PropertyResourceBundle Members

PropertyResourceBundle Members

Class Overview | This Package | All Packages

Constructors
Name | Description
PropertyResourceBundle(InputStream) | Creates a property resource

Methods
Name | Description
getKeys() | Implementation of ResourceBundle.getKeys.
handleGetObject(String) | Override of ResourceBundle, same semantics


 PropertyResourceBundle.PropertyResourceBundle

PropertyResourceBundle.PropertyResourceBundle

Syntax
public PropertyResourceBundle( InputStream stream ) throws IOException
Parameters
file
property file to read from.
Description
Creates a property resource


 PropertyResourceBundle.getKeys

PropertyResourceBundle.getKeys

Syntax
public Enumeration getKeys()
Description
Implementation of ResourceBundle.getKeys.

Overrides
getKeys in class ResourceBundle


 PropertyResourceBundle.handleGetObject

PropertyResourceBundle.handleGetObject

Syntax
public Object handleGetObject( String key )
Description
Override of ResourceBundle, same semantics

Overrides
handleGetObject in class ResourceBundle


 Class Random

Class java.util.Random

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.Random

public class Random
extends Object
implements Serializable

An instance of this class is used to generate a stream of pseudorandom numbers. The class uses a 48-bit seed, which is modified using a linear congruential formula. (See Donald Knuth, The Art of Computer Programming, Volume 2, Section 3.2.1.)

If two instances of Random are created with the same seed, and the same sequence of method calls is made for each, they will generate and return identical sequences of numbers.

Many applications will find the random method in class Math simpler to use.

See Also:
random


 Random Members

Random Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Random() | Creates a new random number generator.
Random(long) | Creates a new random number generator using a single long seed.

Methods
Name | Description
next(int) | Generates the next pseudorandom number.
nextBytes(byte[]) | Generates a user specified number of random bytes.
nextDouble() | Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.
nextFloat() | Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence.
nextGaussian() | Returns the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence.
nextInt() | Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence.
nextLong() | Returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence.
setSeed(long) | Sets the seed of this random number generator using a single long seed.


 Random.Random

Random.Random

Syntax 1
public Random()
Description
Creates a new random number generator. Its seed is initialized to a value based on the current time.

See Also
currentTimeMillis

Syntax 2
public Random( long seed )
Parameters
seed
the initial seed.
Description
Creates a new random number generator using a single long seed.

See Also
setSeed


 Random.next

Random.next

Syntax
protected synchronized int next( int bits )
Parameters
bits
random bits
Returns
the next pseudorandom value from this random number generator's sequence.
Description
Generates the next pseudorandom number. Subclass should override this, as this is used by all other methods.


 Random.nextBytes

Random.nextBytes

Syntax
public void nextBytes( byte bytes[] )
Description
Generates a user specified number of random bytes.


 Random.nextDouble

Random.nextDouble

Syntax
public double nextDouble()
Returns
the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.
Description
Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.


 Random.nextFloat

Random.nextFloat

Syntax
public float nextFloat()
Returns
the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence.
Description
Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence.


 Random.nextGaussian

Random.nextGaussian

Syntax
public synchronized double nextGaussian()
Returns
the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence.
Description
Returns the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence.


 Random.nextInt

Random.nextInt

Syntax
public int nextInt()
Returns
the next pseudorandom, uniformly distributed int value from this random number generator's sequence.
Description
Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence.


 Random.nextLong

Random.nextLong

Syntax
public long nextLong()
Returns
the next pseudorandom, uniformly distributed long value from this random number generator's sequence.
Description
Returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence.


 Random.setSeed

Random.setSeed

Syntax
public synchronized void setSeed( long seed )
Parameters
seed
the initial seed.
Description
Sets the seed of this random number generator using a single long seed.


 Class ResourceBundle

Class java.util.ResourceBundle

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.ResourceBundle

public abstract class ResourceBundle
extends Object

Resource bundles contain locale-specific objects. When your program needs a locale-specific resource, a String for example, your program can load it from the resource bundle that is appropriate for the current user's locale. In this way, you can write program code that is largely independent of the user's locale isolating most, if not all, of the locale-specific information in resource bundles.

This allows you to write programs that can:

  • be easily localized, or translated, into different languages
  • handle multiple locales at once
  • be easily modified later to support even more locales

One resource bundle is, conceptually, a set of related classes that inherit from ResourceBundle. Each related subclass of ResourceBundle has the same base name plus an additional component that identifies its locale. For example, suppose your resource bundle is named MyResources. The first class you are likely to write is the default resource bundle which simply has the same name as its family--MyResources. You can also provide as many related locale-specific classes as you need: for example, perhaps you would provide a German one named MyResources_de.

Each related subclass of ResourceBundle contains the same items, but the items have been translated for the locale represented by that ResourceBundle subclass. For example, both MyResources and MyResources_de may have a String that's used on a button for confirming operations. In MyResources the String may contain OK and in MyResources_de it may contain Gut.

If there are different resources for different countries, you can make specializations: for example, MyResources_de_CH for Switzerland. If you want to only modify some of the resources in the specialization, you can do so.

When your program needs a locale-specific object, it loads the ResourceBundle class using the getBundle method:

 ResourceBundle myResources =
      ResourceBundle.getBundle("MyResources", currentLocale);
The first argument specifies the family name of the resource bundle that contains the object in question. The second argument indicates the desired locale. getBundle uses these two arguments to construct the name of the ResourceBundle subclass it should load as follows.

The resource bundle lookup searches for classes with various suffixes on the basis of (1) the desired locale and (2) the default locale (baseclass), in the following order from lower-level (more specific) to parent-level (less specific):

baseclass + "_" + language1 + "_" + country1 + "_" + variant1
baseclass + "_" + language1 + "_" + country1
baseclass + "_" + language1
baseclass
baseclass + "_" + language2 + "_" + country2 + "_" + variant2
baseclass + "_" + language2 + "_" + country2
baseclass + "_" + language2

The result of the lookup is a class, but that class may be backed by a property file on disk. If a lookup fails, getBundle() throws a MissingResourceException.

The baseclass must be fully qualified (for example, myPackage.MyResources, not just MyResources). It must also be accessable by your code; it cannot be a class that is private to the package where ResourceBundle.getBundle is called.

Note: ResourceBundle are used internally in accessing NumberFormats, Collations, and so on. The lookup strategy is the same.

Resource bundles contain key/value pairs. The keys uniquely identify a locale-specific object in the bundle. Here's an example of a ListResourceBundle that contains two key/value pairs:

 class MyResource extends ListResourceBundle {
      public Object[][] getContents() {
              return contents;
      }
      static final Object[][] contents = {
      // LOCALIZE THIS
              {"OkKey", "OK"},
              {"CancelKey", "Cancel"},
      // END OF MATERIAL TO LOCALIZE
      };
 }
Keys are always Strings. In this example, the keys are OkKey and CancelKey. In the above example, the values are also Strings--OK and Cancel--but they don't have to be. The values can be any type of object.

You retrieve an object from resource bundle using the appropriate getter method. Because OkKey and CancelKey are both strings, you would use getString to retrieve them:

 button1 = new Button(myResourceBundle.getString("OkKey"));
 button2 = new Button(myResourceBundle.getString("CancelKey"));
The getter methods all require the key as an argument and return the object if found. If the object is not found, the getter method throws a MissingResourceException.

Besides getString; ResourceBundle supports a number of other methods for getting different types of objects such as getStringArray. If you don't have an object that matches one of these methods, you can use getObject and cast the result to the appropriate type. For example:

 int[] myIntegers = (int[]) myResources.getObject("intList");

NOTE: You should always supply a baseclass with no suffixes. This will be the class of "last resort", if a locale is requested that does not exist. For example, below we have a class MyResources. It happens to contain US strings, so we don't have to have an explicit MyResource_en or MyResource_en_US.

The JDK provides two subclasses of ResourceBundle, ListResourceBundle and PropertyResourceBundle, that provide a fairly simple way to create resources. (Once serialization is fully integrated, we will provide another way.) As you saw briefly in a prevous example, ListResourceBundle manages its resource as a List of key/value pairs. PropertyResourceBundle uses a properties file to manage its resources.

If ListResourceBundle or PropertyResourceBundle do not suit your needs, you can write your own ResourceBundle subclass. Your subclasses must overrde two methods: handleGetObject and getKeys().

The following is a very simple example of a ResourceBundle subclass that manages only a few resources (for a larger number of resources you would probably use a Hashtable). Notice that if the key is not found, handleGetObject must return null. Notice also that you don't need to supply a value if a "parent-level" ResourceBundle handles the same key with the same value (look at uk below).

Example:

 abstract class MyResources extends ResourceBundle {
     public Object handleGetObject(String key) {
         if (key.equals("okKey")) return "Ok";
         if (key.equals("cancelKey")) return "Cancel";
        return null;
     }
 }
 abstract class MyResources_de extends MyResources {
     public Object handleGetObject(String key) {
         if (key.equals("okKey")) return "Gut";
         if (key.equals("cancelKey")) return "Vernichten";
         return null;
     }
 }
 abstract class MyResources_uk extends MyResources {
     public Object handleGetObject(String key) {
         // don't need okKey, since parent level handles it.
         if (key.equals("cancelKey")) return "Dispose";
            return null;
     }
 }
You do not have to restrict yourself to using a single family of ResourceBundles. For example, you could have a set of bundles for exception messages, ExceptionResources (ExceptionResources_fr, ExceptionResources_de, ...), and one for widgets, WidgetResource (WidgetResources_fr, WidgetResources_de, ...); breaking up the resources however you like.

See Also:
ListResourceBundle, PropertyResourceBundle, MissingResourceException


 ResourceBundle Members

ResourceBundle Members

Class Overview | This Package | All Packages

Fields
Name | Description
parent | The parent bundle is consulted by getObject when this bundle does not contain a particular resource.

Constructors
Name | Description
ResourceBundle() |

Methods
Name | Description
getBundle(String) | Get the appropriate ResourceBundle subclass.
getBundle(String, Locale) | Get the appropriate ResourceBundle subclass.
getKeys() | Return an enumeration of the keys.
getObject(String) | Get an object from a ResourceBundle.
getString(String) | Get an object from a ResourceBundle.
getStringArray(String) | Get an object from a ResourceBundle.
handleGetObject(String) | Get an object from a ResourceBundle.
setParent(ResourceBundle) | Set the parent bundle of this bundle.


 ResourceBundle.parent

ResourceBundle.parent

Syntax
protected ResourceBundle parent
Description
The parent bundle is consulted by getObject when this bundle does not contain a particular resource.


 ResourceBundle.ResourceBundle

ResourceBundle.ResourceBundle

Syntax
public ResourceBundle()


 ResourceBundle.getBundle

ResourceBundle.getBundle

Syntax 1
public static final ResourceBundle getBundle( String baseName ) throws MissingResourceException
Parameters
baseName
see class description.
Description
Get the appropriate ResourceBundle subclass.

Syntax 2
public static final ResourceBundle getBundle( String baseName, Locale locale )
Parameters
baseName
see class description.
locale
see class description.
Description
Get the appropriate ResourceBundle subclass.


 ResourceBundle.getKeys

ResourceBundle.getKeys

Syntax
public abstract Enumeration getKeys()
Description
Return an enumeration of the keys. NOTE: Subclasses must override.


 ResourceBundle.getObject

ResourceBundle.getObject

Syntax
public final Object getObject( String key ) throws MissingResourceException
Parameters
key
see class description.
Description
Get an object from a ResourceBundle.


 ResourceBundle.getString

ResourceBundle.getString

Syntax
public final String getString( String key ) throws MissingResourceException
Parameters
key
see class description.
Description
Get an object from a ResourceBundle.
Convenience method to save casting.


 ResourceBundle.getStringArray

ResourceBundle.getStringArray

Syntax
public final String[] getStringArray( String key ) throws MissingResourceException
Parameters
key
see class description.
Description
Get an object from a ResourceBundle.
Convenience method to save casting.


 ResourceBundle.handleGetObject

ResourceBundle.handleGetObject

Syntax
protected abstract Object handleGetObject( String key ) throws MissingResourceException
Parameters
key
see class description.
Description
Get an object from a ResourceBundle. NOTE: Subclasses must override.


 ResourceBundle.setParent

ResourceBundle.setParent

Syntax
protected void setParent( ResourceBundle parent )
Parameters
parent
this bundle's parent bundle.
Description
Set the parent bundle of this bundle. The parent bundle is searched by getObject when this bundle does not contain a particular resource.


 Class SimpleTimeZone

Class java.util.SimpleTimeZone

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.TimeZone
           |
           +----java.util.SimpleTimeZone

public class SimpleTimeZone
extends TimeZone

SimpleTimeZone is a concrete subclass of TimeZone that represents a time zone for use with a Gregorian calendar. This simple class does not handle historical changes, and has limited rules.

Use a negative value for dayOfWeekInMonth to indicate that SimpleTimeZone should count from the end of the month backwards. For example, Daylight Savings Time ends at the last (dayOfWeekInMonth = -1) Sunday in October, at 2 AM in standard time.

See Also:
Calendar, GregorianCalendar, TimeZone


 SimpleTimeZone Members

SimpleTimeZone Members

Class Overview | This Package | All Packages

Constructors
Name | Description
SimpleTimeZone(int, String) | Constructs a SimpleTimeZone with the given base time zone offset from GMT and time zone ID.
SimpleTimeZone(int, String, int, int, int, int, int, int, int, int) | Constructs a SimpleTimeZone with the given base time zone offset from GMT, time zone ID, time to start and end the daylight time.

Methods
Name | Description
clone() | Overrides Cloneable
equals(Object) | Compares the equality of two SimpleTimeZone objects.
getOffset(int, int, int, int, int, int) | Overrides TimeZone Gets offset, for current date, modified in case of daylight savings.
getRawOffset() | Overrides TimeZone Gets the GMT offset for this time zone.
hashCode() | Override hashCode.
inDaylightTime(Date) | Overrides TimeZone Queries if the given date is in Daylight Savings Time.
setEndRule(int, int, int, int) | Sets the daylight savings ending rule.
setRawOffset(int) | Overrides TimeZone Sets the base time zone offset to GMT.
setStartRule(int, int, int, int) | Sets the daylight savings starting rule.
setStartYear(int) | Sets the daylight savings starting year.
useDaylightTime() | Overrides TimeZone Queries if this time zone uses Daylight Savings Time.


 SimpleTimeZone.SimpleTimeZone

SimpleTimeZone.SimpleTimeZone

Syntax 1
public SimpleTimeZone( int rawOffset, String ID )
Parameters
rawOffset
the given base time zone offset to GMT.
ID
the time zone ID which is obtained from TimeZone.getAvailableIDs.
Description
Constructs a SimpleTimeZone with the given base time zone offset from GMT and time zone ID. Timezone IDs can be obtained from TimeZone.getAvailableIDs. Normally you should use TimeZone.getDefault to construct a TimeZone.

Syntax 2
public SimpleTimeZone( int rawOffset, String ID, int startMonth, int startDayOfWeekInMonth, int startDayOfWeek, int startTime, int endMonth, int endDayOfWeekInMonth, int endDayOfWeek, int endTime )
Parameters
rawOffset
the given base time zone offset to GMT.
ID
the time zone ID which is obtained from TimeZone.getAvailableIDs.
startMonth
the daylight savings starting month. Month is 0-based. eg, 0 for January.
startDayOfWeekInMonth
the daylight savings starting day-of-week-in-month. Please see the member description for an example.
startDayOfWeek
the daylight savings starting day-of-week. Please see the member description for an example.
startTime
the daylight savings starting time. Please see the member description for an example.
endMonth
the daylight savings ending month. Month is 0-based. eg, 0 for January.
endDayOfWeekInMonth
the daylight savings ending day-of-week-in-month. Please see the member description for an example.
endDayOfWeek
the daylight savings ending day-of-week. Please see the member description for an example.
endTime
the daylight savings ending time. Please see the member description for an example.
Description
Constructs a SimpleTimeZone with the given base time zone offset from GMT, time zone ID, time to start and end the daylight time. Timezone IDs can be obtained from TimeZone.getAvailableIDs. Normally you should use TimeZone.getDefault to create a TimeZone. For a time zone that does not use daylight saving time, do not use this constructor; instead you should use SimpleTimeZone(rawOffset, ID).


 SimpleTimeZone.clone

SimpleTimeZone.clone

Syntax
public Object clone()
Description
Overrides Cloneable

Overrides
clone in class TimeZone


 SimpleTimeZone.equals

SimpleTimeZone.equals

Syntax
public boolean equals( Object obj )
Parameters
obj
the SimpleTimeZone object to be compared with.
Returns
true if the given obj is the same as this SimpleTimeZone object; false otherwise.
Description
Compares the equality of two SimpleTimeZone objects.

Overrides
equals in class Object


 SimpleTimeZone.getOffset

SimpleTimeZone.getOffset

Syntax
public int getOffset( int era, int year, int month, int day, int dayOfWeek, int millis )
Description
Overrides TimeZone Gets offset, for current date, modified in case of daylight savings. This is the offset to add *to* UTC to get local time. Please see TimeZone.getOffset for descriptions on parameters.

Overrides
getOffset in class TimeZone


 SimpleTimeZone.getRawOffset

SimpleTimeZone.getRawOffset

Syntax
public int getRawOffset()
Description
Overrides TimeZone Gets the GMT offset for this time zone.

Overrides
getRawOffset in class TimeZone


 SimpleTimeZone.hashCode

SimpleTimeZone.hashCode

Syntax
public synchronized int hashCode()
Description
Override hashCode. Generates the hash code for the SimpleDateFormat object

Overrides
hashCode in class Object


 SimpleTimeZone.inDaylightTime

SimpleTimeZone.inDaylightTime

Syntax
public boolean inDaylightTime( Date date )
Description
Overrides TimeZone Queries if the given date is in Daylight Savings Time.

Overrides
inDaylightTime in class TimeZone


 SimpleTimeZone.setEndRule

SimpleTimeZone.setEndRule

Syntax
public void setEndRule( int month, int dayOfWeekInMonth, int dayOfWeek, int time )
Parameters
month
the daylight savings ending month. Month is 0-based. eg, 0 for January.
dayOfWeekInMonth
the daylight savings ending day-of-week-in-month. Please see the member description for an example.
dayOfWeek
the daylight savings ending day-of-week. Please see the member description for an example.
time
the daylight savings ending time. Please see the member description for an example.
Description
Sets the daylight savings ending rule. For example, Daylight Savings Time ends at the last (-1) Sunday in October, at 2 AM in standard time. Therefore, you can set the end rule by calling: setEndRule(TimeFields.OCTOBER, -1, TimeFields.SUNDAY, 2*60*60*1000);


 SimpleTimeZone.setRawOffset

SimpleTimeZone.setRawOffset

Syntax
public void setRawOffset( int offsetMillis )
Description
Overrides TimeZone Sets the base time zone offset to GMT. This is the offset to add *to* UTC to get local time. Please see TimeZone.setRawOffset for descriptions on the parameter.

Overrides
setRawOffset in class TimeZone


 SimpleTimeZone.setStartRule

SimpleTimeZone.setStartRule

Syntax
public void setStartRule( int month, int dayOfWeekInMonth, int dayOfWeek, int time )
Parameters
month
the daylight savings starting month. Month is 0-based. eg, 0 for January.
dayOfWeekInMonth
the daylight savings starting day-of-week-in-month. Please see the member description for an example.
dayOfWeek
the daylight savings starting day-of-week. Please see the member description for an example.
time
the daylight savings starting time. Please see the member description for an example.
Description
Sets the daylight savings starting rule. For example, Daylight Savings Time starts at the first Sunday in April, at 2 AM in standard time. Therefore, you can set the start rule by calling: setStartRule(TimeFields.APRIL, 1, TimeFields.SUNDAY, 2*60*60*1000);


 SimpleTimeZone.setStartYear

SimpleTimeZone.setStartYear

Syntax
public void setStartYear( int year )
Parameters
year
the daylight savings starting year.
Description
Sets the daylight savings starting year.


 SimpleTimeZone.useDaylightTime

SimpleTimeZone.useDaylightTime

Syntax
public boolean useDaylightTime()
Description
Overrides TimeZone Queries if this time zone uses Daylight Savings Time.

Overrides
useDaylightTime in class TimeZone


 Class Stack

Class java.util.Stack

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.Vector
           |
           +----java.util.Stack

public class Stack
extends Vector

The Stack class represents a last-in-first-out (LIFO) stack of objects.


 Stack Members

Stack Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Stack() |

Methods
Name | Description
empty() | Tests if this stack is empty.
peek() | Looks at the object at the top of this stack without removing it from the stack.
pop() | Removes the object at the top of this stack and returns that object as the value of this function.
push(Object) | Pushes an item onto the top of this stack.
search(Object) | Returns where an object is on this stack.


 Stack.Stack

Stack.Stack

Syntax
public Stack()


 Stack.empty

Stack.empty

Syntax
public boolean empty()
Returns
true if this stack is empty; false otherwise.
Description
Tests if this stack is empty.


 Stack.peek

Stack.peek

Syntax
public synchronized Object peek()
Returns
the object at the top of this stack.
Description
Looks at the object at the top of this stack without removing it from the stack.

Exceptions
EmptyStackException if this stack is empty.


 Stack.pop

Stack.pop

Syntax
public synchronized Object pop()
Returns
The object at the top of this stack.
Description
Removes the object at the top of this stack and returns that object as the value of this function.

Exceptions
EmptyStackException if this stack is empty.


 Stack.push

Stack.push

Syntax
public Object push( Object item )
Parameters
item
the item to be pushed onto this stack.
Returns
the item argument.
Description
Pushes an item onto the top of this stack.


 Stack.search

Stack.search

Syntax
public synchronized int search( Object o )
Parameters
o
the desired object.
Returns
the distance from the top of the stack where the object is] located; the return value -1 indicates that the object is not on the stack.
Description
Returns where an object is on this stack.


 Class StringTokenizer

Class java.util.StringTokenizer

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.StringTokenizer

public class StringTokenizer
extends Object
implements Enumeration

The string tokenizer class allows an application to break a string into tokens. The tokenization method is much simpler than the one used by the StreamTokenizer class. The StringTokenizer methods do not distinguish among identifiers, numbers, and quoted strings, nor do they recognize and skip comments.

The set of delimiters (the characters that separate tokens) may be specified either at creation time or on a per-token basis.

An instance of StringTokenizer behaves in one of two ways, depending on whether it was created with the returnTokens flag having the value true or false:

  • If the flag is false, delimiter characters serve to separate tokens. A token is a maximal sequence of consecutive characters that are not delimiters.
  • If the flag is true, delimiter characters are considered to be tokens. A token is either one delimiter character, or a maximal sequence of consecutive characters that are not delimiters.

The following is one example of the use of the tokenizer. The code:

     StringTokenizer st = new StringTokenizer("this is a test");
     while (st.hasMoreTokens()) {
         println(st.nextToken());
     }

prints the following output:

     this
     is
     a
     test

See Also:
StreamTokenizer


 StringTokenizer Members

StringTokenizer Members

Class Overview | This Package | All Packages

Constructors
Name | Description
StringTokenizer(String) | Constructs a string tokenizer for the specified string.
StringTokenizer(String, String) | Constructs a string tokenizer for the specified string.
StringTokenizer(String, String, boolean) | Constructs a string tokenizer for the specified string.

Methods
Name | Description
countTokens() | Calculates the number of times that this tokenizer's nextToken method can be called before it generates an exception.
hasMoreElements() | Returns the same value as the hasMoreTokens method.
hasMoreTokens() | Tests if there are more tokens available from this tokenizer's string.
nextElement() | Returns the same value as the nextToken method, except that its declared return value is Object rather than String.
nextToken() | Returns the next token from this string tokenizer.
nextToken(String) | Returns the next token in this string tokenizer's string.


 StringTokenizer.StringTokenizer

StringTokenizer.StringTokenizer

Syntax 1
public StringTokenizer( String str, String delim, boolean returnTokens )
Parameters
str
a string to be parsed.
delim
the delimiters.
returnTokens
flag indicating whether to return the delimiters as tokens.
Description
Constructs a string tokenizer for the specified string. The characters in the delim argument are the delimiters for separating tokens.

If the returnTokens flag is true, then the delimiter characters are also returned as tokens. Each delimiter is returned as a string of length one. If the flag is false, the delimiter characters are skipped and only serve as separators between tokens.

Syntax 2
public StringTokenizer( String str, String delim )
Parameters
str
a string to be parsed.
delim
the delimiters.
Description
Constructs a string tokenizer for the specified string. The characters in the delim argument are the delimiters for separating tokens.

Syntax 3
public StringTokenizer( String str )
Parameters
str
a string to be parsed.
Description
Constructs a string tokenizer for the specified string. The tokenizer uses the default delimiter set, which is "\t\n\r": the space character, the tab character, the newline character, and the carriage-return character.


 StringTokenizer.countTokens

StringTokenizer.countTokens

Syntax
public int countTokens()
Returns
the number of tokens remaining in the string using the current delimiter set.
Description
Calculates the number of times that this tokenizer's nextToken method can be called before it generates an exception.

See Also
nextToken


 StringTokenizer.hasMoreElements

StringTokenizer.hasMoreElements

Syntax
public boolean hasMoreElements()
Returns
true if there are more tokens; false otherwise.
Description
Returns the same value as the hasMoreTokens method. It exists so that this class can implement the Enumeration interface.

See Also
Enumeration, hasMoreTokens


 StringTokenizer.hasMoreTokens

StringTokenizer.hasMoreTokens

Syntax
public boolean hasMoreTokens()
Returns
true if there are more tokens available from this tokenizer's string; false otherwise.
Description
Tests if there are more tokens available from this tokenizer's string.


 StringTokenizer.nextElement

StringTokenizer.nextElement

Syntax
public Object nextElement()
Returns
the next token in the string.
Description
Returns the same value as the nextToken method, except that its declared return value is Object rather than String. It exists so that this class can implement the Enumeration interface.

Exceptions
NoSuchElementException if there are no more tokens in this tokenizer's string.
See Also
Enumeration, nextToken


 StringTokenizer.nextToken

StringTokenizer.nextToken

Syntax 1
public String nextToken()
Returns
the next token from this string tokenizer.
Description
Returns the next token from this string tokenizer.

Exceptions
NoSuchElementException if there are no more tokens in this tokenizer's string.

Syntax 2
public String nextToken( String delim )
Parameters
delim
the new delimiters.
Returns
the next token, after switching to the new delimiter set.
Description
Returns the next token in this string tokenizer's string. The new delimiter set remains the default after this call.

Exceptions
NoSuchElementException if there are no more tokens in this tokenizer's string.


 Class TimeZone

Class java.util.TimeZone

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.TimeZone

public abstract class TimeZone
extends Object
implements Serializable, Cloneable

TimeZone represents a time zone offset, and also figures out daylight savings.

Typically, you get a TimeZone using getDefault which creates a TimeZone based on the time zone where the program is running. For example, for a program running in Japan, getDefault creates a TimeZone object based on Japanese Standard Time.

You can also get a TimeZone using getTimeZone along with a time zone ID. For instance, the time zone ID for the Pacific Standard Time zone is "PST". So, you can get a PST TimeZone object with:

 TimeZone tz = TimeZone.getTimeZone("PST");
You can use getAvailableIDs method to iterate through all the supported time zone IDs. You can then choose a supported ID to get a favorite TimeZone.

See Also:
Calendar, GregorianCalendar, SimpleTimeZone


 TimeZone Members

TimeZone Members

Class Overview | This Package | All Packages

Constructors
Name | Description
TimeZone() |

Methods
Name | Description
clone() | Overrides Cloneable
getAvailableIDs() | Gets all the available IDs supported.
getAvailableIDs(int) | Gets the available IDs according to the given time zone offset.
getDefault() | Gets the default TimeZone for this host.
getID() | Gets the ID of this time zone.
getOffset(int, int, int, int, int, int) | Gets the time zone offset, for current date, modified in case of daylight savings.
getRawOffset() | Gets unmodified offset, NOT modified in case of daylight savings.
getTimeZone(String) | Gets the TimeZone for the given ID.
inDaylightTime(Date) | Queries if the given date is in Daylight Savings Time in this time zone.
setDefault(TimeZone) | Sets time zone to using the given TimeZone.
setID(String) | Sets the time zone ID.
setRawOffset(int) | Sets the base time zone offset to GMT.
useDaylightTime() | Queries if this time zone uses Daylight Savings Time.


 TimeZone.TimeZone

TimeZone.TimeZone

Syntax
public TimeZone()


 TimeZone.clone

TimeZone.clone

Syntax
public Object clone()
Description
Overrides Cloneable

Overrides
clone in class Object


 TimeZone.getAvailableIDs

TimeZone.getAvailableIDs

Syntax 1
public static synchronized String[] getAvailableIDs( int rawOffset )
Parameters
rawOffset
the given time zone GMT offset.
Returns
an array of IDs, where the time zone for that ID has the specified GMT offset. For example, {"Phoenix", "Denver"}, since both have GMT-07:00, but differ in daylight savings behavior.
Description
Gets the available IDs according to the given time zone offset.

Syntax 2
public static synchronized String[] getAvailableIDs()
Returns
an array of IDs.
Description
Gets all the available IDs supported.


 TimeZone.getDefault

TimeZone.getDefault

Syntax
public static synchronized TimeZone getDefault()
Returns
a default TimeZone.
Description
Gets the default TimeZone for this host.


 TimeZone.getID

TimeZone.getID

Syntax
public String getID()
Returns
the ID of this time zone.
Description
Gets the ID of this time zone.


 TimeZone.getOffset

TimeZone.getOffset

Syntax
public abstract int getOffset( int era, int year, int month, int day, int dayOfWeek, int milliseconds )
Parameters
era
the era of the given date.
year
the year in the given date.
month
the month in the given date. Month is 0-based. e.g., 0 for January.
day
the day-in-month of the given date.
dayOfWeek
the day-of-week of the given date.
milliseconds
the millis in day.
Returns
the offset to add *to* GMT to get local time.
Description
Gets the time zone offset, for current date, modified in case of daylight savings. This is the offset to add *to* UTC to get local time.


 TimeZone.getRawOffset

TimeZone.getRawOffset

Syntax
public abstract int getRawOffset()
Returns
the unmodified offset to add *to* UTC to get local time.
Description
Gets unmodified offset, NOT modified in case of daylight savings. This is the offset to add *to* UTC to get local time.


 TimeZone.getTimeZone

TimeZone.getTimeZone

Syntax
public static synchronized TimeZone getTimeZone( String ID )
Parameters
ID
the given ID.
Returns
a TimeZone.
Description
Gets the TimeZone for the given ID.


 TimeZone.inDaylightTime

TimeZone.inDaylightTime

Syntax
public abstract boolean inDaylightTime( Date date )
Parameters
date
the given Date.
Returns
true if the given date is in Daylight Savings Time, false, otherwise.
Description
Queries if the given date is in Daylight Savings Time in this time zone.


 TimeZone.setDefault

TimeZone.setDefault

Syntax
public static synchronized void setDefault( TimeZone zone )
Parameters
zone
the given time zone.
Description
Sets time zone to using the given TimeZone.


 TimeZone.setID

TimeZone.setID

Syntax
public void setID( String ID )
Parameters
ID
the new time zone ID.
Description
Sets the time zone ID. This does not change any other data in the time zone object.


 TimeZone.setRawOffset

TimeZone.setRawOffset

Syntax
public abstract void setRawOffset( int offsetMillis )
Parameters
offsetMillis
the given base time zone offset to GMT.
Description
Sets the base time zone offset to GMT. This is the offset to add *to* UTC to get local time.


 TimeZone.useDaylightTime

TimeZone.useDaylightTime

Syntax
public abstract boolean useDaylightTime()
Returns
true if this time zone uses Daylight Savings Time, false, otherwise.
Description
Queries if this time zone uses Daylight Savings Time.


 Class TooManyListenersException

Class java.util.TooManyListenersException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.util.TooManyListenersException

public class TooManyListenersException
extends Exception

The TooManyListenersException Exception is used as part of the Java Event model to annotate and implement a unicast special case of a multicast Event Source.

The presence of a throws TooManyListenersException clause on any given concrete implementation of the normally multicast semantic void add < EventListenerType > () event listener registration pattern is used to annotate that interface as implementing a unicast Listener special case, that is, that one and only one Listener may be registered on the particular event listener source concurrently.

See Also:
EventObject, EventListener


 TooManyListenersException Members

TooManyListenersException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
TooManyListenersException() | Constructs a TooManyListenersException with no detail message.
TooManyListenersException(String) | Constructs a TooManyListenersException with the specified detail message.


 TooManyListenersException.TooManyListenersException

TooManyListenersException.TooManyListenersException

Syntax 1
public TooManyListenersException()
Description
Constructs a TooManyListenersException with no detail message. A detail message is a String that describes this particular exception.

Syntax 2
public TooManyListenersException( String s )
Parameters
s
the detail message
Description
Constructs a TooManyListenersException with the specified detail message. A detail message is a String that describes this particular exception.


 Class Vector

Class java.util.Vector

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.Vector

public class Vector
extends Object
implements Cloneable, Serializable

The Vector class implements a growable array of objects. Like an array, it contains components that can be accessed using an integer index. However, the size of a Vector can grow or shrink as needed to accommodate adding and removing items after the Vector has been created.

Each vector tries to optimize storage management by maintaining a capacity and a capacityIncrement. The capacity is always at least as large as the vector size; it is usually larger because as components are added to the vector, the vector's storage increases in chunks the size of capacityIncrement. An application can increase the capacity of a vector before inserting a large number of components; this reduces the amount of incremental reallocation.


 Vector Members

Vector Members

Class Overview | This Package | All Packages

Fields
Name | Description
capacityIncrement | The amount by which the capacity of the vector is automatically incremented when its size becomes greater than its capacity.
elementCount | The number of valid components in the vector.
elementData | The array buffer into which the components of the vector are stored.

Constructors
Name | Description
Vector() | Constructs an empty vector.
Vector(int) | Constructs an empty vector with the specified initial capacity.
Vector(int, int) | Constructs an empty vector with the specified initial capacity and capacity increment.

Methods
Name | Description
addElement(Object) | Adds the specified component to the end of this vector, increasing its size by one.
capacity() | Returns the current capacity of this vector.
clone() | Returns a clone of this vector.
contains(Object) | Tests if the specified object is a component in this vector.
copyInto(Object[]) | Copies the components of this vector into the specified array.
elementAt(int) | Returns the component at the specified index.
elements() | Returns an enumeration of the components of this vector.
ensureCapacity(int) | Increases the capacity of this vector, if necessary, to ensure that it can hold at least the number of components specified by the minimum capacity argument.
firstElement() | Returns the first component of this vector.
indexOf(Object) | Searches for the first occurence of the given argument, testing for equality using the equals method.
indexOf(Object, int) | Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method.
insertElementAt(Object, int) | Inserts the specified object as a component in this vector at the specified index.
isEmpty() | Tests if this vector has no components.
lastElement() | Returns the last component of the vector.
lastIndexOf(Object) | Returns the index of the last occurrence of the specified object in this vector.
lastIndexOf(Object, int) | Searches backwards for the specified object, starting from the specified index, and returns an index to it.
removeAllElements() | Removes all components from this vector and sets its size to zero.
removeElement(Object) | Removes the first occurrence of the argument from this vector.
removeElementAt(int) | Deletes the component at the specified index.
setElementAt(Object, int) | Sets the component at the specified index of this vector to be the specified object.
setSize(int) | Sets the size of this vector.
size() | Returns the number of components in this vector.
toString() | Returns a string representation of this vector.
trimToSize() | Trims the capacity of this vector to be the vector's current size.


 Vector.capacityIncrement

Vector.capacityIncrement

Syntax
protected int capacityIncrement
Description
The amount by which the capacity of the vector is automatically incremented when its size becomes greater than its capacity. If the capacity is 0, the capacity of the vector is doubled each time it needs to grow.


 Vector.elementCount

Vector.elementCount

Syntax
protected int elementCount
Description
The number of valid components in the vector.


 Vector.elementData

Vector.elementData

Syntax
protected Object elementData[]
Description
The array buffer into which the components of the vector are stored. The capacity of the vector is the length of this array buffer.


 Vector.Vector

Vector.Vector

Syntax 1
public Vector( int initialCapacity, int capacityIncrement )
Parameters
initialCapacity
the initial capacity of the vector.
capacityIncrement
the amount by which the capacity is increased when the vector overflows.
Description
Constructs an empty vector with the specified initial capacity and capacity increment.

Syntax 2
public Vector( int initialCapacity )
Parameters
initialCapacity
the initial capacity of the vector.
Description
Constructs an empty vector with the specified initial capacity.

Syntax 3
public Vector()
Description
Constructs an empty vector.


 Vector.addElement

Vector.addElement

Syntax
public final synchronized void addElement( Object obj )
Parameters
obj
the component to be added.
Description
Adds the specified component to the end of this vector, increasing its size by one. The capacity of this vector is increased if its size becomes greater than its capacity.


 Vector.capacity

Vector.capacity

Syntax
public final int capacity()
Returns
the current capacity of this vector.
Description
Returns the current capacity of this vector.


 Vector.clone

Vector.clone

Syntax
public synchronized Object clone()
Returns
a clone of this vector.
Description
Returns a clone of this vector.

Overrides
clone in class Object


 Vector.contains

Vector.contains

Syntax
public final boolean contains( Object elem )
Parameters
elem
an object.
Returns
true if the specified object is a component in this vector; false otherwise.
Description
Tests if the specified object is a component in this vector.


 Vector.copyInto

Vector.copyInto

Syntax
public final synchronized void copyInto( Object anArray[] )
Parameters
anArray
the array into which the components get copied.
Description
Copies the components of this vector into the specified array. The array must be big enough to hold all the objects in this vector.


 Vector.elementAt

Vector.elementAt

Syntax
public final synchronized Object elementAt( int index )
Parameters
index
an index into this vector.
Returns
the component at the specified index.
Description
Returns the component at the specified index.

Exceptions
ArrayIndexOutOfBoundsException if an invalid index was given.


 Vector.elements

Vector.elements

Syntax
public final synchronized Enumeration elements()
Returns
an enumeration of the components of this vector.
Description
Returns an enumeration of the components of this vector.

See Also
Enumeration


 Vector.ensureCapacity

Vector.ensureCapacity

Syntax
public final synchronized void ensureCapacity( int minCapacity )
Parameters
minCapacity
the desired minimum capacity.
Description
Increases the capacity of this vector, if necessary, to ensure that it can hold at least the number of components specified by the minimum capacity argument.


 Vector.firstElement

Vector.firstElement

Syntax
public final synchronized Object firstElement()
Returns
the first component of this vector.
Description
Returns the first component of this vector.

Exceptions
NoSuchElementException if this vector has no components.


 Vector.indexOf

Vector.indexOf

Syntax 1
public final int indexOf( Object elem )
Parameters
elem
an object.
Returns
the index of the first occurrence of the argument in this vector; returns -1 if the object is not found.
Description
Searches for the first occurence of the given argument, testing for equality using the equals method.

See Also
equals

Syntax 2
public final synchronized int indexOf( Object elem, int index )
Parameters
elem
an object.
index
the index to start searching from.
Returns
the index of the first occurrence of the object argument in this vector at position index or later in the vector; returns -1 if the object is not found.
Description
Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method.

See Also
equals


 Vector.insertElementAt

Vector.insertElementAt

Syntax
public final synchronized void insertElementAt( Object obj, int index )
Parameters
obj
the component to insert.
index
where to insert the new component.
Description
Inserts the specified object as a component in this vector at the specified index. Each component in this vector with an index greater or equal to the specified index is shifted upward to have an index one greater than the value it had previously.

The index must be a value greater than or equal to 0 and less than or equal to the current size of the vector.

Exceptions
ArrayIndexOutOfBoundsException if the index was invalid.
See Also
size


 Vector.isEmpty

Vector.isEmpty

Syntax
public final boolean isEmpty()
Returns
true if this vector has no components; false otherwise.
Description
Tests if this vector has no components.


 Vector.lastElement

Vector.lastElement

Syntax
public final synchronized Object lastElement()
Returns
the last component of the vector, i.e., the component at index size() - 1.
Description
Returns the last component of the vector.

Exceptions
NoSuchElementException if this vector is empty.


 Vector.lastIndexOf

Vector.lastIndexOf

Syntax 1
public final int lastIndexOf( Object elem )
Parameters
elem
the desired component.
Returns
the index of the last occurrence of the specified object in this vector; returns -1 if the object is not found.
Description
Returns the index of the last occurrence of the specified object in this vector.

Syntax 2
public final synchronized int lastIndexOf( Object elem, int index )
Parameters
elem
the desired component.
index
the index to start searching from.
Returns
the index of the last occurrence of the specified object in this vector at position less than index in the vector; -1 if the object is not found.
Description
Searches backwards for the specified object, starting from the specified index, and returns an index to it.


 Vector.removeAllElements

Vector.removeAllElements

Syntax
public final synchronized void removeAllElements()
Description
Removes all components from this vector and sets its size to zero.


 Vector.removeElement

Vector.removeElement

Syntax
public final synchronized boolean removeElement( Object obj )
Parameters
obj
the component to be removed.
Returns
true if the argument was a component of this vector; false otherwise.
Description
Removes the first occurrence of the argument from this vector. If the object is found in this vector, each component in the vector with an index greater or equal to the object's index is shifted downward to have an index one smaller than the value it had previously.


 Vector.removeElementAt

Vector.removeElementAt

Syntax
public final synchronized void removeElementAt( int index )
Parameters
index
the index of the object to remove.
Description
Deletes the component at the specified index. Each component in this vector with an index greater or equal to the specified index is shifted downward to have an index one smaller than the value it had previously.

The index must be a value greater than or equal to 0 and less than the current size of the vector.

Exceptions
ArrayIndexOutOfBoundsException if the index was invalid.
See Also
size


 Vector.setElementAt

Vector.setElementAt

Syntax
public final synchronized void setElementAt( Object obj, int index )
Parameters
obj
what the component is to be set to.
index
the specified index.
Description
Sets the component at the specified index of this vector to be the specified object. The previous component at that position is discarded.

The index must be a value greater than or equal to 0 and less than the current size of the vector.

Exceptions
ArrayIndexOutOfBoundsException if the index was invalid.
See Also
size


 Vector.setSize

Vector.setSize

Syntax
public final synchronized void setSize( int newSize )
Parameters
newSize
the new size of this vector.
Description
Sets the size of this vector. If the new size is greater than the current size, new null items are added to the end of the vector. If the new size is less than the current size, all components at index newSize and greater are discarded.


 Vector.size

Vector.size

Syntax
public final int size()
Returns
the number of components in this vector.
Description
Returns the number of components in this vector.


 Vector.toString

Vector.toString

Syntax
public final synchronized String toString()
Returns
a string representation of this vector.
Description
Returns a string representation of this vector.

Overrides
toString in class Object


 Vector.trimToSize

Vector.trimToSize

Syntax
public final synchronized void trimToSize()
Description
Trims the capacity of this vector to be the vector's current size. An application can use this operation to minimize the storage of a vector.


 Package java.util.zip

Package java.util.zip

All Packages

Interfaces

  • Checksum

    • Classes

  • Adler32
  • CRC32
  • CheckedInputStream
  • CheckedOutputStream
  • Deflater
  • DeflaterOutputStream
  • GZIPInputStream
  • GZIPOutputStream
  • Inflater
  • InflaterInputStream
  • ZipEntry
  • ZipFile
  • ZipInputStream
  • ZipOutputStream

    • Exceptions

  • DataFormatException
  • ZipException


 Class Adler32

Class java.util.zip.Adler32

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.zip.Adler32

public class Adler32
extends Object
implements Checksum

A class that can be used to compute the Adler-32 checksum of a data stream. An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed much faster.

See Also:
Checksum


 Adler32 Members

Adler32 Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Adler32() |

Methods
Name | Description
getValue() | Returns checksum value.
reset() | Resets checksum to initial value.
update(byte[]) | Updates checksum with specified array of bytes.
update(byte[], int, int) | Updates checksum with specified array of bytes.
update(int) | Updates checksum with specified byte.


 Adler32.Adler32

Adler32.Adler32

Syntax
public Adler32()


 Adler32.getValue

Adler32.getValue

Syntax
public long getValue()
Description
Returns checksum value.


 Adler32.reset

Adler32.reset

Syntax
public void reset()
Description
Resets checksum to initial value.


 Adler32.update

Adler32.update

Syntax 1
public void update( int b )
Description
Updates checksum with specified byte.

Syntax 2
public native void update( byte b[], int off, int len )
Description
Updates checksum with specified array of bytes.

Syntax 3
public void update( byte b[] )
Description
Updates checksum with specified array of bytes.


 Class CRC32

Class java.util.zip.CRC32

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.zip.CRC32

public class CRC32
extends Object
implements Checksum

A class that can be used to compute the CRC-32 of a data stream.

See Also:
Checksum


 CRC32 Members

CRC32 Members

Class Overview | This Package | All Packages

Constructors
Name | Description
CRC32() |

Methods
Name | Description
getValue() | Returns CRC-32 value.
reset() | Resets CRC-32 to initial value.
update(byte[]) | Updates CRC-32 with specified array of bytes.
update(byte[], int, int) | Updates CRC-32 with specified array of bytes.
update(int) | Updates CRC-32 with specified byte.


 CRC32.CRC32

CRC32.CRC32

Syntax
public CRC32()


 CRC32.getValue

CRC32.getValue

Syntax
public long getValue()
Description
Returns CRC-32 value.


 CRC32.reset

CRC32.reset

Syntax
public void reset()
Description
Resets CRC-32 to initial value.


 CRC32.update

CRC32.update

Syntax 1
public void update( int b )
Description
Updates CRC-32 with specified byte.

Syntax 2
public native void update( byte b[], int off, int len )
Description
Updates CRC-32 with specified array of bytes.

Syntax 3
public void update( byte b[] )
Description
Updates CRC-32 with specified array of bytes.


 Class CheckedInputStream

Class java.util.zip.CheckedInputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.FilterInputStream
                   |
                   +----java.util.zip.CheckedInputStream

public class CheckedInputStream
extends FilterInputStream

An input stream that also maintains a checksum of the data being read. The checksum can then be used to verify the integrity of the input data.

See Also:
Checksum


 CheckedInputStream Members

CheckedInputStream Members

Class Overview | This Package | All Packages

Constructors
Name | Description
CheckedInputStream(InputStream, Checksum) | Creates an input stream using the specified Checksum.

Methods
Name | Description
getChecksum() | Returns the Checksum for this input stream.
read() | Reads a byte.
read(byte[], int, int) | Reads into an array of bytes.
skip(long) | Skips specified number of bytes of input.


 CheckedInputStream.CheckedInputStream

CheckedInputStream.CheckedInputStream

Syntax
public CheckedInputStream( InputStream in, Checksum cksum )
Parameters
in
the input stream
cksum
the Checksum
Description
Creates an input stream using the specified Checksum.


 CheckedInputStream.getChecksum

CheckedInputStream.getChecksum

Syntax
public Checksum getChecksum()
Description
Returns the Checksum for this input stream.


 CheckedInputStream.read

CheckedInputStream.read

Syntax 1
public int read() throws IOException
Returns
the byte read, or -1 if the end of the stream is reached.
Description
Reads a byte. Will block if no input is available.

Exceptions
IOException if an I/O error has occurred
Overrides
read in class FilterInputStream

Syntax 2
public int read( byte buf[], int off, int len ) throws IOException
Parameters
buf
the buffer into which the data is read
off
the start offset of the data
len
the maximum number of bytes read
Returns
the actual number of bytes read, or -1 if the end of the stream is reached.
Description
Reads into an array of bytes. Will block until some input is available.

Exceptions
IOException if an I/O error has occurred
Overrides
read in class FilterInputStream


 CheckedInputStream.skip

CheckedInputStream.skip

Syntax
public long skip( long n ) throws IOException
Parameters
n
the number of bytes to skip
Returns
the actual number of bytes skipped
Description
Skips specified number of bytes of input.

Exceptions
IOException if an I/O error has occurred
Overrides
skip in class FilterInputStream


 Class CheckedOutputStream

Class java.util.zip.CheckedOutputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----java.io.FilterOutputStream
                   |
                   +----java.util.zip.CheckedOutputStream

public class CheckedOutputStream
extends FilterOutputStream

An output stream that also maintains a checksum of the data being written. The checksum can then be used to verify the integrity of the output data.

See Also:
Checksum


 CheckedOutputStream Members

CheckedOutputStream Members

Class Overview | This Package | All Packages

Constructors
Name | Description
CheckedOutputStream(OutputStream, Checksum) | Creates an output stream with the specified Checksum.

Methods
Name | Description
getChecksum() | Returns the Checksum for this output stream.
write(byte[], int, int) | Writes an array of bytes.
write(int) | Writes a byte.


 CheckedOutputStream.CheckedOutputStream

CheckedOutputStream.CheckedOutputStream

Syntax
public CheckedOutputStream( OutputStream out, Checksum cksum )
Parameters
out
the output stream
cksum
the checksum
Description
Creates an output stream with the specified Checksum.


 CheckedOutputStream.getChecksum

CheckedOutputStream.getChecksum

Syntax
public Checksum getChecksum()
Description
Returns the Checksum for this output stream.


 CheckedOutputStream.write

CheckedOutputStream.write

Syntax 1
public void write( int b ) throws IOException
Parameters
b
the byte to be written
Description
Writes a byte. Will block until the byte is actually written.

Exceptions
IOException if an I/O error has occurred
Overrides
write in class FilterOutputStream

Syntax 2
public void write( byte b[], int off, int len ) throws IOException
Parameters
buf
the data to be written
off
the start offset of the data
len
the number of bytes to be written
Description
Writes an array of bytes. Will block until the bytes are actually written.

Exceptions
IOException if an I/O error has occurred
Overrides
write in class FilterOutputStream


 Interface Checksum

Interface java.util.zip.Checksum

Interface Members | This Package | All Packages

public interface Checksum

An interface representing a data checksum.


 Checksum Members

Checksum Members

Interface Overview | This Package | All Packages

Methods
Name | Description
getValue() | Returns the current checksum value.
reset() | Resets the checksum to its initial value.
update(byte[], int, int) | Updates the current checksum with the specified array of bytes.
update(int) | Updates the current checksum with the specified byte.


 Checksum.getValue

Checksum.getValue

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract long getValue()
Description
Returns the current checksum value.


 Checksum.reset

Checksum.reset

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract void reset()
Description
Resets the checksum to its initial value.


 Checksum.update

Checksum.update

Interface Overview | Interface Members | This Package | All Packages

Syntax 1
public abstract void update( int b )
Description
Updates the current checksum with the specified byte.

Syntax 2
public abstract void update( byte b[], int off, int len )
Description
Updates the current checksum with the specified array of bytes.


 Class DataFormatException

Class java.util.zip.DataFormatException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.util.zip.DataFormatException

public class DataFormatException
extends Exception

Signals that a data format error has occurred.


 DataFormatException Members

DataFormatException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
DataFormatException() | Constructs a DataFormatException with no detail message.
DataFormatException(String) | Constructs a DataFormatException with the specified detail message.


 DataFormatException.DataFormatException

DataFormatException.DataFormatException

Syntax 1
public DataFormatException()
Description
Constructs a DataFormatException with no detail message.

Syntax 2
public DataFormatException( String s )
Parameters
s
the String containing a detail message
Description
Constructs a DataFormatException with the specified detail message. A detail message is a String that describes this particular exception.


 Class Deflater

Class java.util.zip.Deflater

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.zip.Deflater

public class Deflater
extends Object

This class provides support for general purpose decompression using the popular ZLIB compression library. The ZLIB compression library was initially developed as part of the PNG graphics standard and is not protected by patents. It is fully described in RFCs 1950, 1951, and 1952, which can be found at ftp://ds.internic.net/rfc in the files rfc1950.txt (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).

See Also:
Inflater


 Deflater Members

Deflater Members

Class Overview | This Package | All Packages

Fields
Name | Description
BEST_COMPRESSION | Compression level for best compression.
BEST_SPEED | Compression level for fastest compression.
DEFAULT_COMPRESSION | Default compression level.
DEFAULT_STRATEGY | Default compression strategy.
DEFLATED | Compression method for the deflate algorithm (the only one currently supported).
FILTERED | Compression strategy best used for data consisting mostly of small values with a somewhat random distribution.
HUFFMAN_ONLY | Compression strategy for Huffman coding only.
NO_COMPRESSION | Compression level for no compression.

Constructors
Name | Description
Deflater() | Creates a new compressor with the default compression level.
Deflater(int) | Creates a new compressor using the specified compression level.
Deflater(int, boolean) | Creates a new compressor using the specified compression level.

Methods
Name | Description
deflate(byte[]) | Fills specified buffer with compressed data.
deflate(byte[], int, int) | Fills specified buffer with compressed data.
end() | Discards unprocessed input and frees internal data.
finalize() | Frees the compressor when garbage is collected.
finish() | When called, indicates that compression should end with the current contents of the input buffer.
finished() | Returns true if the end of the compressed data output stream has been reached.
getAdler() | Returns the ADLER-32 value of the uncompressed data.
getTotalIn() | Returns the total number of bytes input so far.
getTotalOut() | Returns the total number of bytes output so far.
needsInput() | Returns true if the input data buffer is empty and setInput() should be called in order to provide more input.
reset() | Resets deflater so that a new set of input data can be processed.
setDictionary(byte[]) | Sets preset dictionary for compression.
setDictionary(byte[], int, int) | Sets preset dictionary for compression.
setInput(byte[]) | Sets input data for compression.
setInput(byte[], int, int) | Sets input data for compression.
setLevel(int) | Sets the current compression level to the specified value.
setStrategy(int) | Sets the compression strategy to the specified value.


 Deflater.BEST_COMPRESSION

Deflater.BEST_COMPRESSION

Syntax
public static final int BEST_COMPRESSION
Description
Compression level for best compression.


 Deflater.BEST_SPEED

Deflater.BEST_SPEED

Syntax
public static final int BEST_SPEED
Description
Compression level for fastest compression.


 Deflater.DEFAULT_COMPRESSION

Deflater.DEFAULT_COMPRESSION

Syntax
public static final int DEFAULT_COMPRESSION
Description
Default compression level.


 Deflater.DEFAULT_STRATEGY

Deflater.DEFAULT_STRATEGY

Syntax
public static final int DEFAULT_STRATEGY
Description
Default compression strategy.


 Deflater.DEFLATED

Deflater.DEFLATED

Syntax
public static final int DEFLATED
Description
Compression method for the deflate algorithm (the only one currently supported).


 Deflater.FILTERED

Deflater.FILTERED

Syntax
public static final int FILTERED
Description
Compression strategy best used for data consisting mostly of small values with a somewhat random distribution. Forces more Huffman coding and less string matching.


 Deflater.HUFFMAN_ONLY

Deflater.HUFFMAN_ONLY

Syntax
public static final int HUFFMAN_ONLY
Description
Compression strategy for Huffman coding only.


 Deflater.NO_COMPRESSION

Deflater.NO_COMPRESSION

Syntax
public static final int NO_COMPRESSION
Description
Compression level for no compression.


 Deflater.Deflater

Deflater.Deflater

Syntax 1
public Deflater( int level, boolean nowrap )
Parameters
level
the compression level (0-9)
nowrap
if true then use GZIP compatible compression
Description
Creates a new compressor using the specified compression level. If 'nowrap' is true then the ZLIB header and checksum fields will not be used in order to support the compression format used in both GZIP and PKZIP.

Syntax 2
public Deflater( int level )
Parameters
level
the compression level (0-9)
Description
Creates a new compressor using the specified compression level. Compressed data will be generated in ZLIB format.

Syntax 3
public Deflater()
Description
Creates a new compressor with the default compression level. Compressed data will be generated in ZLIB format.


 Deflater.deflate

Deflater.deflate

Syntax 1
public native synchronized int deflate( byte b[], int off, int len )
Parameters
b
the buffer for the compressed data
off
the start offset of the data
len
the maximum number of bytes of compressed data
Returns
the actual number of bytes of compressed data
Description
Fills specified buffer with compressed data. Returns actual number of bytes of compressed data. A return value of 0 indicates that needsInput() should be called in order to determine if more input data is required.

Syntax 2
public int deflate( byte b[] )
Parameters
b
the buffer for the compressed data
Returns
the actual number of bytes of compressed data
Description
Fills specified buffer with compressed data. Returns actual number of bytes of compressed data. A return value of 0 indicates that needsInput() should be called in order to determine if more input data is required.


 Deflater.end

Deflater.end

Syntax
public native synchronized void end()
Description
Discards unprocessed input and frees internal data.


 Deflater.finalize

Deflater.finalize

Syntax
protected void finalize()
Description
Frees the compressor when garbage is collected.

Overrides
finalize in class Object


 Deflater.finish

Deflater.finish

Syntax
public synchronized void finish()
Description
When called, indicates that compression should end with the current contents of the input buffer.


 Deflater.finished

Deflater.finished

Syntax
public synchronized boolean finished()
Description
Returns true if the end of the compressed data output stream has been reached.


 Deflater.getAdler

Deflater.getAdler

Syntax
public native synchronized int getAdler()
Description
Returns the ADLER-32 value of the uncompressed data.


 Deflater.getTotalIn

Deflater.getTotalIn

Syntax
public native synchronized int getTotalIn()
Description
Returns the total number of bytes input so far.


 Deflater.getTotalOut

Deflater.getTotalOut

Syntax
public native synchronized int getTotalOut()
Description
Returns the total number of bytes output so far.


 Deflater.needsInput

Deflater.needsInput

Syntax
public boolean needsInput()
Description
Returns true if the input data buffer is empty and setInput() should be called in order to provide more input.


 Deflater.reset

Deflater.reset

Syntax
public native synchronized void reset()
Description
Resets deflater so that a new set of input data can be processed. Keeps current compression level and strategy settings.


 Deflater.setDictionary

Deflater.setDictionary

Syntax 1
public native synchronized void setDictionary( byte b[], int off, int len )
Parameters
b
the dictionary data bytes
off
the start offset of the data
len
the length of the data
Description
Sets preset dictionary for compression. A preset dictionary is used when the history buffer can be predetermined. When the data is later uncompressed with Inflater.inflate(), Inflater.getAdler() can be called in order to get the Adler-32 value of the dictionary required for decompression.

See Also
inflate, getAdler

Syntax 2
public void setDictionary( byte b[] )
Parameters
b
the dictionary data bytes
Description
Sets preset dictionary for compression. A preset dictionary is used when the history buffer can be predetermined. When the data is later uncompressed with Inflater.inflate(), Inflater.getAdler() can be called in order to get the Adler-32 value of the dictionary required for decompression.

See Also
inflate, getAdler


 Deflater.setInput

Deflater.setInput

Syntax 1
public synchronized void setInput( byte b[], int off, int len )
Parameters
b
the input data bytes
off
the start offset of the data
len
the length of the data
Description
Sets input data for compression. This should be called whenever needsInput() returns true indicating that more input data is required.

See Also
needsInput

Syntax 2
public void setInput( byte b[] )
Parameters
b
the input data bytes
Description
Sets input data for compression. This should be called whenever needsInput() returns true indicating that more input data is required.

See Also
needsInput


 Deflater.setLevel

Deflater.setLevel

Syntax
public synchronized void setLevel( int Level )
Parameters
level
the new compression level (0-9)
Description
Sets the current compression level to the specified value.

Exceptions
IllegalArgumentException if the compression level is invalid


 Deflater.setStrategy

Deflater.setStrategy

Syntax
public synchronized void setStrategy( int strategy )
Parameters
strategy
the new compression strategy
Description
Sets the compression strategy to the specified value.

Exceptions
IllegalArgumentException if the compression strategy is invalid


 Class DeflaterOutputStream

Class java.util.zip.DeflaterOutputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----java.io.FilterOutputStream
                   |
                   +----java.util.zip.DeflaterOutputStream

public class DeflaterOutputStream
extends FilterOutputStream

This class implements an output stream filter for compressing data in the "deflate" compression format. It is also used as the basis for other types of compression filters, such as GZIPOutputStream.

See Also:
Deflater


 DeflaterOutputStream Members

DeflaterOutputStream Members

Class Overview | This Package | All Packages

Fields
Name | Description
buf | Output buffer for writing compressed data.
def | Compressor for this stream.

Constructors
Name | Description
DeflaterOutputStream(OutputStream) | Creates a new output stream with a defaul compressor and buffer size.
DeflaterOutputStream(OutputStream, Deflater) | Creates a new output stream with the specified compressor and a default buffer size.
DeflaterOutputStream(OutputStream, Deflater, int) | Creates a new output stream with the specified compressor and buffer size.

Methods
Name | Description
close() | Writes remaining compressed data to the output stream and closes the underlying stream.
deflate() | Writes next block of compressed data to the output stream.
finish() | Finishes writing compressed data to the output stream without closing the underlying stream.
write(byte[], int, int) | Writes an array of bytes to the compressed output stream.
write(int) | Writes a byte to the compressed output stream.


 DeflaterOutputStream.buf

DeflaterOutputStream.buf

Syntax
protected byte buf[]
Description
Output buffer for writing compressed data.


 DeflaterOutputStream.def

DeflaterOutputStream.def

Syntax
protected Deflater def
Description
Compressor for this stream.


 DeflaterOutputStream.DeflaterOutputStream

DeflaterOutputStream.DeflaterOutputStream

Syntax 1
public DeflaterOutputStream( OutputStream out, Deflater def, int size )
Parameters
out
the output stream
def
the compressor ("deflater")
len
the output buffer size
Description
Creates a new output stream with the specified compressor and buffer size.

Syntax 2
public DeflaterOutputStream( OutputStream out, Deflater def )
Parameters
out
the output stream
def
the compressor ("deflater")
Description
Creates a new output stream with the specified compressor and a default buffer size.

Syntax 3
public DeflaterOutputStream( OutputStream out )
Description
Creates a new output stream with a defaul compressor and buffer size.


 DeflaterOutputStream.close

DeflaterOutputStream.close

Syntax
public void close() throws IOException
Description
Writes remaining compressed data to the output stream and closes the underlying stream.

Exceptions
IOException if an I/O error has occurred
Overrides
close in class FilterOutputStream


 DeflaterOutputStream.deflate

DeflaterOutputStream.deflate

Syntax
protected void deflate() throws IOException
Description
Writes next block of compressed data to the output stream.


 DeflaterOutputStream.finish

DeflaterOutputStream.finish

Syntax
public void finish() throws IOException
Description
Finishes writing compressed data to the output stream without closing the underlying stream. Use this method when applying multiple filters in succession to the same output stream.

Exceptions
IOException if an I/O error has occurred


 DeflaterOutputStream.write

DeflaterOutputStream.write

Syntax 1
public void write( int b ) throws IOException
Parameters
b
the byte to be written
Description
Writes a byte to the compressed output stream. This method will block until the byte can be written.

Exceptions
IOException if an I/O error has occurred
Overrides
write in class FilterOutputStream

Syntax 2
public void write( byte b[], int off, int len ) throws IOException
Parameters
buf
the data to be written
off
the start offset of the data
len
the length of the data
Description
Writes an array of bytes to the compressed output stream. This method will block until all the bytes are written.

Exceptions
IOException if an I/O error has occurred
Overrides
write in class FilterOutputStream


 Class GZIPInputStream

Class java.util.zip.GZIPInputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.FilterInputStream
                   |
                   +----java.util.zip.InflaterInputStream
                           |
                           +----java.util.zip.GZIPInputStream

public class GZIPInputStream
extends InflaterInputStream

This class implements a stream filter for reading compressed data in the GZIP format.

See Also:
InflaterInputStream


 GZIPInputStream Members

GZIPInputStream Members

Class Overview | This Package | All Packages

Fields
Name | Description
crc | CRC-32 for uncompressed data.
eos | Indicates end of input stream.
GZIP_MAGIC | GZIP header magic number.

Constructors
Name | Description
GZIPInputStream(InputStream) | Creates a new input stream with a default buffer size.
GZIPInputStream(InputStream, int) | Creates a new input stream with the specified buffer size.

Methods
Name | Description
close() | Closes the input stream.
read(byte[], int, int) | Reads uncompressed data into an array of bytes.


 GZIPInputStream.crc

GZIPInputStream.crc

Syntax
protected CRC32 crc
Description
CRC-32 for uncompressed data.


 GZIPInputStream.eos

GZIPInputStream.eos

Syntax
protected boolean eos
Description
Indicates end of input stream.


 GZIPInputStream.GZIP_MAGIC

GZIPInputStream.GZIP_MAGIC

Syntax
public static final int GZIP_MAGIC
Description
GZIP header magic number.


 GZIPInputStream.GZIPInputStream

GZIPInputStream.GZIPInputStream

Syntax 1
public GZIPInputStream( InputStream in, int size ) throws IOException
Parameters
in
the input stream
size
the input buffer size
Description
Creates a new input stream with the specified buffer size.

Exceptions
IOException if an I/O error has occurred

Syntax 2
public GZIPInputStream( InputStream in ) throws IOException
Parameters
in
the input stream
Description
Creates a new input stream with a default buffer size.

Exceptions
IOException if an I/O error has occurred


 GZIPInputStream.close

GZIPInputStream.close

Syntax
public void close() throws IOException
Description
Closes the input stream.

Exceptions
IOException if an I/O error has occurred
Overrides
close in class FilterInputStream


 GZIPInputStream.read

GZIPInputStream.read

Syntax
public int read( byte buf[], int off, int len ) throws IOException
Parameters
buf
the buffer into which the data is read
off
the start offset of the data
len
the maximum number of bytes read
Returns
the actual number of bytes read, or -1 if the end of the compressed input stream is reached
Description
Reads uncompressed data into an array of bytes. Blocks until enough input is available for decompression.

Exceptions
IOException if an I/O error has occurred or the compressed input data is corrupt
Overrides
read in class InflaterInputStream


 Class GZIPOutputStream

Class java.util.zip.GZIPOutputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----java.io.FilterOutputStream
                   |
                   +----java.util.zip.DeflaterOutputStream
                           |
                           +----java.util.zip.GZIPOutputStream

public class GZIPOutputStream
extends DeflaterOutputStream

This class implements a stream filter for writing compressed data in the GZIP file format.


 GZIPOutputStream Members

GZIPOutputStream Members

Class Overview | This Package | All Packages

Fields
Name | Description
crc | CRC-32 of uncompressed data.

Constructors
Name | Description
GZIPOutputStream(OutputStream) | Creates a new output stream with a default buffer size.
GZIPOutputStream(OutputStream, int) | Creates a new output stream with the specified buffer size.

Methods
Name | Description
close() | Writes remaining compressed data to the output stream and closes the underlying stream.
finish() | Finishes writing compressed data to the output stream without closing the underlying stream.
write(byte[], int, int) | Writes array of bytes to the compressed output stream.


 GZIPOutputStream.crc

GZIPOutputStream.crc

Syntax
protected CRC32 crc
Description
CRC-32 of uncompressed data.


 GZIPOutputStream.GZIPOutputStream

GZIPOutputStream.GZIPOutputStream

Syntax 1
public GZIPOutputStream( OutputStream out, int size ) throws IOException
Parameters
out
the output stream
size
the output buffer size
Description
Creates a new output stream with the specified buffer size.

Exceptions
IOException If an I/O error has occurred.

Syntax 2
public GZIPOutputStream( OutputStream out ) throws IOException
Parameters
out
the output stream
Description
Creates a new output stream with a default buffer size.

Exceptions
IOException If an I/O error has occurred.


 GZIPOutputStream.close

GZIPOutputStream.close

Syntax
public void close() throws IOException
Description
Writes remaining compressed data to the output stream and closes the underlying stream.

Exceptions
IOException if an I/O error has occurred
Overrides
close in class DeflaterOutputStream


 GZIPOutputStream.finish

GZIPOutputStream.finish

Syntax
public void finish() throws IOException
Description
Finishes writing compressed data to the output stream without closing the underlying stream. Use this method when applying multiple filters in succession to the same output stream.

Exceptions
IOException if an I/O error has occurred
Overrides
finish in class DeflaterOutputStream


 GZIPOutputStream.write

GZIPOutputStream.write

Syntax
public synchronized void write( byte buf[], int off, int len ) throws IOException
Parameters
buf
the data to be written
off
the start offset of the data
len
the length of the data
Description
Writes array of bytes to the compressed output stream. This method will block until all the bytes are written.

Exceptions
IOException If an I/O error has occurred.
Overrides
write in class DeflaterOutputStream


 Class Inflater

Class java.util.zip.Inflater

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.zip.Inflater

public class Inflater
extends Object

This class provides support for general purpose decompression using the popular ZLIB compression library. The ZLIB compression library was initially developed as part of the PNG graphics standard and is not protected by patents. It is fully described in RFCs 1950, 1951, and 1952, which can be found at ftp://ds.internic.net/rfc in the files rfc1950.txt (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).

See Also:
Deflater


 Inflater Members

Inflater Members

Class Overview | This Package | All Packages

Constructors
Name | Description
Inflater() | Creates a new decompressor.
Inflater(boolean) | Creates a new decompressor.

Methods
Name | Description
end() | Discards unprocessed input and frees internal data.
finalize() | Frees the decompressor when garbage is collected.
finished() | Return true if the end of the compressed data stream has been reached.
getAdler() | Returns the ADLER-32 value of the uncompressed data.
getRemaining() | Returns the total number of bytes remaining in the input buffer.
getTotalIn() | Returns the total number of bytes input so far.
getTotalOut() | Returns the total number of bytes output so far.
inflate(byte[]) | Uncompresses bytes into specified buffer.
inflate(byte[], int, int) | Uncompresses bytes into specified buffer.
needsDictionary() | Returns true if a preset dictionary is needed for decompression.
needsInput() | Returns true if no data remains in the input buffer.
reset() | Resets inflater so that a new set of input data can be processed.
setDictionary(byte[]) | Sets the preset dictionary to the given array of bytes.
setDictionary(byte[], int, int) | Sets the preset dictionary to the given array of bytes.
setInput(byte[]) | Sets input data for decompression.
setInput(byte[], int, int) | Sets input data for decompression.


 Inflater.Inflater

Inflater.Inflater

Syntax 1
public Inflater( boolean nowrap )
Parameters
nowrap
if true then support GZIP compatible compression
Description
Creates a new decompressor. If the parameter 'nowrap' is true then the ZLIB header and checksum fields will not be used in order to support the compression format used by both GZIP and PKZIP.

Syntax 2
public Inflater()
Description
Creates a new decompressor.


 Inflater.end

Inflater.end

Syntax
public native synchronized void end()
Description
Discards unprocessed input and frees internal data.


 Inflater.finalize

Inflater.finalize

Syntax
protected void finalize()
Description
Frees the decompressor when garbage is collected.

Overrides
finalize in class Object


 Inflater.finished

Inflater.finished

Syntax
public synchronized boolean finished()
Description
Return true if the end of the compressed data stream has been reached.


 Inflater.getAdler

Inflater.getAdler

Syntax
public native synchronized int getAdler()
Description
Returns the ADLER-32 value of the uncompressed data.


 Inflater.getRemaining

Inflater.getRemaining

Syntax
public synchronized int getRemaining()
Description
Returns the total number of bytes remaining in the input buffer. This can be used to find out what bytes still remain in the input buffer after decompression has finished.


 Inflater.getTotalIn

Inflater.getTotalIn

Syntax
public native synchronized int getTotalIn()
Description
Returns the total number of bytes input so far.


 Inflater.getTotalOut

Inflater.getTotalOut

Syntax
public native synchronized int getTotalOut()
Description
Returns the total number of bytes output so far.


 Inflater.inflate

Inflater.inflate

Syntax 1
public native synchronized int inflate( byte b[], int off, int len ) throws DataFormatException
Parameters
b
the buffer for the uncompressed data
off
the start offset of the data
len
the maximum number of uncompressed bytes
Returns
the actual number of uncompressed bytes
Description
Uncompresses bytes into specified buffer. Returns actual number of bytes uncompressed. A return value of 0 indicates that needsInput() or needsDictionary() should be called in order to determine if more input data or a preset dictionary is required. In the later case, getAdler() can be used to get the Adler-32 value of the dictionary required.

Exceptions
DataFormatException if the compressed data format is invalid
See Also
needsInput, needsDictionary

Syntax 2
public int inflate( byte b[] ) throws DataFormatException
Parameters
b
the buffer for the uncompressed data
Returns
the actual number of uncompressed bytes
Description
Uncompresses bytes into specified buffer. Returns actual number of bytes uncompressed. A return value of 0 indicates that needsInput() or needsDictionary() should be called in order to determine if more input data or a preset dictionary is required. In the later case, getAdler() can be used to get the Adler-32 value of the dictionary required.

Exceptions
DataFormatException if the compressed data format is invalid
See Also
needsInput, needsDictionary


 Inflater.needsDictionary

Inflater.needsDictionary

Syntax
public synchronized boolean needsDictionary()
Description
Returns true if a preset dictionary is needed for decompression.

See Also
InflatesetDictionary


 Inflater.needsInput

Inflater.needsInput

Syntax
public synchronized boolean needsInput()
Description
Returns true if no data remains in the input buffer. This can be used to determine if #setInput should be called in order to provide more input.


 Inflater.reset

Inflater.reset

Syntax
public native synchronized void reset()
Description
Resets inflater so that a new set of input data can be processed.


 Inflater.setDictionary

Inflater.setDictionary

Syntax 1
public native synchronized void setDictionary( byte b[], int off, int len )
Parameters
b
the dictionary data bytes
off
the start offset of the data
len
the length of the data
Description
Sets the preset dictionary to the given array of bytes. Should be called when inflate() returns 0 and needsDictionary() returns true indicating that a preset dictionary is required. The method getAdler() can be used to get the Adler-32 value of the dictionary needed.

See Also
needsDictionary, getAdler

Syntax 2
public void setDictionary( byte b[] )
Parameters
b
the dictionary data bytes
Description
Sets the preset dictionary to the given array of bytes. Should be called when inflate() returns 0 and needsDictionary() returns true indicating that a preset dictionary is required. The method getAdler() can be used to get the Adler-32 value of the dictionary needed.

See Also
needsDictionary, getAdler


 Inflater.setInput

Inflater.setInput

Syntax 1
public synchronized void setInput( byte b[], int off, int len )
Parameters
b
the input data bytes
off
the start offset of the input data
len
the length of the input data
Description
Sets input data for decompression. Should be called whenever needsInput() returns true indicating that more input data is required.

See Also
needsInput

Syntax 2
public void setInput( byte b[] )
Parameters
b
the input data bytes
Description
Sets input data for decompression. Should be called whenever needsInput() returns true indicating that more input data is required.

See Also
needsInput


 Class InflaterInputStream

Class java.util.zip.InflaterInputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.FilterInputStream
                   |
                   +----java.util.zip.InflaterInputStream

public class InflaterInputStream
extends FilterInputStream

This class implements a stream filter for uncompressing data in the "deflate" compression format. It is also used as the basis for other decompression filters, such as GZIPInputStream.

See Also:
Inflater


 InflaterInputStream Members

InflaterInputStream Members

Class Overview | This Package | All Packages

Fields
Name | Description
buf | Input buffer for decompression.
inf | Decompressor for this stream.
len | Length of input buffer.

Constructors
Name | Description
InflaterInputStream(InputStream) | Creates a new input stream with a default decompressor and buffer size.
InflaterInputStream(InputStream, Inflater) | Creates a new input stream with the specified decompressor and a default buffer size.
InflaterInputStream(InputStream, Inflater, int) | Creates a new input stream with the specified decompressor and buffer size.

Methods
Name | Description
fill() | Fills input buffer with more data to decompress.
read() | Reads a byte of uncompressed data.
read(byte[], int, int) | Reads uncompressed data into an array of bytes.
skip(long) | Skips specified number of bytes of uncompressed data.


 InflaterInputStream.buf

InflaterInputStream.buf

Syntax
protected byte buf[]
Description
Input buffer for decompression.


 InflaterInputStream.inf

InflaterInputStream.inf

Syntax
protected Inflater inf
Description
Decompressor for this stream.


 InflaterInputStream.len

InflaterInputStream.len

Syntax
protected int len
Description
Length of input buffer.


 InflaterInputStream.InflaterInputStream

InflaterInputStream.InflaterInputStream

Syntax 1
public InflaterInputStream( InputStream in, Inflater inf, int size )
Parameters
in
the input stream
inf
the decompressor ("inflater")
len
the input buffer size
Description
Creates a new input stream with the specified decompressor and buffer size.

Syntax 2
public InflaterInputStream( InputStream in, Inflater inf )
Parameters
in
the input stream
inf
the decompressor ("inflater")
Description
Creates a new input stream with the specified decompressor and a default buffer size.

Syntax 3
public InflaterInputStream( InputStream in )
Description
Creates a new input stream with a default decompressor and buffer size.


 InflaterInputStream.fill

InflaterInputStream.fill

Syntax
protected void fill() throws IOException
Description
Fills input buffer with more data to decompress.

Exceptions
IOException if an I/O error has occurred


 InflaterInputStream.read

InflaterInputStream.read

Syntax 1
public int read() throws IOException
Returns
the byte read, or -1 if end of compressed input is reached
Description
Reads a byte of uncompressed data. This method will block until enough input is available for decompression.

Exceptions
IOException if an I/O error has occurred
Overrides
read in class FilterInputStream

Syntax 2
public int read( byte b[], int off, int len ) throws IOException
Parameters
b
the buffer into which the data is read
off
the start offset of the data
len
the maximum number of bytes read
Returns
the actual number of bytes read, or -1 if the end of the compressed input is reached or a preset dictionary is needed
Description
Reads uncompressed data into an array of bytes. This method will block until some input can be decompressed.

Exceptions
ZipException if a ZIP format error has occurred
Exceptions
IOException if an I/O error has occurred
Overrides
read in class FilterInputStream


 InflaterInputStream.skip

InflaterInputStream.skip

Syntax
public long skip( long n ) throws IOException
Parameters
n
the number of bytes to skip
Returns
the actual number of bytes skipped.
Description
Skips specified number of bytes of uncompressed data.

Exceptions
IOException if an I/O error has occurred
Overrides
skip in class FilterInputStream


 Class ZipEntry

Class java.util.zip.ZipEntry

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.zip.ZipEntry

public class ZipEntry
extends Object
implements ZipConstants

This class is used to represent a ZIP file entry.


 ZipEntry Members

ZipEntry Members

Class Overview | This Package | All Packages

Fields
Name | Description
DEFLATED | Compression method for compressed (deflated) entries.
STORED | Compression method for uncompressed entries.

Constructors
Name | Description
ZipEntry(String) | Creates a new ZIP file entry with the specified name.

Methods
Name | Description
getComment() | Returns the comment string for the entry, or null if none.
getCompressedSize() | Returns the compressed size of the entry data, or -1 if not known.
getCrc() | Returns the CRC-32 checksum of the uncompressed entry data, or -1 if not known.
getExtra() | Returns the extra field data for the entry, or null if none.
getMethod() | Returns the compression method of the entry, or -1 if not specified.
getName() | Returns the name of the entry.
getSize() | Returns the uncompressed size of the entry data, or -1 if not known.
getTime() | Returns the modification time of the entry, or -1 if not specified.
isDirectory() | Returns true if this is a directory entry.
setComment(String) | Sets the optional comment string for the entry.
setCrc(long) | Sets the CRC-32 checksum of the uncompressed entry data.
setExtra(byte[]) | Sets the optional extra field data for the entry.
setMethod(int) | Sets the compression method for the entry.
setSize(long) | Sets the uncompressed size of the entry data.
setTime(long) | Sets the modification time of the entry.
toString() | Returns a string representation of the ZIP entry.


 ZipEntry.DEFLATED

ZipEntry.DEFLATED

Syntax
public static final int DEFLATED
Description
Compression method for compressed (deflated) entries.


 ZipEntry.STORED

ZipEntry.STORED

Syntax
public static final int STORED
Description
Compression method for uncompressed entries.


 ZipEntry.ZipEntry

ZipEntry.ZipEntry

Syntax
public ZipEntry( String name )
Parameters
name
the entry name
Description
Creates a new ZIP file entry with the specified name.

Exceptions
NullPointerException if the entry name is null
Exceptions
IllegalArgumentException if the entry name is longer than 0xFFFF bytes


 ZipEntry.getComment

ZipEntry.getComment

Syntax
public String getComment()
Description
Returns the comment string for the entry, or null if none.


 ZipEntry.getCompressedSize

ZipEntry.getCompressedSize

Syntax
public long getCompressedSize()
Description
Returns the compressed size of the entry data, or -1 if not known. In the case of a stored entry, the compressed size will be the same as the uncompressed size of the entry.


 ZipEntry.getCrc

ZipEntry.getCrc

Syntax
public long getCrc()
Description
Returns the CRC-32 checksum of the uncompressed entry data, or -1 if not known.


 ZipEntry.getExtra

ZipEntry.getExtra

Syntax
public byte[] getExtra()
Description
Returns the extra field data for the entry, or null if none.


 ZipEntry.getMethod

ZipEntry.getMethod

Syntax
public int getMethod()
Description
Returns the compression method of the entry, or -1 if not specified.


 ZipEntry.getName

ZipEntry.getName

Syntax
public String getName()
Description
Returns the name of the entry.


 ZipEntry.getSize

ZipEntry.getSize

Syntax
public long getSize()
Description
Returns the uncompressed size of the entry data, or -1 if not known.


 ZipEntry.getTime

ZipEntry.getTime

Syntax
public long getTime()
Description
Returns the modification time of the entry, or -1 if not specified.


 ZipEntry.isDirectory

ZipEntry.isDirectory

Syntax
public boolean isDirectory()
Description
Returns true if this is a directory entry. A directory entry is defined to be one whose name ends with a '/'.


 ZipEntry.setComment

ZipEntry.setComment

Syntax
public void setComment( String comment )
Parameters
comment
the comment string
Description
Sets the optional comment string for the entry.

Exceptions
IllegalArgumentException if the length of the specified comment string is greater than 0xFFFF bytes


 ZipEntry.setCrc

ZipEntry.setCrc

Syntax
public void setCrc( long crc )
Parameters
crc
the CRC-32 value
Description
Sets the CRC-32 checksum of the uncompressed entry data.

Exceptions
IllegalArgumentException if the specified CRC-32 value is less than 0 or greater than 0xFFFFFFFF


 ZipEntry.setExtra

ZipEntry.setExtra

Syntax
public void setExtra( byte extra[] )
Parameters
extra
the extra field data bytes
Description
Sets the optional extra field data for the entry.

Exceptions
IllegalArgumentException if the length of the specified extra field data is greater than 0xFFFFF bytes


 ZipEntry.setMethod

ZipEntry.setMethod

Syntax
public void setMethod( int method )
Parameters
method
the compression method, either STORED or DEFLATED
Description
Sets the compression method for the entry.

Exceptions
IllegalArgumentException if the specified compression method is invalid


 ZipEntry.setSize

ZipEntry.setSize

Syntax
public void setSize( long size )
Parameters
size
the uncompressed size in bytes
Description
Sets the uncompressed size of the entry data.

Exceptions
IllegalArgumentException if the specified size is less than 0 or greater than 0xFFFFFFFF bytes


 ZipEntry.setTime

ZipEntry.setTime

Syntax
public void setTime( long time )
Parameters
time
the entry modification time in number of milliseconds since the epoch
Description
Sets the modification time of the entry.


 ZipEntry.toString

ZipEntry.toString

Syntax
public String toString()
Description
Returns a string representation of the ZIP entry.

Overrides
toString in class Object


 Class ZipException

Class java.util.zip.ZipException

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.lang.Throwable
           |
           +----java.lang.Exception
                   |
                   +----java.io.IOException
                           |
                           +----java.util.zip.ZipException

public class ZipException
extends IOException


 ZipException Members

ZipException Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ZipException() |
ZipException(String) |


 ZipException.ZipException

ZipException.ZipException

Syntax 1
public ZipException()

Syntax 2
public ZipException( String s )


 Class ZipFile

Class java.util.zip.ZipFile

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.zip.ZipFile

public class ZipFile
extends Object
implements ZipConstants

This class can be used to read the contents of a ZIP file. It uses RandomAccessFile for quick access to ZIP file entries, and supports both compressed and uncompressed entries.


 ZipFile Members

ZipFile Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ZipFile(File) | Opens a ZIP file for reading given the specified File object.
ZipFile(String) | Opens a ZIP file for reading given the specified file name.

Methods
Name | Description
close() | Closes the ZIP file.
entries() | Returns an enumeration of the ZIP file entries.
getEntry(String) | Returns the ZIP file entry for the given path name.
getInputStream(ZipEntry) | Returns an input stream for reading the contents of the specified ZIP file entry.
getName() | Returns the path name of the ZIP file.


 ZipFile.ZipFile

ZipFile.ZipFile

Syntax 1
public ZipFile( String name ) throws IOException
Parameters
name
the name of the zip file
Description
Opens a ZIP file for reading given the specified file name.

Exceptions
ZipException if a ZIP format error has occurred
Exceptions
IOException if an I/O error has occurred

Syntax 2
public ZipFile( File file ) throws ZipException, IOException
Parameters
file
the ZIP file to be opened for reading
Description
Opens a ZIP file for reading given the specified File object.

Exceptions
ZipException if a ZIP error has occurred
Exceptions
IOException if an I/O error has occurred


 ZipFile.close

ZipFile.close

Syntax
public void close() throws IOException
Description
Closes the ZIP file.


 ZipFile.entries

ZipFile.entries

Syntax
public Enumeration entries()
Description
Returns an enumeration of the ZIP file entries.


 ZipFile.getEntry

ZipFile.getEntry

Syntax
public ZipEntry getEntry( String name )
Parameters
name
the name of the entry
Returns
the ZIP file entry
Description
Returns the ZIP file entry for the given path name. Returns null if there is no entry corresponding to the given name.


 ZipFile.getInputStream

ZipFile.getInputStream

Syntax
public InputStream getInputStream( ZipEntry ze ) throws IOException
Parameters
ze
the zip file entry
Description
Returns an input stream for reading the contents of the specified ZIP file entry.

Exceptions
ZipException if a ZIP format error has occurred
Exceptions
IOException if an I/O error has occurred


 ZipFile.getName

ZipFile.getName

Syntax
public String getName()
Description
Returns the path name of the ZIP file.


 Class ZipInputStream

Class java.util.zip.ZipInputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.FilterInputStream
                   |
                   +----java.util.zip.InflaterInputStream
                           |
                           +----java.util.zip.ZipInputStream

public class ZipInputStream
extends InflaterInputStream
implements ZipConstants

This class implements an input stream filter for reading files in the ZIP file format. Includes support for both compressed and uncompressed entries.


 ZipInputStream Members

ZipInputStream Members

Class Overview | This Package | All Packages

Constructors
Name | Description
ZipInputStream(InputStream) | Creates a new ZIP input stream.

Methods
Name | Description
close() | Closes the ZIP input stream.
closeEntry() | Closes the current ZIP entry and positions the stream for reading the next entry.
getNextEntry() | Reads the next ZIP file entry and positions stream at the beginning of the entry data.
read(byte[], int, int) | Reads from the current ZIP entry into an array of bytes.
skip(long) | Skips specified number of bytes in the current ZIP entry.


 ZipInputStream.ZipInputStream

ZipInputStream.ZipInputStream

Syntax
public ZipInputStream( InputStream in )
Parameters
in
the actual input stream
Description
Creates a new ZIP input stream.


 ZipInputStream.close

ZipInputStream.close

Syntax
public void close() throws IOException
Description
Closes the ZIP input stream.

Exceptions
IOException if an I/O error has occurred
Overrides
close in class FilterInputStream


 ZipInputStream.closeEntry

ZipInputStream.closeEntry

Syntax
public void closeEntry() throws IOException
Description
Closes the current ZIP entry and positions the stream for reading the next entry.

Exceptions
ZipException if a ZIP file error has occurred
Exceptions
IOException if an I/O error has occurred


 ZipInputStream.getNextEntry

ZipInputStream.getNextEntry

Syntax
public ZipEntry getNextEntry() throws IOException
Description
Reads the next ZIP file entry and positions stream at the beginning of the entry data.

Exceptions
ZipException if a ZIP file error has occurred
Exceptions
IOException if an I/O error has occurred


 ZipInputStream.read

ZipInputStream.read

Syntax
public int read( byte b[], int off, int len ) throws IOException
Parameters
b
the buffer into which the data is read
off
the start offset of the data
len
the maximum number of bytes read
Returns
the actual number of bytes read, or -1 if the end of the entry is reached
Description
Reads from the current ZIP entry into an array of bytes. Blocks until some input is available.

Exceptions
ZipException if a ZIP file error has occurred
Exceptions
IOException if an I/O error has occurred
Overrides
read in class InflaterInputStream


 ZipInputStream.skip

ZipInputStream.skip

Syntax
public long skip( long n ) throws IOException
Parameters
n
the number of bytes to skip
Returns
the actual number of bytes skipped
Description
Skips specified number of bytes in the current ZIP entry.

Exceptions
ZipException if a ZIP file error has occurred
Exceptions
IOException if an I/O error has occurred
Overrides
skip in class InflaterInputStream


 Class ZipOutputStream

Class java.util.zip.ZipOutputStream

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----java.io.FilterOutputStream
                   |
                   +----java.util.zip.DeflaterOutputStream
                           |
                           +----java.util.zip.ZipOutputStream

public class ZipOutputStream
extends DeflaterOutputStream
implements ZipConstants

This class implements an output stream filter for writing files in the ZIP file format. Includes support for both compressed and uncompressed entries.


 ZipOutputStream Members

ZipOutputStream Members

Class Overview | This Package | All Packages

Fields
Name | Description
DEFLATED | Compression method for compressed (DEFLATED) entries.
STORED | Compression method for uncompressed (STORED) entries.

Constructors
Name | Description
ZipOutputStream(OutputStream) | Creates a new ZIP output stream.

Methods
Name | Description
close() | Closes the ZIP output stream as well as the stream being filtered.
closeEntry() | Closes the current ZIP entry and positions the stream for writing the next entry.
finish() | Finishes writing the contents of the ZIP output stream without closing the underlying stream.
putNextEntry(ZipEntry) | Begins writing a new ZIP file entry and positions the stream to the start of the entry data.
setComment(String) | Sets the ZIP file comment.
setLevel(int) | Sets the compression level for subsequent entries which are DEFLATED.
setMethod(int) | Sets the default compression method for subsequent entries.
write(byte[], int, int) | Writes an array of bytes to the current ZIP entry data.


 ZipOutputStream.DEFLATED

ZipOutputStream.DEFLATED

Syntax
public static final int DEFLATED
Description
Compression method for compressed (DEFLATED) entries.


 ZipOutputStream.STORED

ZipOutputStream.STORED

Syntax
public static final int STORED
Description
Compression method for uncompressed (STORED) entries.


 ZipOutputStream.ZipOutputStream

ZipOutputStream.ZipOutputStream

Syntax
public ZipOutputStream( OutputStream out )
Parameters
out
the actual output stream
Description
Creates a new ZIP output stream.


 ZipOutputStream.close

ZipOutputStream.close

Syntax
public void close() throws IOException
Description
Closes the ZIP output stream as well as the stream being filtered.

Exceptions
ZipException if a ZIP file error has occurred
Exceptions
IOException if an I/O error has occurred
Overrides
close in class DeflaterOutputStream


 ZipOutputStream.closeEntry

ZipOutputStream.closeEntry

Syntax
public void closeEntry() throws IOException
Description
Closes the current ZIP entry and positions the stream for writing the next entry.

Exceptions
ZipException if a ZIP format error has occurred
Exceptions
IOException if an I/O error has occurred


 ZipOutputStream.finish

ZipOutputStream.finish

Syntax
public void finish() throws IOException
Description
Finishes writing the contents of the ZIP output stream without closing the underlying stream. Use this method when applying multiple filters in succession to the same output stream.

Exceptions
ZipException if a ZIP file error has occurred
Exceptions
IOException if an I/O exception has occurred
Overrides
finish in class DeflaterOutputStream


 ZipOutputStream.putNextEntry

ZipOutputStream.putNextEntry

Syntax
public void putNextEntry( ZipEntry e ) throws IOException
Parameters
e
the ZIP entry to be written
Description
Begins writing a new ZIP file entry and positions the stream to the start of the entry data. Closes the current entry if still active. The default compression method will be used if no compression method was specified for the entry, and the current time will be used if the entry has no set modification time.

Exceptions
ZipException if a ZIP format error has occurred
Exceptions
IOException if an I/O error has occurred


 ZipOutputStream.setComment

ZipOutputStream.setComment

Syntax
public void setComment( String comment )
Parameters
comment
the comment string
Description
Sets the ZIP file comment.

Exceptions
IllegalArgumentException if the length of the specified ZIP file comment is greater than 0xFFFF bytes


 ZipOutputStream.setLevel

ZipOutputStream.setLevel

Syntax
public void setLevel( int level )
Parameters
level
the compression level (0-9)
Description
Sets the compression level for subsequent entries which are DEFLATED. The default setting is DEFAULT_COMPRESSION.

Exceptions
IllegalArgumentException if the compression level is invalid


 ZipOutputStream.setMethod

ZipOutputStream.setMethod

Syntax
public void setMethod( int method )
Parameters
method
the default compression method
Description
Sets the default compression method for subsequent entries. This default will be used whenever the compression method is not specified for an individual ZIP file entry, and is initially set to DEFLATED.

Exceptions
IllegalArgumentException if the specified compression method is invalid


 ZipOutputStream.write

ZipOutputStream.write

Syntax
public synchronized void write( byte b[], int off, int len ) throws IOException
Parameters
b
the data to be written
off
the start offset in the data
len
the number of bytes that are written
Description
Writes an array of bytes to the current ZIP entry data. This method will block until all the bytes are written.

Exceptions
ZipException if a ZIP file error has occurred
Exceptions
IOException if an I/O error has occurred
Overrides
write in class DeflaterOutputStream