LineEvent class encapsulates information that a line sends its
listeners whenever the line opens, closes, starts, or stops. Each of these
four state changes is represented by a corresponding type of event. A
listener receives the event as a parameter to its
update method. By querying the event, the
listener can learn the type of event, the line responsible for the event, and
how much data the line had processed when the event occurred.
Although this class implements Serializable, attempts to serialize a
LineEvent object will fail.
Line, LineListener#update
| Modifier and Type | Class and Description |
|---|---|
| public static class | LineEvent.
The LineEvent.Type inner class identifies what kind of event occurred on a line. |
| Modifier and Type | Field and Description |
|---|---|
| private final long | position
The media position when the event occurred, expressed in sample frames. |
| private static final long | serialVersionUID
Use serialVersionUID from JDK 1.3 for interoperability.
|
| private final LineEvent. | type
The kind of line event ( |
| Access | Constructor and Description |
|---|---|
| public | LineEvent(Line
the source of this event line, LineEvent.the event type ( type,OPEN, CLOSE, START,
or STOP)the number of sample frames that the line had already
processed when the event occurred, or
position)AudioSystem#NOT_SPECIFIEDConstructs a new event of the specified type, originating from the specified line. |
| Modifier and Type | Method and Description |
|---|---|
| public final long | Returns: the line's position as a sample frame numberObtains the position in the line's audio data when the event occurred, expressed in sample frames. |
| public final Line | Returns: the line responsible for this eventObtains the audio line that is the source of this event. |
| public final LineEvent. | |
| public String | Returns: a string representation of the eventOverrides java. Returns a string representation of the event. |
| position | back to summary |
|---|---|
| private final long position The media position when the event occurred, expressed in sample frames.
Note that this field is only relevant to certain events generated by data
lines, such as
| |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. Use serialVersionUID from JDK 1.3 for interoperability. | |
| type | back to summary |
|---|---|
| private final LineEvent. The kind of line event (
| |
| LineEvent | back to summary |
|---|---|
| public LineEvent(Line line, LineEvent. Constructs a new event of the specified type, originating from the specified line.
| |
| getFramePosition | back to summary |
|---|---|
| public final long getFramePosition() Obtains the position in the line's audio data when the event occurred, expressed in sample frames. For example, if a source line had already played back 14 sample frames at the time it was paused, the pause event would report the line's position as 14. The next frame to be processed would be frame number 14 using zero-based numbering, or 15 using one-based numbering.
Note that this field is relevant only to certain events generated by data
lines, such as
| |
| getLine | back to summary |
|---|---|
| public final Line getLine() Obtains the audio line that is the source of this event.
| |
| getType | back to summary |
|---|---|
| public final LineEvent. Obtains the event's type.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a string representation of the event. | |
LineEvent#getType()
| Modifier and Type | Field and Description |
|---|---|
| public static final LineEvent. | CLOSE
A type of event that is sent when a line closes, freeing the system resources it had obtained when it was opened. |
| private final String | name
Type name. |
| public static final LineEvent. | OPEN
A type of event that is sent when a line opens, reserving system resources for itself. |
| public static final LineEvent. | |
| public static final LineEvent. |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public final boolean | Returns: true if the specified object is equal to this event
type; false otherwisethe reference object with which to compare obj)Overrides java. Indicates whether the specified object is equal to this event type,
returning |
| public final int | Returns: a hash code value for this event typeOverrides java. Returns a hash code value for this event type. |
| public String | Returns: a string representation of the event typeOverrides java. Returns type's name as the string representation of the event type. |
| CLOSE | back to summary |
|---|---|
| public static final LineEvent. A type of event that is sent when a line closes, freeing the system resources it had obtained when it was opened.
| |
| name | back to summary |
|---|---|
| private final String name Type name. | |
| OPEN | back to summary |
|---|---|
| public static final LineEvent. A type of event that is sent when a line opens, reserving system resources for itself. | |
| START | back to summary |
|---|---|
| public static final LineEvent. A type of event that is sent when a line begins to engage in active
input or output of audio data in response to a
| |
| STOP | back to summary |
|---|---|
| public static final LineEvent. A type of event that is sent when a line ceases active input or
output of audio data in response to a
| |
| Type | back to summary |
|---|---|
| protected Type(String name) Constructs a new event type.
| |
| equals | back to summary |
|---|---|
| public final boolean equals(Object obj) Overrides java. Indicates whether the specified object is equal to this event type,
returning | |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Overrides java. Returns a hash code value for this event type.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns type's name as the string representation of the event type. | |