Java Doc for AudioSystem.java in  » 6.0-JDK-Core » sound » javax » sound » sampled » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » sound » javax.sound.sampled 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.sound.sampled.AudioSystem

AudioSystem
public class AudioSystem (Code)
The AudioSystem class acts as the entry point to the sampled-audio system resources. This class lets you query and access the mixers that are installed on the system. AudioSystem includes a number of methods for converting audio data between different formats, and for translating between audio files and streams. It also provides a method for obtaining a Line directly from the AudioSystem without dealing explicitly with mixers.

Properties can be used to specify the default mixer for specific line types. Both system properties and a properties file are considered. In the Sun reference implementation, the properties file is "lib/sound.properties" in the JRE directory. If a property exists both as a system property and in the properties file, the system property takes precedence. If none is specified, a suitable default is chosen among the available devices. The syntax of the properties file is specified in java.util.Properties.load(InputStream) Properties.load . The following table lists the available property keys and which methods consider them:
Property Key Interface Affected Method(s)
javax.sound.sampled.Clip Clip AudioSystem.getLine , AudioSystem.getClip
javax.sound.sampled.Port Port AudioSystem.getLine
javax.sound.sampled.SourceDataLine SourceDataLine AudioSystem.getLine , AudioSystem.getSourceDataLine
javax.sound.sampled.TargetDataLine TargetDataLine AudioSystem.getLine , AudioSystem.getTargetDataLine
The property value consists of the provider class name and the mixer name, separated by the hash mark ("#"). The provider class name is the fully-qualified name of a concrete javax.sound.sampled.spi.MixerProvidermixer provider class. The mixer name is matched against the String returned by the getName method of Mixer.Info. Either the class name, or the mixer name may be omitted. If only the class name is specified, the trailing hash mark is optional.

If the provider class is specified, and it can be successully retrieved from the installed providers, the list of Mixer.Info objects is retrieved from the provider. Otherwise, or when these mixers do not provide a subsequent match, the list is retrieved from AudioSystem.getMixerInfo to contain all available Mixer.Info objects.

If a mixer name is specified, the resulting list of Mixer.Info objects is searched: the first one with a matching name, and whose Mixer provides the respective line interface, will be returned. If no matching Mixer.Info object is found, or the mixer name is not specified, the first mixer from the resulting list, which provides the respective line interface, will be returned. For example, the property javax.sound.sampled.Clip with a value "com.sun.media.sound.MixerProvider#SunClip" will have the following consequences when getLine is called requesting a Clip instance: if the class com.sun.media.sound.MixerProvider exists in the list of installed mixer providers, the first Clip from the first mixer with name "SunClip" will be returned. If it cannot be found, the first Clip from the first mixer of the specified provider will be returned, regardless of name. If there is none, the first Clip from the first Mixer with name "SunClip" in the list of all mixers (as returned by getMixerInfo) will be returned, or, if not found, the first Clip of the first Mixerthat can be found in the list of all mixers is returned. If that fails, too, an IllegalArgumentException is thrown.
author:
   Kara Kytle
author:
   Florian Bomers
author:
   Matthias Pfisterer
author:
   Kevin P. Smith
version:
   1.89, 07/05/05
See Also:   AudioFormat
See Also:   AudioInputStream
See Also:   Mixer
See Also:   Line
See Also:   Line.Info
since:
   1.3



Field Summary
final public static  intNOT_SPECIFIED
     An integer that stands for an unknown numeric value. This value is appropriate only for signed quantities that do not normally take negative values.


Method Summary
public static  AudioFileFormatgetAudioFileFormat(InputStream stream)
     Obtains the audio file format of the provided input stream.
public static  AudioFileFormatgetAudioFileFormat(URL url)
     Obtains the audio file format of the specified URL.
public static  AudioFileFormatgetAudioFileFormat(File file)
     Obtains the audio file format of the specified File.
public static  AudioFileFormat.Type[]getAudioFileTypes()
     Obtains the file types for which file writing support is provided by the system. array of unique file types.
public static  AudioFileFormat.Type[]getAudioFileTypes(AudioInputStream stream)
     Obtains the file types that the system can write from the audio input stream specified.
Parameters:
  stream - the audio input stream for which audio file type supportis queried array of file types.
public static  AudioInputStreamgetAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream)
     Obtains an audio input stream of the indicated encoding, by converting the provided audio input stream.
public static  AudioInputStreamgetAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream)
     Obtains an audio input stream of the indicated format, by converting the provided audio input stream.
public static  AudioInputStreamgetAudioInputStream(InputStream stream)
     Obtains an audio input stream from the provided input stream.
public static  AudioInputStreamgetAudioInputStream(URL url)
     Obtains an audio input stream from the URL provided.
public static  AudioInputStreamgetAudioInputStream(File file)
     Obtains an audio input stream from the provided File.
public static  ClipgetClip()
     Obtains a clip that can be used for playing back an audio file or an audio stream.
public static  ClipgetClip(Mixer.Info mixerInfo)
     Obtains a clip from the specified mixer that can be used for playing back an audio file or an audio stream.
public static  LinegetLine(Line.Info info)
     Obtains a line that matches the description in the specified Line.Info object.

If a DataLine is requested, and info is an instance of DataLine.Info specifying at least one fully qualified audio format, the last one will be used as the default format of the returned DataLine.

If system properties javax.sound.sampled.Clip, javax.sound.sampled.Port, javax.sound.sampled.SourceDataLine and javax.sound.sampled.TargetDataLine are defined or they are defined in the file "sound.properties", they are used to retrieve default lines. For details, refer to the AudioSystem class description . If the respective property is not set, or the mixer requested in the property is not installed or does not provide the requested line, all installed mixers are queried for the requested line type.

public static  MixergetMixer(Mixer.Info info)
     Obtains the requested audio mixer.
public static  Mixer.Info[]getMixerInfo()
     Obtains an array of mixer info objects that represents the set of audio mixers that are currently installed on the system. an array of info objects for the currently installed mixers.
public static  SourceDataLinegetSourceDataLine(AudioFormat format)
     Obtains a source data line that can be used for playing back audio data in the format specified by the AudioFormat object.
public static  SourceDataLinegetSourceDataLine(AudioFormat format, Mixer.Info mixerinfo)
     Obtains a source data line that can be used for playing back audio data in the format specified by the AudioFormat object, provided by the mixer specified by the Mixer.Info object.
public static  Line.Info[]getSourceLineInfo(Line.Info info)
     Obtains information about all source lines of a particular type that are supported by the installed mixers.
Parameters:
  info - a Line.Info object that specifies the kind oflines about which information is requested an array of Line.Info objects describing source lines matchingthe type requested.
public static  TargetDataLinegetTargetDataLine(AudioFormat format)
     Obtains a target data line that can be used for recording audio data in the format specified by the AudioFormat object.
public static  TargetDataLinegetTargetDataLine(AudioFormat format, Mixer.Info mixerinfo)
     Obtains a target data line that can be used for recording audio data in the format specified by the AudioFormat object, provided by the mixer specified by the Mixer.Info object.
public static  AudioFormat.Encoding[]getTargetEncodings(AudioFormat.Encoding sourceEncoding)
     Obtains the encodings that the system can obtain from an audio input stream with the specified encoding using the set of installed format converters.
Parameters:
  sourceEncoding - the encoding for which conversion supportis queried array of encodings.
public static  AudioFormat.Encoding[]getTargetEncodings(AudioFormat sourceFormat)
     Obtains the encodings that the system can obtain from an audio input stream with the specified format using the set of installed format converters.
Parameters:
  sourceFormat - the audio format for which conversionis queried array of encodings.
public static  AudioFormat[]getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat)
     Obtains the formats that have a particular encoding and that the system can obtain from a stream of the specified format using the set of installed format converters.
Parameters:
  targetEncoding - the desired encoding after conversion
Parameters:
  sourceFormat - the audio format before conversion array of formats.
public static  Line.Info[]getTargetLineInfo(Line.Info info)
     Obtains information about all target lines of a particular type that are supported by the installed mixers.
Parameters:
  info - a Line.Info object that specifies the kind oflines about which information is requested an array of Line.Info objects describing target lines matchingthe type requested.
public static  booleanisConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat)
     Indicates whether an audio input stream of the specified encoding can be obtained from an audio input stream that has the specified format.
public static  booleanisConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat)
     Indicates whether an audio input stream of a specified format can be obtained from an audio input stream of another specified format.
public static  booleanisFileTypeSupported(AudioFileFormat.Type fileType)
     Indicates whether file writing support for the specified file type is provided by the system.
public static  booleanisFileTypeSupported(AudioFileFormat.Type fileType, AudioInputStream stream)
     Indicates whether an audio file of the specified file type can be written from the indicated audio input stream.
public static  booleanisLineSupported(Line.Info info)
     Indicates whether the system supports any lines that match the specified Line.Info object.
public static  intwrite(AudioInputStream stream, AudioFileFormat.Type fileType, OutputStream out)
     Writes a stream of bytes representing an audio file of the specified file type to the output stream provided.
public static  intwrite(AudioInputStream stream, AudioFileFormat.Type fileType, File out)
     Writes a stream of bytes representing an audio file of the specified file type to the external file provided.

Field Detail
NOT_SPECIFIED
final public static int NOT_SPECIFIED(Code)
An integer that stands for an unknown numeric value. This value is appropriate only for signed quantities that do not normally take negative values. Examples include file sizes, frame sizes, buffer sizes, and sample rates. A number of Java Sound constructors accept a value of NOT_SPECIFIED for such parameters. Other methods may also accept or return this value, as documented.





Method Detail
getAudioFileFormat
public static AudioFileFormat getAudioFileFormat(InputStream stream) throws UnsupportedAudioFileException, IOException(Code)
Obtains the audio file format of the provided input stream. The stream must point to valid audio file data. The implementation of this method may require multiple parsers to examine the stream to determine whether they support it. These parsers must be able to mark the stream, read enough data to determine whether they support the stream, and, if not, reset the stream's read pointer to its original position. If the input stream does not support these operations, this method may fail with an IOException.
Parameters:
  stream - the input stream from which file format information should beextracted an AudioFileFormat object describing the stream's audio file format
throws:
  UnsupportedAudioFileException - if the stream does not point to valid audiofile data recognized by the system
throws:
  IOException - if an input/output exception occurs
See Also:   InputStream.markSupported
See Also:   InputStream.mark



getAudioFileFormat
public static AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException(Code)
Obtains the audio file format of the specified URL. The URL must point to valid audio file data.
Parameters:
  url - the URL from which file format information should beextracted an AudioFileFormat object describing the audio file format
throws:
  UnsupportedAudioFileException - if the URL does not point to valid audiofile data recognized by the system
throws:
  IOException - if an input/output exception occurs



getAudioFileFormat
public static AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException, IOException(Code)
Obtains the audio file format of the specified File. The File must point to valid audio file data.
Parameters:
  file - the File from which file format information should beextracted an AudioFileFormat object describing the audio file format
throws:
  UnsupportedAudioFileException - if the File does not point to valid audiofile data recognized by the system
throws:
  IOException - if an I/O exception occurs



getAudioFileTypes
public static AudioFileFormat.Type[] getAudioFileTypes()(Code)
Obtains the file types for which file writing support is provided by the system. array of unique file types. If no file types are supported,an array of length 0 is returned.



getAudioFileTypes
public static AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream)(Code)
Obtains the file types that the system can write from the audio input stream specified.
Parameters:
  stream - the audio input stream for which audio file type supportis queried array of file types. If no file types are supported,an array of length 0 is returned.



getAudioInputStream
public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream)(Code)
Obtains an audio input stream of the indicated encoding, by converting the provided audio input stream.
Parameters:
  targetEncoding - the desired encoding after conversion
Parameters:
  sourceStream - the stream to be converted an audio input stream of the indicated encoding
throws:
  IllegalArgumentException - if the conversion is not supported
See Also:   AudioSystem.getTargetEncodings(AudioFormat.Encoding)
See Also:   AudioSystem.getTargetEncodings(AudioFormat)
See Also:   AudioSystem.isConversionSupported(AudioFormat.Encoding,AudioFormat)
See Also:   AudioSystem.getAudioInputStream(AudioFormat,AudioInputStream)



getAudioInputStream
public static AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream)(Code)
Obtains an audio input stream of the indicated format, by converting the provided audio input stream.
Parameters:
  targetFormat - the desired audio format after conversion
Parameters:
  sourceStream - the stream to be converted an audio input stream of the indicated format
throws:
  IllegalArgumentException - if the conversion is not supported#see #getTargetEncodings(AudioFormat)
See Also:   AudioSystem.getTargetFormats(AudioFormat.Encoding,AudioFormat)
See Also:   AudioSystem.isConversionSupported(AudioFormat,AudioFormat)
See Also:   AudioSystem.getAudioInputStream(AudioFormat.Encoding,AudioInputStream)



getAudioInputStream
public static AudioInputStream getAudioInputStream(InputStream stream) throws UnsupportedAudioFileException, IOException(Code)
Obtains an audio input stream from the provided input stream. The stream must point to valid audio file data. The implementation of this method may require multiple parsers to examine the stream to determine whether they support it. These parsers must be able to mark the stream, read enough data to determine whether they support the stream, and, if not, reset the stream's read pointer to its original position. If the input stream does not support these operation, this method may fail with an IOException.
Parameters:
  stream - the input stream from which the AudioInputStream should beconstructed an AudioInputStream object based on the audio file data containedin the input stream.
throws:
  UnsupportedAudioFileException - if the stream does not point to valid audiofile data recognized by the system
throws:
  IOException - if an I/O exception occurs
See Also:   InputStream.markSupported
See Also:   InputStream.mark



getAudioInputStream
public static AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException(Code)
Obtains an audio input stream from the URL provided. The URL must point to valid audio file data.
Parameters:
  url - the URL for which the AudioInputStream should beconstructed an AudioInputStream object based on the audio file data pointedto by the URL
throws:
  UnsupportedAudioFileException - if the URL does not point to valid audiofile data recognized by the system
throws:
  IOException - if an I/O exception occurs



getAudioInputStream
public static AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException(Code)
Obtains an audio input stream from the provided File. The File must point to valid audio file data.
Parameters:
  file - the File for which the AudioInputStream should beconstructed an AudioInputStream object based on the audio file data pointedto by the File
throws:
  UnsupportedAudioFileException - if the File does not point to valid audiofile data recognized by the system
throws:
  IOException - if an I/O exception occurs



getClip
public static Clip getClip() throws LineUnavailableException(Code)
Obtains a clip that can be used for playing back an audio file or an audio stream. The returned clip will be provided by the default system mixer, or, if not possible, by any other mixer installed in the system that supports a Clip object.

The returned clip must be opened with the open(AudioFormat) or open(AudioInputStream) method.

This is a high-level method that uses getMixer and getLine internally.

If the system property javax.sound.sampled.Clip is defined or it is defined in the file "sound.properties", it is used to retrieve the default clip. For details, refer to the AudioSystem class description . the desired clip object
throws:
  LineUnavailableException - if a clip objectis not available due to resource restrictions
throws:
  SecurityException - if a clip objectis not available due to security restrictions
throws:
  IllegalArgumentException - if the system does notsupport at least one clip instance through any installed mixer
See Also:   AudioSystem.getClip(Mixer.Info)
since:
   1.5




getClip
public static Clip getClip(Mixer.Info mixerInfo) throws LineUnavailableException(Code)
Obtains a clip from the specified mixer that can be used for playing back an audio file or an audio stream.

The returned clip must be opened with the open(AudioFormat) or open(AudioInputStream) method.

This is a high-level method that uses getMixer and getLine internally.
Parameters:
  mixerInfo - a Mixer.Info object representing thedesired mixer, or null for the system default mixer a clip object from the specified mixer
throws:
  LineUnavailableException - if a clipis not available from this mixer due to resource restrictions
throws:
  SecurityException - if a clipis not available from this mixer due to security restrictions
throws:
  IllegalArgumentException - if the system does notsupport at least one clip through the specified mixer
See Also:   AudioSystem.getClip()
since:
   1.5




getLine
public static Line getLine(Line.Info info) throws LineUnavailableException(Code)
Obtains a line that matches the description in the specified Line.Info object.

If a DataLine is requested, and info is an instance of DataLine.Info specifying at least one fully qualified audio format, the last one will be used as the default format of the returned DataLine.

If system properties javax.sound.sampled.Clip, javax.sound.sampled.Port, javax.sound.sampled.SourceDataLine and javax.sound.sampled.TargetDataLine are defined or they are defined in the file "sound.properties", they are used to retrieve default lines. For details, refer to the AudioSystem class description . If the respective property is not set, or the mixer requested in the property is not installed or does not provide the requested line, all installed mixers are queried for the requested line type. A Line will be returned from the first mixer providing the requested line type.
Parameters:
  info - a Line.Info object describing the desired kind of line a line of the requested kind
throws:
  LineUnavailableException - if a matching lineis not available due to resource restrictions
throws:
  SecurityException - if a matching lineis not available due to security restrictions
throws:
  IllegalArgumentException - if the system does notsupport at least one line matching the specifiedLine.Info objectthrough any installed mixer




getMixer
public static Mixer getMixer(Mixer.Info info)(Code)
Obtains the requested audio mixer.
Parameters:
  info - a Mixer.Info object representing the desiredmixer, or null for the system default mixer the requested mixer
throws:
  SecurityException - if the requested mixeris unavailable because of security restrictions
throws:
  IllegalArgumentException - if the info object does not representa mixer installed on the system
See Also:   AudioSystem.getMixerInfo



getMixerInfo
public static Mixer.Info[] getMixerInfo()(Code)
Obtains an array of mixer info objects that represents the set of audio mixers that are currently installed on the system. an array of info objects for the currently installed mixers. If no mixersare available on the system, an array of length 0 is returned.
See Also:   AudioSystem.getMixer



getSourceDataLine
public static SourceDataLine getSourceDataLine(AudioFormat format) throws LineUnavailableException(Code)
Obtains a source data line that can be used for playing back audio data in the format specified by the AudioFormat object. The returned line will be provided by the default system mixer, or, if not possible, by any other mixer installed in the system that supports a matching SourceDataLine object.

The returned line should be opened with the open(AudioFormat) or open(AudioFormat, int) method.

This is a high-level method that uses getMixer and getLine internally.

The returned SourceDataLine's default audio format will be initialized with format.

If the system property javax.sound.sampled.SourceDataLine is defined or it is defined in the file "sound.properties", it is used to retrieve the default source data line. For details, refer to the AudioSystem class description .
Parameters:
  format - an AudioFormat object specifyingthe supported audio format of the returned line,or null for any audio format the desired SourceDataLine object
throws:
  LineUnavailableException - if a matching source data lineis not available due to resource restrictions
throws:
  SecurityException - if a matching source data lineis not available due to security restrictions
throws:
  IllegalArgumentException - if the system does notsupport at least one source data line supporting thespecified audio format through any installed mixer
See Also:   AudioSystem.getSourceDataLine(AudioFormat,Mixer.Info)
since:
   1.5




getSourceDataLine
public static SourceDataLine getSourceDataLine(AudioFormat format, Mixer.Info mixerinfo) throws LineUnavailableException(Code)
Obtains a source data line that can be used for playing back audio data in the format specified by the AudioFormat object, provided by the mixer specified by the Mixer.Info object.

The returned line should be opened with the open(AudioFormat) or open(AudioFormat, int) method.

This is a high-level method that uses getMixer and getLine internally.

The returned SourceDataLine's default audio format will be initialized with format.
Parameters:
  format - an AudioFormat object specifyingthe supported audio format of the returned line,or null for any audio format
Parameters:
  mixerinfo - a Mixer.Info object representingthe desired mixer, or null for the systemdefault mixer the desired SourceDataLine object
throws:
  LineUnavailableException - if a matching source dataline is not available from the specified mixer dueto resource restrictions
throws:
  SecurityException - if a matching source data lineis not available from the specified mixer due tosecurity restrictions
throws:
  IllegalArgumentException - if the specified mixer doesnot support at least one source data line supportingthe specified audio format
See Also:   AudioSystem.getSourceDataLine(AudioFormat)
since:
   1.5




getSourceLineInfo
public static Line.Info[] getSourceLineInfo(Line.Info info)(Code)
Obtains information about all source lines of a particular type that are supported by the installed mixers.
Parameters:
  info - a Line.Info object that specifies the kind oflines about which information is requested an array of Line.Info objects describing source lines matchingthe type requested. If no matching source lines are supported, an array of length 0is returned.
See Also:   Mixer.getSourceLineInfo(Line.Info)



getTargetDataLine
public static TargetDataLine getTargetDataLine(AudioFormat format) throws LineUnavailableException(Code)
Obtains a target data line that can be used for recording audio data in the format specified by the AudioFormat object. The returned line will be provided by the default system mixer, or, if not possible, by any other mixer installed in the system that supports a matching TargetDataLine object.

The returned line should be opened with the open(AudioFormat) or open(AudioFormat, int) method.

This is a high-level method that uses getMixer and getLine internally.

The returned TargetDataLine's default audio format will be initialized with format.
Parameters:
  format - an AudioFormat object specifyingthe supported audio format of the returned line,or null for any audio format the desired TargetDataLine object
throws:
  LineUnavailableException - if a matching target data lineis not available due to resource restrictions
throws:
  SecurityException - if a matching target data lineis not available due to security restrictions
throws:
  IllegalArgumentException - if the system does notsupport at least one target data line supporting thespecified audio format through any installed mixer
See Also:   AudioSystem.getTargetDataLine(AudioFormat,Mixer.Info)
See Also:   AudioPermission
since:
   1.5




getTargetDataLine
public static TargetDataLine getTargetDataLine(AudioFormat format, Mixer.Info mixerinfo) throws LineUnavailableException(Code)
Obtains a target data line that can be used for recording audio data in the format specified by the AudioFormat object, provided by the mixer specified by the Mixer.Info object.

The returned line should be opened with the open(AudioFormat) or open(AudioFormat, int) method.

This is a high-level method that uses getMixer and getLine internally.

The returned TargetDataLine's default audio format will be initialized with format.

If the system property javax.sound.sampled.TargetDataLine is defined or it is defined in the file "sound.properties", it is used to retrieve the default target data line. For details, refer to the AudioSystem class description .
Parameters:
  format - an AudioFormat object specifyingthe supported audio format of the returned line,or null for any audio format
Parameters:
  mixerinfo - a Mixer.Info object representing thedesired mixer, or null for the system default mixer the desired TargetDataLine object
throws:
  LineUnavailableException - if a matching target dataline is not available from the specified mixer dueto resource restrictions
throws:
  SecurityException - if a matching target data lineis not available from the specified mixer due tosecurity restrictions
throws:
  IllegalArgumentException - if the specified mixer doesnot support at least one target data line supportingthe specified audio format
See Also:   AudioSystem.getTargetDataLine(AudioFormat)
See Also:   AudioPermission
since:
   1.5




getTargetEncodings
public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat.Encoding sourceEncoding)(Code)
Obtains the encodings that the system can obtain from an audio input stream with the specified encoding using the set of installed format converters.
Parameters:
  sourceEncoding - the encoding for which conversion supportis queried array of encodings. If sourceEncodingis not supported,an array of length 0 is returned. Otherwise, the array will have a lengthof at least 1, representing sourceEncoding (no conversion).



getTargetEncodings
public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat)(Code)
Obtains the encodings that the system can obtain from an audio input stream with the specified format using the set of installed format converters.
Parameters:
  sourceFormat - the audio format for which conversionis queried array of encodings. If sourceFormatis not supported,an array of length 0 is returned. Otherwise, the array will have a lengthof at least 1, representing the encoding of sourceFormat (no conversion).



getTargetFormats
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat)(Code)
Obtains the formats that have a particular encoding and that the system can obtain from a stream of the specified format using the set of installed format converters.
Parameters:
  targetEncoding - the desired encoding after conversion
Parameters:
  sourceFormat - the audio format before conversion array of formats. If no formats of the specifiedencoding are supported, an array of length 0 is returned.



getTargetLineInfo
public static Line.Info[] getTargetLineInfo(Line.Info info)(Code)
Obtains information about all target lines of a particular type that are supported by the installed mixers.
Parameters:
  info - a Line.Info object that specifies the kind oflines about which information is requested an array of Line.Info objects describing target lines matchingthe type requested. If no matching target lines are supported, an array of length 0is returned.
See Also:   Mixer.getTargetLineInfo(Line.Info)



isConversionSupported
public static boolean isConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat)(Code)
Indicates whether an audio input stream of the specified encoding can be obtained from an audio input stream that has the specified format.
Parameters:
  targetEncoding - the desired encoding after conversion
Parameters:
  sourceFormat - the audio format before conversion true if the conversion is supported,otherwise false



isConversionSupported
public static boolean isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat)(Code)
Indicates whether an audio input stream of a specified format can be obtained from an audio input stream of another specified format.
Parameters:
  targetFormat - the desired audio format after conversion
Parameters:
  sourceFormat - the audio format before conversion true if the conversion is supported,otherwise false



isFileTypeSupported
public static boolean isFileTypeSupported(AudioFileFormat.Type fileType)(Code)
Indicates whether file writing support for the specified file type is provided by the system.
Parameters:
  fileType - the file type for which write capabilities are queried true if the file type is supported,otherwise false



isFileTypeSupported
public static boolean isFileTypeSupported(AudioFileFormat.Type fileType, AudioInputStream stream)(Code)
Indicates whether an audio file of the specified file type can be written from the indicated audio input stream.
Parameters:
  fileType - the file type for which write capabilities are queried
Parameters:
  stream - the stream for which file-writing support is queried true if the file type is supported for this audio input stream,otherwise false



isLineSupported
public static boolean isLineSupported(Line.Info info)(Code)
Indicates whether the system supports any lines that match the specified Line.Info object. A line is supported if any installed mixer supports it.
Parameters:
  info - a Line.Info object describing the line for which support is queried true if at least one matching line issupported, otherwise false
See Also:   Mixer.isLineSupported(Line.Info)



write
public static int write(AudioInputStream stream, AudioFileFormat.Type fileType, OutputStream out) throws IOException(Code)
Writes a stream of bytes representing an audio file of the specified file type to the output stream provided. Some file types require that the length be written into the file header; such files cannot be written from start to finish unless the length is known in advance. An attempt to write a file of such a type will fail with an IOException if the length in the audio file type is AudioSystem.NOT_SPECIFIED.
Parameters:
  stream - the audio input stream containing audio data to bewritten to the file
Parameters:
  fileType - the kind of audio file to write
Parameters:
  out - the stream to which the file data should be written the number of bytes written to the output stream
throws:
  IOException - if an input/output exception occurs
throws:
  IllegalArgumentException - if the file type is not supported bythe system
See Also:   AudioSystem.isFileTypeSupported
See Also:   AudioSystem.getAudioFileTypes



write
public static int write(AudioInputStream stream, AudioFileFormat.Type fileType, File out) throws IOException(Code)
Writes a stream of bytes representing an audio file of the specified file type to the external file provided.
Parameters:
  stream - the audio input stream containing audio data to bewritten to the file
Parameters:
  fileType - the kind of audio file to write
Parameters:
  out - the external file to which the file data should be written the number of bytes written to the file
throws:
  IOException - if an I/O exception occurs
throws:
  IllegalArgumentException - if the file type is not supported bythe system
See Also:   AudioSystem.isFileTypeSupported
See Also:   AudioSystem.getAudioFileTypes



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.