javax.sound.sampled

Interface DataLine

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 classDataLine.Info
This class extends Line.Info with information specific to DataLine.
Method Summary
intavailable()
Return the number of bytes currently available on this DataLine.
voiddrain()
This method blocks until whatever data is buffered in the DataLine's internal buffer has been drained.
voidflush()
This flushes the DataLine by discarding any buffered data.
intgetBufferSize()
Returns the size of the DataLine's internal buffer, in bytes.
AudioFormatgetFormat()
Return the current format of the data associated with this DataLine.
intgetFramePosition()
Return the current frame position.
floatgetLevel()
Return the volume level for this DataLine.
longgetLongFramePosition()
Return the current frame position.
longgetMicrosecondPosition()
Return the number of microseconds this DataLine has been playing.
booleanisActive()
Return true if this line is active, meaning that it is actively performing audio I/O.
booleanisRunning()
Return true if this line is running, meaning that it has been started.
voidstart()
Start processing data.
voidstop()
Stop processing data.

Method Detail

available

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

drain

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

flush

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

getBufferSize

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

getFormat

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

getFramePosition

public int getFramePosition()
Return the current frame position.

getLevel

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

getLongFramePosition

public long getLongFramePosition()
Return the current frame position.

Since: 1.5

getMicrosecondPosition

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

isActive

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

isRunning

public 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

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

stop

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