public interface DataLine extends Line
DataLine adds media-related functionality to its
 superinterface, LineSourceDataLineClipTargetDataLine
 A data line has an internal buffer in which
 the incoming or outgoing audio data is queued.  The
 drain()flush()
 A data line produces STARTSTOPstart()START event will be generated shortly, when data playback
 or capture actually begins.  Or, if the flow of data to an active data
 line is constricted so that a gap occurs in the presentation of data,
 a STOP event is generated.
 
 Mixers often support synchronized control of multiple data lines.
 Synchronization can be established through the Mixer interface's
 synchronizeMixer
LineEvent| Modifier and Type | Interface and Description | 
|---|---|
| static class  | DataLine.InfoBesides the class information inherited from its superclass,
  DataLine.Infoprovides additional information specific to data lines. | 
| Modifier and Type | Method and Description | 
|---|---|
| int | available()Obtains the number of bytes of data currently available to the
 application for processing in the data line's internal buffer. | 
| void | drain()Drains queued data from the line by continuing data I/O until the
 data line's internal buffer has been emptied. | 
| void | flush()Flushes queued data from the line. | 
| int | getBufferSize()Obtains the maximum number of bytes of data that will fit in the data line's
 internal buffer. | 
| AudioFormat | getFormat()Obtains the current format (encoding, sample rate, number of channels,
 etc.) of the data line's audio data. | 
| int | getFramePosition()Obtains the current position in the audio data, in sample frames. | 
| float | getLevel()Obtains the current volume level for the line. | 
| long | getLongFramePosition()Obtains the current position in the audio data, in sample frames. | 
| long | getMicrosecondPosition()Obtains the current position in the audio data, in microseconds. | 
| boolean | isActive()Indicates whether the line is engaging in active I/O (such as playback
 or capture). | 
| boolean | isRunning()Indicates whether the line is running. | 
| void | start()Allows a line to engage in data I/O. | 
| void | stop()Stops the line. | 
addLineListener, close, getControl, getControls, getLineInfo, isControlSupported, isOpen, open, removeLineListenervoid drain()
drain()
 is invoked on a stopped line that has data in its queue, the method will
 block until the line is running and the data queue becomes empty.  If
 drain() is invoked by one thread, and another continues to
 fill the data queue, the operation will not complete.
 This method always returns when the data line is closed.flush()void flush()
void start()
STARTstop(), 
isRunning(), 
LineEventvoid stop()
flush method.
 When audio capture or playback stops, a STOPstart(), 
isRunning(), 
flush(), 
LineEventboolean isRunning()
false.
 An open line begins running when the first data is presented in response to an
 invocation of the start method, and continues
 until presentation ceases in response to a call to stop or
 because playback completes.boolean isActive()
STARTSTOPtrue if the line is actively capturing or rendering
 sound, otherwise falseLine.isOpen(), 
Line.addLineListener(javax.sound.sampled.LineListener), 
Line.removeLineListener(javax.sound.sampled.LineListener), 
LineEvent, 
LineListenerAudioFormat getFormat()
If the line is not open and has never been opened, it returns
 the default format. The default format is an implementation
 specific audio format, or, if the DataLine.Info
 object, which was used to retrieve this DataLine,
 specifies at least one fully qualified audio format, the
 last one will be used as the default format. Opening the
 line with a specific audio format (e.g.
 SourceDataLine.open(AudioFormat)) will override the
 default format.
AudioFormatint getBufferSize()
int available()
Note that the units used are bytes, but will always correspond to an integral number of sample frames of audio data.
 An application is guaranteed that a read or
 write operation of up to the number of bytes returned from
 available() will not block; however, there is no guarantee
 that attempts to read or write more data will block.
int getFramePosition()
getLongFramePosition instead.getLongFramePosition()long getLongFramePosition()
long getMicrosecondPosition()
float getLevel()
AudioSystem.NOT_SPECIFIED Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2017, Oracle and/or its affiliates.  All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.