本文整理汇总了Java中javax.sound.sampled.spi.FormatConversionProvider.isSourceEncodingSupported方法的典型用法代码示例。如果您正苦于以下问题:Java FormatConversionProvider.isSourceEncodingSupported方法的具体用法?Java FormatConversionProvider.isSourceEncodingSupported怎么用?Java FormatConversionProvider.isSourceEncodingSupported使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.sound.sampled.spi.FormatConversionProvider
的用法示例。
在下文中一共展示了FormatConversionProvider.isSourceEncodingSupported方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTargetEncodings
import javax.sound.sampled.spi.FormatConversionProvider; //导入方法依赖的package包/类
/**
* Obtains the encodings that the system can obtain from an
* audio input stream with the specified encoding using the set
* of installed format converters.
* @param sourceEncoding the encoding for which conversion support
* is queried
* @return array of encodings. If <code>sourceEncoding</code>is not supported,
* an array of length 0 is returned. Otherwise, the array will have a length
* of at least 1, representing <code>sourceEncoding</code> (no conversion).
*/
public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat.Encoding sourceEncoding) {
List codecs = getFormatConversionProviders();
Vector encodings = new Vector();
AudioFormat.Encoding encs[] = null;
// gather from all the codecs
for(int i=0; i<codecs.size(); i++ ) {
FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
if( codec.isSourceEncodingSupported( sourceEncoding ) ) {
encs = codec.getTargetEncodings();
for (int j = 0; j < encs.length; j++) {
encodings.addElement( encs[j] );
}
}
}
AudioFormat.Encoding encs2[] = (AudioFormat.Encoding[]) encodings.toArray(new AudioFormat.Encoding[0]);
return encs2;
}
示例2: getTargetEncodings
import javax.sound.sampled.spi.FormatConversionProvider; //导入方法依赖的package包/类
/**
* Obtains the encodings that the system can obtain from an audio input
* stream with the specified encoding using the set of installed format
* converters.
*
* @param sourceEncoding the encoding for which conversion support is
* queried
* @return array of encodings. If {@code sourceEncoding} is not supported,
* an array of length 0 is returned. Otherwise, the array will have
* a length of at least 1, representing {@code sourceEncoding}
* (no conversion).
* @throws NullPointerException if {@code sourceEncoding} is {@code null}
*/
public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat.Encoding sourceEncoding) {
Objects.requireNonNull(sourceEncoding);
List<FormatConversionProvider> codecs = getFormatConversionProviders();
Vector<AudioFormat.Encoding> encodings = new Vector<>();
AudioFormat.Encoding encs[] = null;
// gather from all the codecs
for(int i=0; i<codecs.size(); i++ ) {
FormatConversionProvider codec = codecs.get(i);
if( codec.isSourceEncodingSupported( sourceEncoding ) ) {
encs = codec.getTargetEncodings();
for (int j = 0; j < encs.length; j++) {
encodings.addElement( encs[j] );
}
}
}
if (!encodings.contains(sourceEncoding)) {
encodings.addElement(sourceEncoding);
}
return encodings.toArray(new AudioFormat.Encoding[encodings.size()]);
}
示例3: getTargetEncodings
import javax.sound.sampled.spi.FormatConversionProvider; //导入方法依赖的package包/类
/**
* Obtains the encodings that the system can obtain from an audio input
* stream with the specified encoding using the set of installed format
* converters.
*
* @param sourceEncoding the encoding for which conversion support is
* queried
* @return array of encodings. If {@code sourceEncoding}is not supported, an
* array of length 0 is returned. Otherwise, the array will have a
* length of at least 1, representing {@code sourceEncoding}
* (no conversion).
* @throws NullPointerException if {@code sourceEncoding} is {@code null}
*/
public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat.Encoding sourceEncoding) {
Objects.requireNonNull(sourceEncoding);
List<FormatConversionProvider> codecs = getFormatConversionProviders();
Vector<AudioFormat.Encoding> encodings = new Vector<>();
AudioFormat.Encoding encs[] = null;
// gather from all the codecs
for(int i=0; i<codecs.size(); i++ ) {
FormatConversionProvider codec = codecs.get(i);
if( codec.isSourceEncodingSupported( sourceEncoding ) ) {
encs = codec.getTargetEncodings();
for (int j = 0; j < encs.length; j++) {
encodings.addElement( encs[j] );
}
}
}
if (!encodings.contains(sourceEncoding)) {
encodings.addElement(sourceEncoding);
}
return encodings.toArray(new AudioFormat.Encoding[encodings.size()]);
}
示例4: getTargetEncodings
import javax.sound.sampled.spi.FormatConversionProvider; //导入方法依赖的package包/类
/**
* Given a source encoding, return an array of all target encodings to which
* data in this form can be converted.
* @param source the source encoding
*/
public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat.Encoding source)
{
HashSet<AudioFormat.Encoding> result
= new HashSet<AudioFormat.Encoding>();
Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
while (i.hasNext())
{
FormatConversionProvider prov = (FormatConversionProvider) i.next();
if (! prov.isSourceEncodingSupported(source))
continue;
AudioFormat.Encoding[] es = prov.getTargetEncodings();
for (int j = 0; j < es.length; ++j)
result.add(es[j]);
}
return result.toArray(new AudioFormat.Encoding[result.size()]);
}
示例5: getTargetEncodings
import javax.sound.sampled.spi.FormatConversionProvider; //导入方法依赖的package包/类
public static AudioFormat.Encoding[] getTargetEncodings(
AudioFormat.Encoding sourceEncoding) {
List<AudioFormat.Encoding> result = new ArrayList<AudioFormat.Encoding>();
for (Iterator providers = ProviderService.getProviders(
formatConversionProviderPath).iterator(); providers.hasNext();) {
try {
FormatConversionProvider pr = (FormatConversionProvider) providers
.next();
if (!pr.isSourceEncodingSupported(sourceEncoding)) {
continue;
}
AudioFormat.Encoding[] encodings = pr.getTargetEncodings();
for (AudioFormat.Encoding encoding : encodings) {
result.add(encoding);
}
} catch (ClassCastException e) {}
}
AudioFormat.Encoding[] temp = new AudioFormat.Encoding[result.size()];
return result.toArray(temp);
}
示例6: getTargetEncodings
import javax.sound.sampled.spi.FormatConversionProvider; //导入方法依赖的package包/类
/**
* Given a source encoding, return an array of all target encodings to which
* data in this form can be converted.
* @param source the source encoding
*/
public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat.Encoding source)
{
HashSet<AudioFormat.Encoding> result
= new HashSet<AudioFormat.Encoding>();
Iterator<FormatConversionProvider> i =
ServiceFactory.lookupProviders(FormatConversionProvider.class);
while (i.hasNext())
{
FormatConversionProvider prov = i.next();
if (! prov.isSourceEncodingSupported(source))
continue;
AudioFormat.Encoding[] es = prov.getTargetEncodings();
for (int j = 0; j < es.length; ++j)
result.add(es[j]);
}
return result.toArray(new AudioFormat.Encoding[result.size()]);
}