src/share/classes/javax/sound/sampled/Line.java

Print this page




  53  * interface, which consists of the single method
  54  * <code>{@link LineListener#update update}</code>.
  55  * This method will be invoked when a line opens and closes (and, if it's a
  56  * {@link DataLine}, when it starts and stops).
  57  *<p>
  58  * An object can be registered to listen to multiple lines.  The event it
  59  * receives in its <code>update</code> method will specify which line created
  60  * the event, what type of event it was
  61  * (<code>OPEN</code>, <code>CLOSE</code>, <code>START</code>, or <code>STOP</code>),
  62  * and how many sample frames the line had processed at the time the event occurred.
  63  * <p>
  64  * Certain line operations, such as open and close, can generate security
  65  * exceptions if invoked by unprivileged code when the line is a shared audio
  66  * resource.
  67  *
  68  * @author Kara Kytle
  69  *
  70  * @see LineEvent
  71  * @since 1.3
  72  */
  73 public interface Line {
  74 
  75     /**
  76      * Obtains the <code>Line.Info</code> object describing this
  77      * line.
  78      * @return description of the line
  79      */
  80     public Line.Info getLineInfo();
  81 
  82     /**
  83      * Opens the line, indicating that it should acquire any required
  84      * system resources and become operational.
  85      * If this operation
  86      * succeeds, the line is marked as open, and an <code>OPEN</code> event is dispatched
  87      * to the line's listeners.
  88      * <p>
  89      * Note that some lines, once closed, cannot be reopened.  Attempts
  90      * to reopen such a line will always result in an <code>LineUnavailableException</code>.
  91      * <p>
  92      * Some types of lines have configurable properties that may affect
  93      * resource allocation.   For example, a <code>DataLine</code> must




  53  * interface, which consists of the single method
  54  * <code>{@link LineListener#update update}</code>.
  55  * This method will be invoked when a line opens and closes (and, if it's a
  56  * {@link DataLine}, when it starts and stops).
  57  *<p>
  58  * An object can be registered to listen to multiple lines.  The event it
  59  * receives in its <code>update</code> method will specify which line created
  60  * the event, what type of event it was
  61  * (<code>OPEN</code>, <code>CLOSE</code>, <code>START</code>, or <code>STOP</code>),
  62  * and how many sample frames the line had processed at the time the event occurred.
  63  * <p>
  64  * Certain line operations, such as open and close, can generate security
  65  * exceptions if invoked by unprivileged code when the line is a shared audio
  66  * resource.
  67  *
  68  * @author Kara Kytle
  69  *
  70  * @see LineEvent
  71  * @since 1.3
  72  */
  73 public interface Line extends AutoCloseable {
  74 
  75     /**
  76      * Obtains the <code>Line.Info</code> object describing this
  77      * line.
  78      * @return description of the line
  79      */
  80     public Line.Info getLineInfo();
  81 
  82     /**
  83      * Opens the line, indicating that it should acquire any required
  84      * system resources and become operational.
  85      * If this operation
  86      * succeeds, the line is marked as open, and an <code>OPEN</code> event is dispatched
  87      * to the line's listeners.
  88      * <p>
  89      * Note that some lines, once closed, cannot be reopened.  Attempts
  90      * to reopen such a line will always result in an <code>LineUnavailableException</code>.
  91      * <p>
  92      * Some types of lines have configurable properties that may affect
  93      * resource allocation.   For example, a <code>DataLine</code> must