< prev index next >

src/java.desktop/share/classes/javax/sound/midi/spi/MidiFileWriter.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 26,35 **** --- 26,36 ---- package javax.sound.midi.spi; import java.io.File; import java.io.IOException; import java.io.OutputStream; + import java.util.Arrays; import javax.sound.midi.Sequence; /** * A {@code MidiFileWriter} supplies MIDI file-writing services. Classes that
*** 67,85 **** * * @param fileType the file type for which write capabilities are queried * @return {@code true} if the file type is supported, otherwise * {@code false} */ ! public boolean isFileTypeSupported(int fileType) { ! ! int types[] = getMidiFileTypes(); ! for(int i=0; i<types.length; i++) { ! if( fileType == types[i] ) { ! return true; ! } ! } ! return false; } /** * Indicates whether a MIDI file of the file type specified can be written * from the sequence indicated. --- 68,80 ---- * * @param fileType the file type for which write capabilities are queried * @return {@code true} if the file type is supported, otherwise * {@code false} */ ! public boolean isFileTypeSupported(final int fileType) { ! return Arrays.stream(getMidiFileTypes()) ! .anyMatch(type -> fileType == type); } /** * Indicates whether a MIDI file of the file type specified can be written * from the sequence indicated.
*** 88,106 **** * @param sequence the sequence for which file writing support is queried * @return {@code true} if the file type is supported for this sequence, * otherwise {@code false} * @throws NullPointerException if {@code sequence} is {@code null} */ ! public boolean isFileTypeSupported(int fileType, Sequence sequence) { ! ! int types[] = getMidiFileTypes( sequence ); ! for(int i=0; i<types.length; i++) { ! if( fileType == types[i] ) { ! return true; ! } ! } ! return false; } /** * Writes a stream of bytes representing a MIDI file of the file type * indicated to the output stream provided. --- 83,96 ---- * @param sequence the sequence for which file writing support is queried * @return {@code true} if the file type is supported for this sequence, * otherwise {@code false} * @throws NullPointerException if {@code sequence} is {@code null} */ ! public boolean isFileTypeSupported(final int fileType, ! final Sequence sequence) { ! return Arrays.stream(getMidiFileTypes(sequence)) ! .anyMatch(type -> fileType == type); } /** * Writes a stream of bytes representing a MIDI file of the file type * indicated to the output stream provided.
< prev index next >