Java tutorial
import java.io.File; import java.net.URL; import javax.sound.midi.MidiFileFormat; import javax.sound.midi.MidiSystem; public class Main { public static void main(String[] argv) throws Exception { // From file MidiFileFormat fformat = MidiSystem.getMidiFileFormat(new File("midifile")); // From URL // fformat = MidiSystem.getMidiFileFormat(new URL("http://hostname/midifile")); // Get file format switch (fformat.getType()) { case 0: // mid break; case 1: // rmf break; } } }