1 7 8 package javax.sound.midi.spi; 9 10 import java.io.File ; 11 import java.io.IOException ; 12 import java.io.OutputStream ; 13 14 import javax.sound.midi.Sequence ; 15 import javax.sound.midi.MidiFileFormat ; 16 17 26 public abstract class MidiFileWriter { 27 28 29 35 public abstract int[] getMidiFileTypes(); 36 37 38 46 public abstract int[] getMidiFileTypes(Sequence sequence); 47 48 49 56 public boolean isFileTypeSupported(int fileType) { 57 58 int types[] = getMidiFileTypes(); 59 for(int i=0; i<types.length; i++) { 60 if( fileType == types[i] ) { 61 return true; 62 } 63 } 64 return false; 65 } 66 67 68 76 public boolean isFileTypeSupported(int fileType, Sequence sequence) { 77 78 int types[] = getMidiFileTypes( sequence ); 79 for(int i=0; i<types.length; i++) { 80 if( fileType == types[i] ) { 81 return true; 82 } 83 } 84 return false; 85 } 86 87 88 101 public abstract int write(Sequence in, int fileType, OutputStream out) throws IOException ; 102 103 104 117 public abstract int write(Sequence in, int fileType, File out) throws IOException ; 118 } 119 | Popular Tags |