javax.sound.sampled
Interface DataLine

All Superinterfaces:
Line
All Known Subinterfaces:
Clip, SourceDataLine, TargetDataLine

public interface DataLine
extends Line

The DataLine interface adds data-related functionality to the Line interface. For example, it adds methods to start and stop the data on the line.

Since:
1.3

Nested Class Summary
static class DataLine.Info
          This class extends Line.Info with information specific to DataLine.
 
Method Summary
 int available()
          Return the number of bytes currently available on this DataLine.
 void drain()
          This method blocks until whatever data is buffered in the DataLine's internal buffer has been drained.
 void flush()
          This flushes the DataLine by discarding any buffered data.
 int getBufferSize()
          Returns the size of the DataLine's internal buffer, in bytes.
 AudioFormat getFormat()
          Return the current format of the data associated with this DataLine.
 int getFramePosition()
          Return the current frame position.
 float getLevel()
          Return the volume level for this DataLine.
 long getLongFramePosition()
          Return the current frame position.
 long getMicrosecondPosition()
          Return the number of microseconds this DataLine has been playing.
 boolean isActive()
          Return true if this line is active, meaning that it is actively performing audio I/O.
 boolean isRunning()
          Return true if this line is running, meaning that it has been started.
 void start()
          Start processing data.
 void stop()
          Stop processing data.
 
Methods inherited from interface javax.sound.sampled.Line
addLineListener, close, getControl, getControls, getLineInfo, isControlSupported, isOpen, open, removeLineListener
 

Method Detail

available

int available()
Return the number of bytes currently available on this DataLine.


drain

void drain()
This method blocks until whatever data is buffered in the DataLine's internal buffer has been drained.


flush

void flush()
This flushes the DataLine by discarding any buffered data.


getBufferSize

int getBufferSize()
Returns the size of the DataLine's internal buffer, in bytes.


getFormat

AudioFormat getFormat()
Return the current format of the data associated with this DataLine.


getFramePosition

int getFramePosition()
Return the current frame position.


getLevel

float getLevel()
Return the volume level for this DataLine.


getLongFramePosition

long getLongFramePosition()
Return the current frame position.

Since:
1.5

getMicrosecondPosition

long getMicrosecondPosition()
Return the number of microseconds this DataLine has been playing.


isActive

boolean isActive()
Return true if this line is active, meaning that it is actively performing audio I/O.


isRunning

boolean isRunning()
Return true if this line is running, meaning that it has been started. When the line is stopped, this method will return false.


start

void start()
Start processing data. This will emit a START event.


stop

void stop()
Stop processing data. This will emit a STOP event.