Ports are simple lines for input or output of audio to or from audio devices. Common examples of ports that act as source lines (mixer inputs) include the microphone, line input, and CD-ROM drive. Ports that act as target lines (mixer outputs) include the speaker, headphone, and line output. You can access port using a Port.Info object.
@author
Kara Kytle
@version
1.26, 04/05/05
@since
1.3
Adds a listener to this line. Whenever the line's status changes, the listener's update() method is called with a LineEvent object that describes the change.
Parameters
listenerthe object to add as a listener to this line
Closes the line, indicating that any system resources in use by the line can be released. If this operation succeeds, the line is marked closed and a CLOSE event is dispatched to the line's listeners.
Throws
SecurityExceptionif the line cannot be closed due to security restrictions.
See Also
Obtains a control of the specified type, if there is any. Some controls may only be available when the line is open.
Parameters
controlthe type of the requested control
Return
a control of the specified type
Throws
IllegalArgumentExceptionif a control of the specified type is not supported
Obtains the set of controls associated with this line. Some controls may only be available when the line is open. If there are no controls, this method returns an array of length 0.
Return
the array of controls
See Also
Obtains the Line.Info object describing this line.
Return
description of the line
Indicates whether the line supports a control of the specified type. Some controls may only be available when the line is open.
Parameters
controlthe type of the control for which support is queried
Return
true if at least one control of the specified type is supported, otherwise false.
Indicates whether the line is open, meaning that it has reserved system resources and is operational, although it might not currently be playing or capturing sound.
Return
true if the line is open, otherwise false
See Also
Opens the line, indicating that it should acquire any required system resources and become operational. If this operation succeeds, the line is marked as open, and an OPEN event is dispatched to the line's listeners.

Note that some lines, once closed, cannot be reopened. Attempts to reopen such a line will always result in an LineUnavailableException.

Some types of lines have configurable properties that may affect resource allocation. For example, a DataLine must be opened with a particular format and buffer size. Such lines should provide a mechanism for configuring these properties, such as an additional open method or methods which allow an application to specify the desired settings.

This method takes no arguments, and opens the line with the current settings. For SourceDataLine and TargetDataLine objects, this means that the line is opened with default settings. For a Clip , however, the buffer size is determined when data is loaded. Since this method does not allow the application to specify any data to load, an IllegalArgumentException is thrown. Therefore, you should instead use one of the open methods provided in the Clip interface to load data into the Clip.

For DataLine's, if the DataLine.Info object which was used to retrieve the line, specifies at least one fully qualified audio format, the last one will be used as the default format.

Throws
IllegalArgumentExceptionif this method is called on a Clip instance.
LineUnavailableExceptionif the line cannot be opened due to resource restrictions.
SecurityExceptionif the line cannot be opened due to security restrictions.
Removes the specified listener from this line's list of listeners.
Parameters
listenerlistener to remove