APIdia Launch Partner
Top Description Inners Methods
javax.sound.sampled

public Interface Port

extends Line
Known Direct Implementers
com.sun.media.sound.PortMixer.PortMixerPort

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
Since
1.3

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Port.Info

The Port.Info class extends Line.Info with additional information specific to ports, including the port's name and whether it is a source or a target for its mixer.

Method Summary

Inherited from javax.sound.sampled.Line:
addLineListenerclosegetControlgetControlsgetLineInfoisControlSupportedisOpenopenremoveLineListener
javax.sound.sampled back to summary

public Class Port.Info

extends Info
Class Inheritance
Known Direct Subclasses
com.sun.media.sound.PortMixer.PortInfo

The Port.Info class extends Line.Info with additional information specific to ports, including the port's name and whether it is a source or a target for its mixer. By definition, a port acts as either a source or a target to its mixer, but not both. (Audio input ports are sources; audio output ports are targets.)

To learn what ports are available, you can retrieve port info objects through the getSourceLineInfo and getTargetLineInfo methods of the Mixer interface. Instances of the Port.Info class may also be constructed and used to obtain lines matching the parameters specified in the Port.Info object.

Author
Kara Kytle
Since
1.3

Field Summary

Modifier and TypeField and Description
public static final Port.Info
COMPACT_DISC

A type of port that gets audio from a CD-ROM drive.

public static final Port.Info
HEADPHONE

A type of port that sends audio to a headphone jack.

private final boolean
isSource

Whether this port is source or not.

public static final Port.Info
LINE_IN

A type of port that gets audio from a line-level audio input jack.

public static final Port.Info
LINE_OUT

A type of port that sends audio to a line-level audio output jack.

public static final Port.Info
MICROPHONE

A type of port that gets audio from a built-in microphone or a microphone jack.

private final String
name

The string that names the port.

public static final Port.Info
SPEAKER

A type of port that sends audio to a built-in speaker or a speaker jack.

Constructor Summary

AccessConstructor and Description
public
Info(Class<?>
the class of the port described by the info object
lineClass
,
String
the string that names the port
name
,
boolean
true if the port is a source port (such as a microphone), false if the port is a target port (such as a speaker)
isSource
)

Constructs a port's info object from the information given.

Method Summary

Modifier and TypeMethod and Description
public final boolean

Returns:

true if the specified object is equal to this info object; false otherwise
equals
(Object
the reference object with which to compare
obj
)

Overrides java.lang.Object.equals.

Indicates whether the specified object is equal to this info object, returning true if the objects are the same.

public String

Returns:

the string that names the port
getName
()

Obtains the name of the port.

public final int

Returns:

a hash code value for this info object
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this info object.

public boolean

Returns:

true if the port is a source port (such as a microphone), false if the port is a target port (such as a speaker)
isSource
()

Indicates whether the port is a source or a target for its mixer.

public boolean

Returns:

true if the specified object matches this one, false otherwise
matches
(Line.Info
the info object for which the match is queried
info
)

Overrides javax.sound.sampled.Line.Info.matches.

Indicates whether this info object specified matches this one.

public final String

Returns:

a string representation of the info object
toString
()

Overrides javax.sound.sampled.Line.Info.toString.

Returns a string representation of the info object.

Inherited from javax.sound.sampled.Line.Info:
getLineClass

Field Detail

COMPACT_DISCback to summary
public static final Port.Info COMPACT_DISC

A type of port that gets audio from a CD-ROM drive.

HEADPHONEback to summary
public static final Port.Info HEADPHONE

A type of port that sends audio to a headphone jack.

isSourceback to summary
private final boolean isSource

Whether this port is source or not.

LINE_INback to summary
public static final Port.Info LINE_IN

A type of port that gets audio from a line-level audio input jack.

LINE_OUTback to summary
public static final Port.Info LINE_OUT

A type of port that sends audio to a line-level audio output jack.

MICROPHONEback to summary
public static final Port.Info MICROPHONE

A type of port that gets audio from a built-in microphone or a microphone jack.

nameback to summary
private final String name

The string that names the port.

SPEAKERback to summary
public static final Port.Info SPEAKER

A type of port that sends audio to a built-in speaker or a speaker jack.

Constructor Detail

Infoback to summary
public Info(Class<?> lineClass, String name, boolean isSource)

Constructs a port's info object from the information given. This constructor is typically used by an implementation of Java Sound to describe a supported line.

Parameters
lineClass:Class<?>

the class of the port described by the info object

name:String

the string that names the port

isSource:boolean

true if the port is a source port (such as a microphone), false if the port is a target port (such as a speaker)

Method Detail

equalsback to summary
public final boolean equals(Object obj)

Overrides java.lang.Object.equals.

Indicates whether the specified object is equal to this info object, returning true if the objects are the same.

Parameters
obj:Object

the reference object with which to compare

Returns:boolean

true if the specified object is equal to this info object; false otherwise

Annotations
@Override
getNameback to summary
public String getName()

Obtains the name of the port.

Returns:String

the string that names the port

hashCodeback to summary
public final int hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this info object.

Returns:int

a hash code value for this info object

Annotations
@Override
isSourceback to summary
public boolean isSource()

Indicates whether the port is a source or a target for its mixer.

Returns:boolean

true if the port is a source port (such as a microphone), false if the port is a target port (such as a speaker)

matchesback to summary
public boolean matches(Line.Info info)

Overrides javax.sound.sampled.Line.Info.matches.

Indicates whether this info object specified matches this one. To match, the match requirements of the superclass must be met and the types must be equal.

Parameters
info:Line.Info

the info object for which the match is queried

Returns:boolean

true if the specified object matches this one, false otherwise

Annotations
@Override
toStringback to summary
public final String toString()

Overrides javax.sound.sampled.Line.Info.toString.

Returns a string representation of the info object.

Returns:String

a string representation of the info object

Annotations
@Override