Path: blob/master/src/java.desktop/share/classes/javax/sound/midi/spi/SoundbankReader.java
41171 views
/*1* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.sound.midi.spi;2627import java.io.File;28import java.io.IOException;29import java.io.InputStream;30import java.net.URL;3132import javax.sound.midi.InvalidMidiDataException;33import javax.sound.midi.Soundbank;34import javax.sound.midi.Synthesizer;3536/**37* A {@code SoundbankReader} supplies soundbank file-reading services. Concrete38* subclasses of {@code SoundbankReader} parse a given soundbank file, producing39* a {@link Soundbank} object that can be loaded into a {@link Synthesizer}.40*41* @author Kara Kytle42* @since 1.343*/44public abstract class SoundbankReader {4546/**47* Constructor for subclasses to call.48*/49protected SoundbankReader() {}5051/**52* Obtains a soundbank object from the {@code URL} provided.53*54* @param url {@code URL} representing the soundbank55* @return soundbank object56* @throws InvalidMidiDataException if the {@code URL} does not point to57* valid MIDI soundbank data recognized by this soundbank reader58* @throws IOException if an I/O error occurs59* @throws NullPointerException if {@code url} is {@code null}60*/61public abstract Soundbank getSoundbank(URL url)62throws InvalidMidiDataException, IOException;6364/**65* Obtains a soundbank object from the {@code InputStream} provided.66*67* @param stream {@code InputStream} representing the soundbank68* @return soundbank object69* @throws InvalidMidiDataException if the stream does not point to valid70* MIDI soundbank data recognized by this soundbank reader71* @throws IOException if an I/O error occurs72* @throws NullPointerException if {@code stream} is {@code null}73*/74public abstract Soundbank getSoundbank(InputStream stream)75throws InvalidMidiDataException, IOException;7677/**78* Obtains a soundbank object from the {@code File} provided.79*80* @param file the {@code File} representing the soundbank81* @return soundbank object82* @throws InvalidMidiDataException if the file does not point to valid MIDI83* soundbank data recognized by this soundbank reader84* @throws IOException if an I/O error occurs85* @throws NullPointerException if {@code file} is {@code null}86*/87public abstract Soundbank getSoundbank(File file)88throws InvalidMidiDataException, IOException;89}909192