public MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException {
   InputStream inputStream = url.openStream();
   try {
     return getMidiFileFormat(inputStream);
   } finally {
     inputStream.close();
   }
 }
 public Sequence getSequence(URL url) throws InvalidMidiDataException, IOException {
   InputStream inputStream = url.openStream();
   try {
     return getSequence(inputStream);
   } catch (InvalidMidiDataException e) {
     if (TDebug.TraceAllExceptions) {
       TDebug.out(e);
     }
     inputStream.close();
     throw e;
   } catch (IOException e) {
     if (TDebug.TraceAllExceptions) {
       TDebug.out(e);
     }
     inputStream.close();
     throw e;
   }
 }
 public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException {
   InputStream inputStream = new FileInputStream(file);
   // inputStream = new BufferedInputStream(inputStream, 1024);
   try {
     return getMidiFileFormat(inputStream);
   } finally {
     inputStream.close();
   }
 }
 public Sequence getSequence(File file) throws InvalidMidiDataException, IOException {
   InputStream inputStream = new FileInputStream(file);
   // inputStream = new BufferedInputStream(inputStream, 1024);
   try {
     return getSequence(inputStream);
   } catch (InvalidMidiDataException e) {
     if (TDebug.TraceAllExceptions) {
       TDebug.out(e);
     }
     inputStream.close();
     throw e;
   } catch (IOException e) {
     if (TDebug.TraceAllExceptions) {
       TDebug.out(e);
     }
     inputStream.close();
     throw e;
   }
 }
Exemple #5
1
 /**
  * Loads a sequence from an input stream. Returns null if an error occurs.
  *
  * @param is
  * @return
  */
 public Sequence getSequence(InputStream is) {
   try {
     if (!is.markSupported()) {
       is = new BufferedInputStream(is);
     }
     Sequence s = MidiSystem.getSequence(is);
     is.close();
     return s;
   } catch (InvalidMidiDataException ex) {
     ex.printStackTrace();
     return null;
   } catch (IOException ex) {
     ex.printStackTrace();
     return null;
   }
 }