类javax.sound.sampled.spi.AudioFileReader源码实例Demo

下面列出了怎么用javax.sound.sampled.spi.AudioFileReader的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: jdk1.8-source-analysis   文件: AudioSystem.java
/**
 * 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 <code>IOException</code>.
 * @param stream the input stream from which file format information should be
 * extracted
 * @return an <code>AudioFileFormat</code> object describing the stream's audio file format
 * @throws UnsupportedAudioFileException if the stream does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an input/output exception occurs
 * @see InputStream#markSupported
 * @see InputStream#mark
 */
public static AudioFileFormat getAudioFileFormat(InputStream stream)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioFileFormat format = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            format = reader.getAudioFileFormat( stream ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( format==null ) {
        throw new UnsupportedAudioFileException("file is not a supported file type");
    } else {
        return format;
    }
}
 
源代码2 项目: jdk1.8-source-analysis   文件: AudioSystem.java
/**
 * Obtains the audio file format of the specified URL.  The URL must
 * point to valid audio file data.
 * @param url the URL from which file format information should be
 * extracted
 * @return an <code>AudioFileFormat</code> object describing the audio file format
 * @throws UnsupportedAudioFileException if the URL does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an input/output exception occurs
 */
public static AudioFileFormat getAudioFileFormat(URL url)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioFileFormat format = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            format = reader.getAudioFileFormat( url ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( format==null ) {
        throw new UnsupportedAudioFileException("file is not a supported file type");
    } else {
        return format;
    }
}
 
源代码3 项目: jdk1.8-source-analysis   文件: AudioSystem.java
/**
 * Obtains the audio file format of the specified <code>File</code>.  The <code>File</code> must
 * point to valid audio file data.
 * @param file the <code>File</code> from which file format information should be
 * extracted
 * @return an <code>AudioFileFormat</code> object describing the audio file format
 * @throws UnsupportedAudioFileException if the <code>File</code> does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 */
public static AudioFileFormat getAudioFileFormat(File file)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioFileFormat format = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            format = reader.getAudioFileFormat( file ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( format==null ) {
        throw new UnsupportedAudioFileException("file is not a supported file type");
    } else {
        return format;
    }
}
 
源代码4 项目: jdk1.8-source-analysis   文件: AudioSystem.java
/**
 * 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 <code>IOException</code>.
 * @param stream the input stream from which the <code>AudioInputStream</code> should be
 * constructed
 * @return an <code>AudioInputStream</code> object based on the audio file data contained
 * in the input stream.
 * @throws UnsupportedAudioFileException if the stream does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 * @see InputStream#markSupported
 * @see InputStream#mark
 */
public static AudioInputStream getAudioInputStream(InputStream stream)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioInputStream audioStream = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            audioStream = reader.getAudioInputStream( stream ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( audioStream==null ) {
        throw new UnsupportedAudioFileException("could not get audio input stream from input stream");
    } else {
        return audioStream;
    }
}
 
源代码5 项目: jdk1.8-source-analysis   文件: AudioSystem.java
/**
 * Obtains an audio input stream from the URL provided.  The URL must
 * point to valid audio file data.
 * @param url the URL for which the <code>AudioInputStream</code> should be
 * constructed
 * @return an <code>AudioInputStream</code> object based on the audio file data pointed
 * to by the URL
 * @throws UnsupportedAudioFileException if the URL does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 */
public static AudioInputStream getAudioInputStream(URL url)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioInputStream audioStream = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            audioStream = reader.getAudioInputStream( url ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( audioStream==null ) {
        throw new UnsupportedAudioFileException("could not get audio input stream from input URL");
    } else {
        return audioStream;
    }
}
 
源代码6 项目: jdk1.8-source-analysis   文件: AudioSystem.java
/**
 * Obtains an audio input stream from the provided <code>File</code>.  The <code>File</code> must
 * point to valid audio file data.
 * @param file the <code>File</code> for which the <code>AudioInputStream</code> should be
 * constructed
 * @return an <code>AudioInputStream</code> object based on the audio file data pointed
 * to by the <code>File</code>
 * @throws UnsupportedAudioFileException if the <code>File</code> does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 */
public static AudioInputStream getAudioInputStream(File file)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioInputStream audioStream = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            audioStream = reader.getAudioInputStream( file ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( audioStream==null ) {
        throw new UnsupportedAudioFileException("could not get audio input stream from input file");
    } else {
        return audioStream;
    }
}
 
源代码7 项目: dragonwell8_jdk   文件: JDK13Services.java
/**
 * Obtains a List containing installed instances of the providers for the
 * requested service. The returned List is immutable.
 *
 * @param serviceClass The type of providers requested. This should be one
 *                     of AudioFileReader.class, AudioFileWriter.class,
 *                     FormatConversionProvider.class, MixerProvider.class,
 *                     MidiDeviceProvider.class, MidiFileReader.class,
 *                     MidiFileWriter.class or SoundbankReader.class.
 *
 * @return A List of providers of the requested type. This List is
 *         immutable.
 */
public static List<?> getProviders(final Class<?> serviceClass) {
    final List<?> providers;
    if (!MixerProvider.class.equals(serviceClass)
            && !FormatConversionProvider.class.equals(serviceClass)
            && !AudioFileReader.class.equals(serviceClass)
            && !AudioFileWriter.class.equals(serviceClass)
            && !MidiDeviceProvider.class.equals(serviceClass)
            && !SoundbankReader.class.equals(serviceClass)
            && !MidiFileWriter.class.equals(serviceClass)
            && !MidiFileReader.class.equals(serviceClass)) {
        providers = new ArrayList<>(0);
    } else {
        providers = JSSecurityManager.getProviders(serviceClass);
    }
    return Collections.unmodifiableList(providers);
}
 
源代码8 项目: dragonwell8_jdk   文件: AudioSystem.java
/**
 * 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 <code>IOException</code>.
 * @param stream the input stream from which file format information should be
 * extracted
 * @return an <code>AudioFileFormat</code> object describing the stream's audio file format
 * @throws UnsupportedAudioFileException if the stream does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an input/output exception occurs
 * @see InputStream#markSupported
 * @see InputStream#mark
 */
public static AudioFileFormat getAudioFileFormat(InputStream stream)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioFileFormat format = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            format = reader.getAudioFileFormat( stream ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( format==null ) {
        throw new UnsupportedAudioFileException("file is not a supported file type");
    } else {
        return format;
    }
}
 
源代码9 项目: dragonwell8_jdk   文件: AudioSystem.java
/**
 * Obtains the audio file format of the specified URL.  The URL must
 * point to valid audio file data.
 * @param url the URL from which file format information should be
 * extracted
 * @return an <code>AudioFileFormat</code> object describing the audio file format
 * @throws UnsupportedAudioFileException if the URL does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an input/output exception occurs
 */
public static AudioFileFormat getAudioFileFormat(URL url)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioFileFormat format = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            format = reader.getAudioFileFormat( url ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( format==null ) {
        throw new UnsupportedAudioFileException("file is not a supported file type");
    } else {
        return format;
    }
}
 
源代码10 项目: dragonwell8_jdk   文件: AudioSystem.java
/**
 * Obtains the audio file format of the specified <code>File</code>.  The <code>File</code> must
 * point to valid audio file data.
 * @param file the <code>File</code> from which file format information should be
 * extracted
 * @return an <code>AudioFileFormat</code> object describing the audio file format
 * @throws UnsupportedAudioFileException if the <code>File</code> does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 */
public static AudioFileFormat getAudioFileFormat(File file)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioFileFormat format = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            format = reader.getAudioFileFormat( file ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( format==null ) {
        throw new UnsupportedAudioFileException("file is not a supported file type");
    } else {
        return format;
    }
}
 
源代码11 项目: dragonwell8_jdk   文件: AudioSystem.java
/**
 * 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 <code>IOException</code>.
 * @param stream the input stream from which the <code>AudioInputStream</code> should be
 * constructed
 * @return an <code>AudioInputStream</code> object based on the audio file data contained
 * in the input stream.
 * @throws UnsupportedAudioFileException if the stream does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 * @see InputStream#markSupported
 * @see InputStream#mark
 */
public static AudioInputStream getAudioInputStream(InputStream stream)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioInputStream audioStream = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            audioStream = reader.getAudioInputStream( stream ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( audioStream==null ) {
        throw new UnsupportedAudioFileException("could not get audio input stream from input stream");
    } else {
        return audioStream;
    }
}
 
源代码12 项目: dragonwell8_jdk   文件: AudioSystem.java
/**
 * Obtains an audio input stream from the URL provided.  The URL must
 * point to valid audio file data.
 * @param url the URL for which the <code>AudioInputStream</code> should be
 * constructed
 * @return an <code>AudioInputStream</code> object based on the audio file data pointed
 * to by the URL
 * @throws UnsupportedAudioFileException if the URL does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 */
public static AudioInputStream getAudioInputStream(URL url)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioInputStream audioStream = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            audioStream = reader.getAudioInputStream( url ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( audioStream==null ) {
        throw new UnsupportedAudioFileException("could not get audio input stream from input URL");
    } else {
        return audioStream;
    }
}
 
源代码13 项目: dragonwell8_jdk   文件: AudioSystem.java
/**
 * Obtains an audio input stream from the provided <code>File</code>.  The <code>File</code> must
 * point to valid audio file data.
 * @param file the <code>File</code> for which the <code>AudioInputStream</code> should be
 * constructed
 * @return an <code>AudioInputStream</code> object based on the audio file data pointed
 * to by the <code>File</code>
 * @throws UnsupportedAudioFileException if the <code>File</code> does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 */
public static AudioInputStream getAudioInputStream(File file)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioInputStream audioStream = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            audioStream = reader.getAudioInputStream( file ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( audioStream==null ) {
        throw new UnsupportedAudioFileException("could not get audio input stream from input file");
    } else {
        return audioStream;
    }
}
 
源代码14 项目: TencentKona-8   文件: JDK13Services.java
/**
 * Obtains a List containing installed instances of the providers for the
 * requested service. The returned List is immutable.
 *
 * @param serviceClass The type of providers requested. This should be one
 *                     of AudioFileReader.class, AudioFileWriter.class,
 *                     FormatConversionProvider.class, MixerProvider.class,
 *                     MidiDeviceProvider.class, MidiFileReader.class,
 *                     MidiFileWriter.class or SoundbankReader.class.
 *
 * @return A List of providers of the requested type. This List is
 *         immutable.
 */
public static List<?> getProviders(final Class<?> serviceClass) {
    final List<?> providers;
    if (!MixerProvider.class.equals(serviceClass)
            && !FormatConversionProvider.class.equals(serviceClass)
            && !AudioFileReader.class.equals(serviceClass)
            && !AudioFileWriter.class.equals(serviceClass)
            && !MidiDeviceProvider.class.equals(serviceClass)
            && !SoundbankReader.class.equals(serviceClass)
            && !MidiFileWriter.class.equals(serviceClass)
            && !MidiFileReader.class.equals(serviceClass)) {
        providers = new ArrayList<>(0);
    } else {
        providers = JSSecurityManager.getProviders(serviceClass);
    }
    return Collections.unmodifiableList(providers);
}
 
源代码15 项目: TencentKona-8   文件: AudioSystem.java
/**
 * 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 <code>IOException</code>.
 * @param stream the input stream from which file format information should be
 * extracted
 * @return an <code>AudioFileFormat</code> object describing the stream's audio file format
 * @throws UnsupportedAudioFileException if the stream does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an input/output exception occurs
 * @see InputStream#markSupported
 * @see InputStream#mark
 */
public static AudioFileFormat getAudioFileFormat(InputStream stream)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioFileFormat format = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            format = reader.getAudioFileFormat( stream ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( format==null ) {
        throw new UnsupportedAudioFileException("file is not a supported file type");
    } else {
        return format;
    }
}
 
源代码16 项目: TencentKona-8   文件: AudioSystem.java
/**
 * Obtains the audio file format of the specified URL.  The URL must
 * point to valid audio file data.
 * @param url the URL from which file format information should be
 * extracted
 * @return an <code>AudioFileFormat</code> object describing the audio file format
 * @throws UnsupportedAudioFileException if the URL does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an input/output exception occurs
 */
public static AudioFileFormat getAudioFileFormat(URL url)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioFileFormat format = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            format = reader.getAudioFileFormat( url ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( format==null ) {
        throw new UnsupportedAudioFileException("file is not a supported file type");
    } else {
        return format;
    }
}
 
源代码17 项目: TencentKona-8   文件: AudioSystem.java
/**
 * Obtains the audio file format of the specified <code>File</code>.  The <code>File</code> must
 * point to valid audio file data.
 * @param file the <code>File</code> from which file format information should be
 * extracted
 * @return an <code>AudioFileFormat</code> object describing the audio file format
 * @throws UnsupportedAudioFileException if the <code>File</code> does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 */
public static AudioFileFormat getAudioFileFormat(File file)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioFileFormat format = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            format = reader.getAudioFileFormat( file ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( format==null ) {
        throw new UnsupportedAudioFileException("file is not a supported file type");
    } else {
        return format;
    }
}
 
源代码18 项目: TencentKona-8   文件: AudioSystem.java
/**
 * 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 <code>IOException</code>.
 * @param stream the input stream from which the <code>AudioInputStream</code> should be
 * constructed
 * @return an <code>AudioInputStream</code> object based on the audio file data contained
 * in the input stream.
 * @throws UnsupportedAudioFileException if the stream does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 * @see InputStream#markSupported
 * @see InputStream#mark
 */
public static AudioInputStream getAudioInputStream(InputStream stream)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioInputStream audioStream = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            audioStream = reader.getAudioInputStream( stream ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( audioStream==null ) {
        throw new UnsupportedAudioFileException("could not get audio input stream from input stream");
    } else {
        return audioStream;
    }
}
 
源代码19 项目: TencentKona-8   文件: AudioSystem.java
/**
 * Obtains an audio input stream from the URL provided.  The URL must
 * point to valid audio file data.
 * @param url the URL for which the <code>AudioInputStream</code> should be
 * constructed
 * @return an <code>AudioInputStream</code> object based on the audio file data pointed
 * to by the URL
 * @throws UnsupportedAudioFileException if the URL does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 */
public static AudioInputStream getAudioInputStream(URL url)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioInputStream audioStream = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            audioStream = reader.getAudioInputStream( url ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( audioStream==null ) {
        throw new UnsupportedAudioFileException("could not get audio input stream from input URL");
    } else {
        return audioStream;
    }
}
 
源代码20 项目: TencentKona-8   文件: AudioSystem.java
/**
 * Obtains an audio input stream from the provided <code>File</code>.  The <code>File</code> must
 * point to valid audio file data.
 * @param file the <code>File</code> for which the <code>AudioInputStream</code> should be
 * constructed
 * @return an <code>AudioInputStream</code> object based on the audio file data pointed
 * to by the <code>File</code>
 * @throws UnsupportedAudioFileException if the <code>File</code> does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 */
public static AudioInputStream getAudioInputStream(File file)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioInputStream audioStream = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            audioStream = reader.getAudioInputStream( file ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( audioStream==null ) {
        throw new UnsupportedAudioFileException("could not get audio input stream from input file");
    } else {
        return audioStream;
    }
}
 
源代码21 项目: jdk8u60   文件: JDK13Services.java
/**
 * Obtains a List containing installed instances of the providers for the
 * requested service. The returned List is immutable.
 *
 * @param serviceClass The type of providers requested. This should be one
 *                     of AudioFileReader.class, AudioFileWriter.class,
 *                     FormatConversionProvider.class, MixerProvider.class,
 *                     MidiDeviceProvider.class, MidiFileReader.class,
 *                     MidiFileWriter.class or SoundbankReader.class.
 *
 * @return A List of providers of the requested type. This List is
 *         immutable.
 */
public static List<?> getProviders(final Class<?> serviceClass) {
    final List<?> providers;
    if (!MixerProvider.class.equals(serviceClass)
            && !FormatConversionProvider.class.equals(serviceClass)
            && !AudioFileReader.class.equals(serviceClass)
            && !AudioFileWriter.class.equals(serviceClass)
            && !MidiDeviceProvider.class.equals(serviceClass)
            && !SoundbankReader.class.equals(serviceClass)
            && !MidiFileWriter.class.equals(serviceClass)
            && !MidiFileReader.class.equals(serviceClass)) {
        providers = new ArrayList<>(0);
    } else {
        providers = JSSecurityManager.getProviders(serviceClass);
    }
    return Collections.unmodifiableList(providers);
}
 
源代码22 项目: jdk8u60   文件: AudioSystem.java
/**
 * 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 <code>IOException</code>.
 * @param stream the input stream from which file format information should be
 * extracted
 * @return an <code>AudioFileFormat</code> object describing the stream's audio file format
 * @throws UnsupportedAudioFileException if the stream does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an input/output exception occurs
 * @see InputStream#markSupported
 * @see InputStream#mark
 */
public static AudioFileFormat getAudioFileFormat(InputStream stream)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioFileFormat format = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            format = reader.getAudioFileFormat( stream ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( format==null ) {
        throw new UnsupportedAudioFileException("file is not a supported file type");
    } else {
        return format;
    }
}
 
源代码23 项目: jdk8u60   文件: AudioSystem.java
/**
 * Obtains the audio file format of the specified URL.  The URL must
 * point to valid audio file data.
 * @param url the URL from which file format information should be
 * extracted
 * @return an <code>AudioFileFormat</code> object describing the audio file format
 * @throws UnsupportedAudioFileException if the URL does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an input/output exception occurs
 */
public static AudioFileFormat getAudioFileFormat(URL url)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioFileFormat format = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            format = reader.getAudioFileFormat( url ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( format==null ) {
        throw new UnsupportedAudioFileException("file is not a supported file type");
    } else {
        return format;
    }
}
 
源代码24 项目: jdk8u60   文件: AudioSystem.java
/**
 * Obtains the audio file format of the specified <code>File</code>.  The <code>File</code> must
 * point to valid audio file data.
 * @param file the <code>File</code> from which file format information should be
 * extracted
 * @return an <code>AudioFileFormat</code> object describing the audio file format
 * @throws UnsupportedAudioFileException if the <code>File</code> does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 */
public static AudioFileFormat getAudioFileFormat(File file)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioFileFormat format = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            format = reader.getAudioFileFormat( file ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( format==null ) {
        throw new UnsupportedAudioFileException("file is not a supported file type");
    } else {
        return format;
    }
}
 
源代码25 项目: jdk8u60   文件: AudioSystem.java
/**
 * 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 <code>IOException</code>.
 * @param stream the input stream from which the <code>AudioInputStream</code> should be
 * constructed
 * @return an <code>AudioInputStream</code> object based on the audio file data contained
 * in the input stream.
 * @throws UnsupportedAudioFileException if the stream does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 * @see InputStream#markSupported
 * @see InputStream#mark
 */
public static AudioInputStream getAudioInputStream(InputStream stream)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioInputStream audioStream = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            audioStream = reader.getAudioInputStream( stream ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( audioStream==null ) {
        throw new UnsupportedAudioFileException("could not get audio input stream from input stream");
    } else {
        return audioStream;
    }
}
 
源代码26 项目: jdk8u60   文件: AudioSystem.java
/**
 * Obtains an audio input stream from the URL provided.  The URL must
 * point to valid audio file data.
 * @param url the URL for which the <code>AudioInputStream</code> should be
 * constructed
 * @return an <code>AudioInputStream</code> object based on the audio file data pointed
 * to by the URL
 * @throws UnsupportedAudioFileException if the URL does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 */
public static AudioInputStream getAudioInputStream(URL url)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioInputStream audioStream = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            audioStream = reader.getAudioInputStream( url ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( audioStream==null ) {
        throw new UnsupportedAudioFileException("could not get audio input stream from input URL");
    } else {
        return audioStream;
    }
}
 
源代码27 项目: jdk8u60   文件: AudioSystem.java
/**
 * Obtains an audio input stream from the provided <code>File</code>.  The <code>File</code> must
 * point to valid audio file data.
 * @param file the <code>File</code> for which the <code>AudioInputStream</code> should be
 * constructed
 * @return an <code>AudioInputStream</code> object based on the audio file data pointed
 * to by the <code>File</code>
 * @throws UnsupportedAudioFileException if the <code>File</code> does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 */
public static AudioInputStream getAudioInputStream(File file)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioInputStream audioStream = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            audioStream = reader.getAudioInputStream( file ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( audioStream==null ) {
        throw new UnsupportedAudioFileException("could not get audio input stream from input file");
    } else {
        return audioStream;
    }
}
 
源代码28 项目: JDKSourceCode1.8   文件: AudioSystem.java
/**
 * 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 <code>IOException</code>.
 * @param stream the input stream from which file format information should be
 * extracted
 * @return an <code>AudioFileFormat</code> object describing the stream's audio file format
 * @throws UnsupportedAudioFileException if the stream does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an input/output exception occurs
 * @see InputStream#markSupported
 * @see InputStream#mark
 */
public static AudioFileFormat getAudioFileFormat(InputStream stream)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioFileFormat format = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            format = reader.getAudioFileFormat( stream ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( format==null ) {
        throw new UnsupportedAudioFileException("file is not a supported file type");
    } else {
        return format;
    }
}
 
源代码29 项目: JDKSourceCode1.8   文件: AudioSystem.java
/**
 * Obtains the audio file format of the specified URL.  The URL must
 * point to valid audio file data.
 * @param url the URL from which file format information should be
 * extracted
 * @return an <code>AudioFileFormat</code> object describing the audio file format
 * @throws UnsupportedAudioFileException if the URL does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an input/output exception occurs
 */
public static AudioFileFormat getAudioFileFormat(URL url)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioFileFormat format = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            format = reader.getAudioFileFormat( url ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( format==null ) {
        throw new UnsupportedAudioFileException("file is not a supported file type");
    } else {
        return format;
    }
}
 
源代码30 项目: JDKSourceCode1.8   文件: AudioSystem.java
/**
 * Obtains the audio file format of the specified <code>File</code>.  The <code>File</code> must
 * point to valid audio file data.
 * @param file the <code>File</code> from which file format information should be
 * extracted
 * @return an <code>AudioFileFormat</code> object describing the audio file format
 * @throws UnsupportedAudioFileException if the <code>File</code> does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 */
public static AudioFileFormat getAudioFileFormat(File file)
    throws UnsupportedAudioFileException, IOException {

    List providers = getAudioFileReaders();
    AudioFileFormat format = null;

    for(int i = 0; i < providers.size(); i++ ) {
        AudioFileReader reader = (AudioFileReader) providers.get(i);
        try {
            format = reader.getAudioFileFormat( file ); // throws IOException
            break;
        } catch (UnsupportedAudioFileException e) {
            continue;
        }
    }

    if( format==null ) {
        throw new UnsupportedAudioFileException("file is not a supported file type");
    } else {
        return format;
    }
}