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


Java FormatConversionProvider.isConversionSupported方法代码示例

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


在下文中一共展示了FormatConversionProvider.isConversionSupported方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAudioInputStream

import javax.sound.sampled.spi.FormatConversionProvider; //导入方法依赖的package包/类
/**
 * Obtains an audio input stream of the indicated format, by converting the
 * provided audio input stream.
 * @param targetFormat the desired audio format after conversion
 * @param sourceStream the stream to be converted
 * @return an audio input stream of the indicated format
 * @throws IllegalArgumentException if the conversion is not supported
 * #see #getTargetEncodings(AudioFormat)
 * @see #getTargetFormats(AudioFormat.Encoding, AudioFormat)
 * @see #isConversionSupported(AudioFormat, AudioFormat)
 * @see #getAudioInputStream(AudioFormat.Encoding, AudioInputStream)
 */
public static AudioInputStream getAudioInputStream(AudioFormat targetFormat,
                                                   AudioInputStream sourceStream) {

    if (sourceStream.getFormat().matches(targetFormat)) {
        return sourceStream;
    }

    List codecs = getFormatConversionProviders();

    for(int i = 0; i < codecs.size(); i++) {
        FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
        if(codec.isConversionSupported(targetFormat,sourceStream.getFormat()) ) {
            return codec.getAudioInputStream(targetFormat,sourceStream);
        }
    }

    // we ran out of options...
    throw new IllegalArgumentException("Unsupported conversion: " + targetFormat + " from " + sourceStream.getFormat());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:AudioSystem.java

示例2: isConversionSupported

import javax.sound.sampled.spi.FormatConversionProvider; //导入方法依赖的package包/类
/**
 * Indicates whether an audio input stream of the specified encoding can be
 * obtained from an audio input stream that has the specified format.
 *
 * @param  targetEncoding the desired encoding after conversion
 * @param  sourceFormat the audio format before conversion
 * @return {@code true} if the conversion is supported, otherwise
 *         {@code false}
 * @throws NullPointerException if {@code targetEncoding} or
 *         {@code sourceFormat} are {@code null}
 */
public static boolean isConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {
    Objects.requireNonNull(targetEncoding);
    Objects.requireNonNull(sourceFormat);
    if (sourceFormat.getEncoding().equals(targetEncoding)) {
        return true;
    }

    List<FormatConversionProvider> codecs = getFormatConversionProviders();

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = codecs.get(i);
        if(codec.isConversionSupported(targetEncoding,sourceFormat) ) {
            return true;
        }
    }
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:AudioSystem.java

示例3: getAudioInputStream

import javax.sound.sampled.spi.FormatConversionProvider; //导入方法依赖的package包/类
/**
 * Obtains an audio input stream of the indicated encoding, by converting
 * the provided audio input stream.
 *
 * @param  targetEncoding the desired encoding after conversion
 * @param  sourceStream the stream to be converted
 * @return an audio input stream of the indicated encoding
 * @throws IllegalArgumentException if the conversion is not supported
 * @throws NullPointerException if {@code targetEncoding} or
 *         {@code sourceStream} are {@code null}
 * @see #getTargetEncodings(AudioFormat.Encoding)
 * @see #getTargetEncodings(AudioFormat)
 * @see #isConversionSupported(AudioFormat.Encoding, AudioFormat)
 * @see #getAudioInputStream(AudioFormat, AudioInputStream)
 */
public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding,
                                                   AudioInputStream sourceStream) {
    Objects.requireNonNull(targetEncoding);
    Objects.requireNonNull(sourceStream);
    if (sourceStream.getFormat().getEncoding().equals(targetEncoding)) {
        return sourceStream;
    }

    List<FormatConversionProvider> codecs = getFormatConversionProviders();

    for(int i = 0; i < codecs.size(); i++) {
        FormatConversionProvider codec = codecs.get(i);
        if( codec.isConversionSupported( targetEncoding, sourceStream.getFormat() ) ) {
            return codec.getAudioInputStream( targetEncoding, sourceStream );
        }
    }
    // we ran out of options, throw an exception
    throw new IllegalArgumentException("Unsupported conversion: " + targetEncoding + " from " + sourceStream.getFormat());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:35,代码来源:AudioSystem.java

示例4: isConversionSupported

import javax.sound.sampled.spi.FormatConversionProvider; //导入方法依赖的package包/类
/**
 * Indicates whether an audio input stream of a specified format can be
 * obtained from an audio input stream of another specified format.
 *
 * @param  targetFormat the desired audio format after conversion
 * @param  sourceFormat the audio format before conversion
 * @return {@code true} if the conversion is supported, otherwise
 *         {@code false}
 * @throws NullPointerException if {@code targetFormat} or
 *         {@code sourceFormat} are {@code null}
 */
public static boolean isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat) {
    Objects.requireNonNull(targetFormat);
    Objects.requireNonNull(sourceFormat);
    if (sourceFormat.matches(targetFormat)) {
        return true;
    }

    List<FormatConversionProvider> codecs = getFormatConversionProviders();

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = codecs.get(i);
        if(codec.isConversionSupported(targetFormat, sourceFormat) ) {
            return true;
        }
    }
    return false;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:29,代码来源:AudioSystem.java

示例5: isConversionSupported

import javax.sound.sampled.spi.FormatConversionProvider; //导入方法依赖的package包/类
/**
 * Indicates whether an audio input stream of the specified encoding
 * can be obtained from an audio input stream that has the specified
 * format.
 * @param targetEncoding the desired encoding after conversion
 * @param sourceFormat the audio format before conversion
 * @return <code>true</code> if the conversion is supported,
 * otherwise <code>false</code>
 */
public static boolean isConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {


    List codecs = getFormatConversionProviders();

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
        if(codec.isConversionSupported(targetEncoding,sourceFormat) ) {
            return true;
        }
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:AudioSystem.java

示例6: testAfterConversion

import javax.sound.sampled.spi.FormatConversionProvider; //导入方法依赖的package包/类
/**
 * Verifies the frame length after the stream was converted to other
 * stream.
 *
 * @see FormatConversionProvider#getAudioInputStream(AudioFormat,
 * AudioInputStream)
 */
private static void testAfterConversion(final FormatConversionProvider fcp,
                                        final AudioFormat to,
                                        final AudioInputStream ais) {
    if (fcp.isConversionSupported(to, ais.getFormat())) {
        validate(fcp.getAudioInputStream(to, ais).getFrameLength());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:FrameLengthAfterConversion.java

示例7: isConversionSupported

import javax.sound.sampled.spi.FormatConversionProvider; //导入方法依赖的package包/类
/**
 * Return true if the currently installed providers are able to
 * convert data from the given source format to the given target encoding.
 * @param targ the target encoding
 * @param source the source format
 */
public static boolean isConversionSupported(AudioFormat.Encoding targ,
                                            AudioFormat source)
{
  Iterator i
    = ServiceFactory.lookupProviders(FormatConversionProvider.class);
  while (i.hasNext())
    {
      FormatConversionProvider prov = (FormatConversionProvider) i.next();
      if (prov.isConversionSupported(targ, source))
        return true;
    }
  return false;
}
 
开发者ID:vilie,项目名称:javify,代码行数:20,代码来源:AudioSystem.java

示例8: getAudioInputStream

import javax.sound.sampled.spi.FormatConversionProvider; //导入方法依赖的package包/类
/**
 * Given an audio input stream, this will try to create a new audio input
 * stream whose format matches the given target format.  If no provider
 * offers this conversion, an exception is thrown.
 * @param targ the target format
 * @param ais the original audio stream
 * @return a new audio stream
 * @throws IllegalArgumentException if the conversion cannot be made
 */
public static AudioInputStream getAudioInputStream(AudioFormat targ,
                                                   AudioInputStream ais)
{
  Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
  while (i.hasNext())
    {
      FormatConversionProvider prov = (FormatConversionProvider) i.next();
      if (! prov.isConversionSupported(targ, ais.getFormat()))
        continue;
      return prov.getAudioInputStream(targ, ais);
    }
  throw new IllegalArgumentException("format not supported for stream");
 }
 
开发者ID:vilie,项目名称:javify,代码行数:23,代码来源:AudioSystem.java

示例9: getAudioInputStream

import javax.sound.sampled.spi.FormatConversionProvider; //导入方法依赖的package包/类
/**
  * Given an audio input stream, this will try to create a new audio input
  * stream whose encoding matches the given target encoding.  If no provider
  * offers this conversion, an exception is thrown. 
  * @param targ the target encoding
  * @param ais the original audio stream
  * @return a new audio stream
  * @throws IllegalArgumentException if the conversion cannot be made
  */
 public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targ,
					     AudioInputStream ais)
 {
   Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
   while (i.hasNext())
     {
       FormatConversionProvider prov = (FormatConversionProvider) i.next();
       if (! prov.isConversionSupported(targ, ais.getFormat()))
         continue;
       return prov.getAudioInputStream(targ, ais);
     }
   throw new IllegalArgumentException("encoding not supported for stream");
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:23,代码来源:AudioSystem.java

示例10: isConversionSupported

import javax.sound.sampled.spi.FormatConversionProvider; //导入方法依赖的package包/类
/**
 * Return true if the currently installed providers are able to
 * convert data from the given source format to the given target encoding.
 * @param targ the target encoding
 * @param source the source format
 */
public static boolean isConversionSupported(AudioFormat.Encoding targ,
			      AudioFormat source)
{
  Iterator i 
    = ServiceFactory.lookupProviders(FormatConversionProvider.class);
  while (i.hasNext())
    {
      FormatConversionProvider prov = (FormatConversionProvider) i.next();
      if (prov.isConversionSupported(targ, source))
        return true;
    }
  return false;
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:20,代码来源:AudioSystem.java

示例11: getAudioInputStream

import javax.sound.sampled.spi.FormatConversionProvider; //导入方法依赖的package包/类
/**
  * Given an audio input stream, this will try to create a new audio input
  * stream whose encoding matches the given target encoding.  If no provider
  * offers this conversion, an exception is thrown.
  * @param targ the target encoding
  * @param ais the original audio stream
  * @return a new audio stream
  * @throws IllegalArgumentException if the conversion cannot be made
  */
 public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targ,
                                                    AudioInputStream ais)
 {
   Iterator<FormatConversionProvider> i =
     ServiceFactory.lookupProviders(FormatConversionProvider.class);
   while (i.hasNext())
     {
       FormatConversionProvider prov = i.next();
       if (! prov.isConversionSupported(targ, ais.getFormat()))
         continue;
       return prov.getAudioInputStream(targ, ais);
     }
   throw new IllegalArgumentException("encoding not supported for stream");
}
 
开发者ID:cfriedt,项目名称:classpath,代码行数:24,代码来源:AudioSystem.java

示例12: isConversionSupported

import javax.sound.sampled.spi.FormatConversionProvider; //导入方法依赖的package包/类
/**
 * Return true if the currently installed providers are able to
 * convert data from the given source format to the given target encoding.
 * @param targ the target encoding
 * @param source the source format
 */
public static boolean isConversionSupported(AudioFormat.Encoding targ,
                                            AudioFormat source)
{
  Iterator<FormatConversionProvider> i
    = ServiceFactory.lookupProviders(FormatConversionProvider.class);
  while (i.hasNext())
    {
      FormatConversionProvider prov = i.next();
      if (prov.isConversionSupported(targ, source))
        return true;
    }
  return false;
}
 
开发者ID:cfriedt,项目名称:classpath,代码行数:20,代码来源:AudioSystem.java


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