public static int write(Sequence in,int type,File out) throws IOException {
  List providers=getMidiFileWriters();
  int bytesWritten=-2;
  for (int i=0; i < providers.size(); i++) {
    MidiFileWriter writer=(MidiFileWriter)providers.get(i);
    if (writer.isFileTypeSupported(type,in)) {
      bytesWritten=writer.write(in,type,out);
      break;
    }
  }
  if (bytesWritten == -2) {
    throw new IllegalArgumentException("MIDI file type is not supported");
  }
  return bytesWritten;
}

public static int write ( Sequence in , int type , File out ) throws IOException { List providers = getMidiFileWriters ( ) ; int bytesWritten = - 2 ; for ( int i = 0 ; i < providers . size ( ) ; i ++ ) { MidiFileWriter writer = ( MidiFileWriter ) providers . get ( i ) ; if ( writer . isFileTypeSupported ( type , in ) ) { bytesWritten = writer . write ( in , type , out ) ; break ; } } if ( bytesWritten == - 2 ) { throw new IllegalArgumentException ( "MIDI file type is not supported" ) ; } return bytesWritten ; }
writes a stream of bytes representing a file of the midi file type indicated to the external file provided .
