< prev index next >

src/java.desktop/share/classes/com/sun/media/sound/StandardMidiFileWriter.java

Print this page

        

*** 45,55 **** import javax.sound.midi.ShortMessage; import javax.sound.midi.SysexMessage; import javax.sound.midi.Track; import javax.sound.midi.spi.MidiFileWriter; - /** * MIDI file writer. * * @author Kara Kytle * @author Jan Borgersen --- 45,54 ----
*** 70,93 **** private static final int MIDI_TYPE_1 = 1; private static final int bufferSize = 16384; // buffersize for write private DataOutputStream tddos; // data output stream for track writing - - /** ! * MIDI parser types */ private static final int types[] = { MIDI_TYPE_0, MIDI_TYPE_1 }; ! ! /** ! * new ! */ public int[] getMidiFileTypes() { int[] localArray = new int[types.length]; System.arraycopy(types, 0, localArray, 0, types.length); return localArray; } --- 69,87 ---- private static final int MIDI_TYPE_1 = 1; private static final int bufferSize = 16384; // buffersize for write private DataOutputStream tddos; // data output stream for track writing /** ! * MIDI parser types. */ private static final int types[] = { MIDI_TYPE_0, MIDI_TYPE_1 }; ! @Override public int[] getMidiFileTypes() { int[] localArray = new int[types.length]; System.arraycopy(types, 0, localArray, 0, types.length); return localArray; }
*** 98,107 **** --- 92,102 ---- * @param sequence the sequence for which midi file type support * is queried * @return array of file types. If no file types are supported, * returns an array of length 0. */ + @Override public int[] getMidiFileTypes(Sequence sequence){ int typesArray[]; Track tracks[] = sequence.getTracks(); if( tracks.length==1 ) {
*** 114,123 **** --- 109,119 ---- } return typesArray; } + @Override public int write(Sequence in, int type, OutputStream out) throws IOException { Objects.requireNonNull(out); if (!isFileTypeSupported(type, in)) { throw new IllegalArgumentException("Could not write MIDI file"); }
*** 139,159 **** } // Done....return bytesWritten return (int) bytesWritten; } public int write(Sequence in, int type, File out) throws IOException { Objects.requireNonNull(in); FileOutputStream fos = new FileOutputStream(out); // throws IOException int bytesWritten = write( in, type, fos ); fos.close(); return bytesWritten; } //================================================================================= - private InputStream getFileStream(int type, Sequence sequence) throws IOException { Track tracks[] = sequence.getTracks(); int bytesBuilt = 0; int headerLength = 14; int length = 0; --- 135,155 ---- } // Done....return bytesWritten return (int) bytesWritten; } + @Override public int write(Sequence in, int type, File out) throws IOException { Objects.requireNonNull(in); FileOutputStream fos = new FileOutputStream(out); // throws IOException int bytesWritten = write( in, type, fos ); fos.close(); return bytesWritten; } //================================================================================= private InputStream getFileStream(int type, Sequence sequence) throws IOException { Track tracks[] = sequence.getTracks(); int bytesBuilt = 0; int headerLength = 14; int length = 0;
< prev index next >