Save This Page
Home » openjdk-7 » javax.sound » midi » spi » [javadoc | source]
    1   /*
    2    * Copyright 1999-2002 Sun Microsystems, Inc.  All Rights Reserved.
    3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    4    *
    5    * This code is free software; you can redistribute it and/or modify it
    6    * under the terms of the GNU General Public License version 2 only, as
    7    * published by the Free Software Foundation.  Sun designates this
    8    * particular file as subject to the "Classpath" exception as provided
    9    * 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.File;
   29   import java.io.InputStream;
   30   import java.io.IOException;
   31   import java.net.URL;
   32   
   33   import javax.sound.midi.MidiFileFormat;
   34   import javax.sound.midi.Sequence;
   35   import javax.sound.midi.InvalidMidiDataException;
   36   
   37   /**
   38    * A <code>MidiFileReader</code> supplies MIDI file-reading services.  Classes implementing this
   39    * interface can parse the format information from one or more types of
   40    * MIDI file, and can produce a <code>Sequence</code> object from files of these types.
   41    *
   42    * @author Kara Kytle
   43    * @since 1.3
   44    */
   45   public abstract class MidiFileReader {
   46   
   47       /**
   48        * Obtains the MIDI file format of the input stream provided.  The stream must
   49        * point to valid MIDI file data.  In general, MIDI file readers may
   50        * need to read some data from the stream before determining whether they
   51        * support it.  These parsers must
   52        * be able to mark the stream, read enough data to determine whether they
   53        * support the stream, and, if not, reset the stream's read pointer to its original
   54        * position.  If the input stream does not support this, this method may fail
   55        * with an <code>IOException</code>.
   56        * @param stream the input stream from which file format information should be
   57        * extracted
   58        * @return a <code>MidiFileFormat</code> object describing the MIDI file format
   59        * @throws InvalidMidiDataException if the stream does not point to valid MIDI
   60        * file data recognized by the system
   61        * @throws IOException if an I/O exception occurs
   62        * @see InputStream#markSupported
   63        * @see InputStream#mark
   64        */
   65       public abstract MidiFileFormat getMidiFileFormat(InputStream stream) throws InvalidMidiDataException, IOException;
   66   
   67   
   68       /**
   69        * Obtains the MIDI file format of the URL provided.  The URL must
   70        * point to valid MIDI file data.
   71        * @param url the URL from which file format information should be
   72        * extracted
   73        * @return a <code>MidiFileFormat</code> object describing the MIDI file format
   74        * @throws InvalidMidiDataException if the URL does not point to valid MIDI
   75        * file data recognized by the system
   76        * @throws IOException if an I/O exception occurs
   77        */
   78       public abstract MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException;
   79   
   80   
   81       /**
   82        * Obtains the MIDI file format of the <code>File</code> provided.
   83        * The <code>File</code> must point to valid MIDI file data.
   84        * @param file the <code>File</code> from which file format information should be
   85        * extracted
   86        * @return a <code>MidiFileFormat</code> object describing the MIDI file format
   87        * @throws InvalidMidiDataException if the <code>File</code> does not point to valid MIDI
   88        * file data recognized by the system
   89        * @throws IOException if an I/O exception occurs
   90        */
   91       public abstract MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException;
   92   
   93   
   94       /**
   95        * Obtains a MIDI sequence from the input stream provided.  The stream must
   96        * point to valid MIDI file data.  In general, MIDI file readers may
   97        * need to read some data from the stream before determining whether they
   98        * support it.  These parsers must
   99        * be able to mark the stream, read enough data to determine whether they
  100        * support the stream, and, if not, reset the stream's read pointer to its original
  101        * position.  If the input stream does not support this, this method may fail
  102        * with an IOException.
  103        * @param stream the input stream from which the <code>Sequence</code> should be
  104        * constructed
  105        * @return a <code>Sequence</code> object based on the MIDI file data contained
  106        * in the input stream.
  107        * @throws InvalidMidiDataException if the stream does not point to valid MIDI
  108        * file data recognized by the system
  109        * @throws IOException if an I/O exception occurs
  110        * @see InputStream#markSupported
  111        * @see InputStream#mark
  112        */
  113       public abstract Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException;
  114   
  115   
  116       /**
  117        * Obtains a MIDI sequence from the URL provided.  The URL must
  118        * point to valid MIDI file data.
  119        * @param url the URL for which the <code>Sequence</code> should be
  120        * constructed
  121        * @return a <code>Sequence</code> object based on the MIDI file data pointed
  122        * to by the URL
  123        * @throws InvalidMidiDataException if the URL does not point to valid MIDI
  124        * file data recognized by the system
  125        * @throws IOException if an I/O exception occurs
  126        */
  127       public abstract Sequence getSequence(URL url) throws InvalidMidiDataException, IOException;
  128   
  129   
  130       /**
  131        * Obtains a MIDI sequence from the <code>File</code> provided.  The <code>File</code> must
  132        * point to valid MIDI file data.
  133        * @param file the <code>File</code> from which the <code>Sequence</code> should be
  134        * constructed
  135        * @return a <code>Sequence</code> object based on the MIDI file data pointed
  136        * to by the <code>File</code>
  137        * @throws InvalidMidiDataException if the <code>File</code> does not point to valid MIDI
  138        * file data recognized by the system
  139        * @throws IOException if an I/O exception occurs
  140        */
  141       public abstract Sequence getSequence(File file) throws InvalidMidiDataException, IOException;
  142   }

Save This Page
Home » openjdk-7 » javax.sound » midi » spi » [javadoc | source]