当前位置: 首页>>代码示例>>Java>>正文


Java FormatConversionProvider.getTargetEncodings方法代码示例

本文整理汇总了Java中javax.sound.sampled.spi.FormatConversionProvider.getTargetEncodings方法的典型用法代码示例。如果您正苦于以下问题:Java FormatConversionProvider.getTargetEncodings方法的具体用法?Java FormatConversionProvider.getTargetEncodings怎么用?Java FormatConversionProvider.getTargetEncodings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.sound.sampled.spi.FormatConversionProvider的用法示例。


在下文中一共展示了FormatConversionProvider.getTargetEncodings方法的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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:AudioSystem.java

示例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()]);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:38,代码来源:AudioSystem.java

示例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()]);
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:38,代码来源:AudioSystem.java

示例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()]);
}
 
开发者ID:vilie,项目名称:javify,代码行数:22,代码来源:AudioSystem.java

示例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);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:22,代码来源:AudioSystem.java

示例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()]);
}
 
开发者ID:cfriedt,项目名称:classpath,代码行数:23,代码来源:AudioSystem.java


注:本文中的javax.sound.sampled.spi.FormatConversionProvider.getTargetEncodings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。