1. /*
  2. * @(#)SoundbankReader.java 1.18 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.sound.midi.spi;
  8. import java.io.InputStream;
  9. import java.io.IOException;
  10. import java.io.File;
  11. import java.net.URL;
  12. import javax.sound.midi.Soundbank;
  13. import javax.sound.midi.InvalidMidiDataException;
  14. /**
  15. * A <code>SoundbankReader</code> supplies soundbank file-reading services.
  16. * Concrete subclasses of <code>SoundbankReader</code> parse a given
  17. * soundbank file, producing a {@link javax.sound.midi.Soundbank}
  18. * object that can be loaded into a {@link javax.sound.midi.Synthesizer}.
  19. *
  20. * @since 1.3
  21. * @version 1.18 03/12/19
  22. * @author Kara Kytle
  23. */
  24. public abstract class SoundbankReader {
  25. /**
  26. * Obtains a soundbank object from the URL provided.
  27. * @param url URL representing the soundbank.
  28. * @return soundbank object
  29. * @throws InvalidMidiDataException if the URL does not point to
  30. * valid MIDI soundbank data recognized by this soundbank reader
  31. * @throws IOException if an I/O error occurs
  32. */
  33. public abstract Soundbank getSoundbank(URL url) throws InvalidMidiDataException, IOException;
  34. /**
  35. * Obtains a soundbank object from the <code>InputStream</code> provided.
  36. * @param stream <code>InputStream</code> representing the soundbank
  37. * @return soundbank object
  38. * @throws InvalidMidiDataException if the stream does not point to
  39. * valid MIDI soundbank data recognized by this soundbank reader
  40. * @throws IOException if an I/O error occurs
  41. */
  42. public abstract Soundbank getSoundbank(InputStream stream) throws InvalidMidiDataException, IOException;
  43. /**
  44. * Obtains a soundbank object from the <code>File</code> provided.
  45. * @param file the <code>File</code> representing the soundbank
  46. * @return soundbank object
  47. * @throws InvalidMidiDataException if the file does not point to
  48. * valid MIDI soundbank data recognized by this soundbank reader
  49. * @throws IOException if an I/O error occurs
  50. */
  51. public abstract Soundbank getSoundbank(File file) throws InvalidMidiDataException, IOException;
  52. }