01 /*
02 * Copyright 1999-2003 Sun Microsystems, Inc. All Rights Reserved.
03 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04 *
05 * This code is free software; you can redistribute it and/or modify it
06 * under the terms of the GNU General Public License version 2 only, as
07 * published by the Free Software Foundation. Sun designates this
08 * particular file as subject to the "Classpath" exception as provided
09 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26 package javax.sound.midi.spi;
27
28 import java.io.InputStream;
29 import java.io.IOException;
30 import java.io.File;
31
32 import java.net.URL;
33
34 import javax.sound.midi.Soundbank;
35 import javax.sound.midi.InvalidMidiDataException;
36
37 /**
38 * A <code>SoundbankReader</code> supplies soundbank file-reading services.
39 * Concrete subclasses of <code>SoundbankReader</code> parse a given
40 * soundbank file, producing a {@link javax.sound.midi.Soundbank}
41 * object that can be loaded into a {@link javax.sound.midi.Synthesizer}.
42 *
43 * @since 1.3
44 * @version 1.25 07/05/05
45 * @author Kara Kytle
46 */
47 public abstract class SoundbankReader {
48
49 /**
50 * Obtains a soundbank object from the URL provided.
51 * @param url URL representing the soundbank.
52 * @return soundbank object
53 * @throws InvalidMidiDataException if the URL does not point to
54 * valid MIDI soundbank data recognized by this soundbank reader
55 * @throws IOException if an I/O error occurs
56 */
57 public abstract Soundbank getSoundbank(URL url)
58 throws InvalidMidiDataException, IOException;
59
60 /**
61 * Obtains a soundbank object from the <code>InputStream</code> provided.
62 * @param stream <code>InputStream</code> representing the soundbank
63 * @return soundbank object
64 * @throws InvalidMidiDataException if the stream does not point to
65 * valid MIDI soundbank data recognized by this soundbank reader
66 * @throws IOException if an I/O error occurs
67 */
68 public abstract Soundbank getSoundbank(InputStream stream)
69 throws InvalidMidiDataException, IOException;
70
71 /**
72 * Obtains a soundbank object from the <code>File</code> provided.
73 * @param file the <code>File</code> representing the soundbank
74 * @return soundbank object
75 * @throws InvalidMidiDataException if the file does not point to
76 * valid MIDI soundbank data recognized by this soundbank reader
77 * @throws IOException if an I/O error occurs
78 */
79 public abstract Soundbank getSoundbank(File file)
80 throws InvalidMidiDataException, IOException;
81
82 }
|