title: EOF Exception when loading midi files
body: <p>I'm taking .mid files used by a game, and generating drum tablature from them. It works fine for some .mid files, but others produce an EOFException</p>
  
  <p>I'm using an extract of code, taken from <a href="http://www.jsresources.org/examples/DumpSequence.java.html" rel="nofollow">DumpSequence.java</a></p>
  
  <pre><code>Sequence sequence = null;
  File midiFile = new File(strFilename);
  sequence = MidiSystem.getSequence(midiFile);
  </code></pre>
  
  <p>(package is javax.sound.midi)
  <br><br>
  Error thrown: </p>
  
  <blockquote>
  java.io.EOFException: invalid MIDI file<br>
      at com.sun.media.sound.SMFParser.readTrack(Unknown Source)<br>
      at com.sun.media.sound.StandardMidiFileReader.getSequence(Unknown Source)<br>
      at com.sun.media.sound.StandardMidiFileReader.getSequence(Unknown Source)<br>
      at javax.sound.midi.MidiSystem.getSequence(Unknown Source)<br>
      at DumpSequence.main(DumpSequence.java:125)<br>
  </blockquote>
  
  <p>Can anyone point me in the right direction, on how to fix this? I've tried finding a solution, myself, but have come up empty.</p>