On this page
Class DataLine.Info
- Enclosing interface:
- DataLine
public static class DataLine.Info extends Line.Info
DataLine.Info
provides additional information specific to data lines. This information includes:
- the audio formats supported by the data line
- the minimum and maximum sizes of its internal buffer
Line.Info
knows the class of the line its describes, a DataLine.Info
object can describe DataLine
subinterfaces such as SourceDataLine
, TargetDataLine
, and Clip
. You can query a mixer for lines of any of these types, passing an appropriate instance of DataLine.Info
as the argument to a method such as Mixer.getLine(Line.Info)
.
- Since:
- 1.3
- See Also:
Constructor Summary
Constructor | Description |
---|---|
Info |
Constructs a data line's info object from the specified information, which includes a single audio format.
|
Info |
Constructs a data line's info object from the specified information, which includes a set of supported audio formats and a range for the buffer size.
|
Info |
Constructs a data line's info object from the specified information, which includes a single audio format and a desired buffer size.
|
Method Summary
Modifier and Type | Method | Description |
---|---|---|
AudioFormat[] |
getFormats() |
Obtains a set of audio formats supported by the data line.
|
int |
getMaxBufferSize() |
Obtains the maximum buffer size supported by the data line.
|
int |
getMinBufferSize() |
Obtains the minimum buffer size supported by the data line.
|
boolean |
isFormatSupported |
Indicates whether this data line supports a particular audio format.
|
boolean |
matches |
Determines whether the specified info object matches this one.
|
String |
toString() |
Returns a string representation of the info object.
|
Methods declared in class javax.sound.sampled.Line.Info
getLineClass
Constructor Details
Info
public Info(Class<?> lineClass, AudioFormat[] formats, int minBufferSize, int maxBufferSize)
- Parameters:
lineClass
- the class of the data line described by the info objectformats
- set of formats supportedminBufferSize
- minimum buffer size supported by the data line, in bytesmaxBufferSize
- maximum buffer size supported by the data line, in bytes
Info
public Info(Class<?> lineClass, AudioFormat format, int bufferSize)
- Parameters:
lineClass
- the class of the data line described by the info objectformat
- desired formatbufferSize
- desired buffer size, in bytes
Info
public Info(Class<?> lineClass, AudioFormat format)
- Parameters:
lineClass
- the class of the data line described by the info objectformat
- desired format
Method Details
getFormats
public AudioFormat[] getFormats()
isFormatSupported(AudioFormat)
might return true
for certain additional formats that are missing from the set returned by getFormats()
. The reverse is not the case: isFormatSupported(AudioFormat)
is guaranteed to return true
for all formats returned by getFormats()
.
Some fields in the AudioFormat
instances can be set to NOT_SPECIFIED
if that field does not apply to the format, or if the format supports a wide range of values for that field. For example, a multi-channel device supporting up to 64 channels, could set the channel field in the AudioFormat
instances returned by this method to NOT_SPECIFIED
.
- Returns:
- a set of supported audio formats
- See Also:
isFormatSupported
public boolean isFormatSupported(AudioFormat format)
true
if the specified format matches any of the supported formats.
- Parameters:
format
- the audio format for which support is queried- Returns:
true
if the format is supported, otherwisefalse
- See Also:
getMinBufferSize
public int getMinBufferSize()
- Returns:
-
minimum buffer size in bytes, or
AudioSystem.NOT_SPECIFIED
getMaxBufferSize
public int getMaxBufferSize()
- Returns:
-
maximum buffer size in bytes, or
AudioSystem.NOT_SPECIFIED
matches
public boolean matches(Line.Info info)
toString
public String toString()
© 1993, 2021, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/sound/sampled/DataLine.Info.html