836 * Obtains the set of MIDI file types for which file writing support is
837 * provided by the system.
838 *
839 * @return array of unique file types. If no file types are supported, an
840 * array of length 0 is returned.
841 */
842 public static int[] getMidiFileTypes() {
843
844 List<MidiFileWriter> providers = getMidiFileWriters();
845 Set<Integer> allTypes = new HashSet<>();
846
847 // gather from all the providers
848
849 for (int i = 0; i < providers.size(); i++ ) {
850 MidiFileWriter writer = providers.get(i);
851 int[] types = writer.getMidiFileTypes();
852 for (int j = 0; j < types.length; j++ ) {
853 allTypes.add(types[j]);
854 }
855 }
856 int resultTypes[] = new int[allTypes.size()];
857 int index = 0;
858 Iterator<Integer> iterator = allTypes.iterator();
859 while (iterator.hasNext()) {
860 Integer integer = iterator.next();
861 resultTypes[index++] = integer.intValue();
862 }
863 return resultTypes;
864 }
865
866 /**
867 * Indicates whether file writing support for the specified MIDI file type
868 * is provided by the system.
869 *
870 * @param fileType the file type for which write capabilities are queried
871 * @return {@code true} if the file type is supported, otherwise
872 * {@code false}
873 */
874 public static boolean isFileTypeSupported(int fileType) {
875
876 List<MidiFileWriter> providers = getMidiFileWriters();
891 * @param sequence the sequence for which MIDI file type support is queried
892 * @return the set of unique supported file types. If no file types are
893 * supported, returns an array of length 0.
894 * @throws NullPointerException if {@code sequence} is {@code null}
895 */
896 public static int[] getMidiFileTypes(final Sequence sequence) {
897 Objects.requireNonNull(sequence);
898
899 List<MidiFileWriter> providers = getMidiFileWriters();
900 Set<Integer> allTypes = new HashSet<>();
901
902 // gather from all the providers
903
904 for (int i = 0; i < providers.size(); i++ ) {
905 MidiFileWriter writer = providers.get(i);
906 int[] types = writer.getMidiFileTypes(sequence);
907 for (int j = 0; j < types.length; j++ ) {
908 allTypes.add(types[j]);
909 }
910 }
911 int resultTypes[] = new int[allTypes.size()];
912 int index = 0;
913 Iterator<Integer> iterator = allTypes.iterator();
914 while (iterator.hasNext()) {
915 Integer integer = iterator.next();
916 resultTypes[index++] = integer.intValue();
917 }
918 return resultTypes;
919 }
920
921 /**
922 * Indicates whether a MIDI file of the file type specified can be written
923 * from the sequence indicated.
924 *
925 * @param fileType the file type for which write capabilities are queried
926 * @param sequence the sequence for which file writing support is queried
927 * @return {@code true} if the file type is supported for this sequence,
928 * otherwise {@code false}
929 * @throws NullPointerException if {@code sequence} is {@code null}
930 */
931 public static boolean isFileTypeSupported(final int fileType,
|
836 * Obtains the set of MIDI file types for which file writing support is
837 * provided by the system.
838 *
839 * @return array of unique file types. If no file types are supported, an
840 * array of length 0 is returned.
841 */
842 public static int[] getMidiFileTypes() {
843
844 List<MidiFileWriter> providers = getMidiFileWriters();
845 Set<Integer> allTypes = new HashSet<>();
846
847 // gather from all the providers
848
849 for (int i = 0; i < providers.size(); i++ ) {
850 MidiFileWriter writer = providers.get(i);
851 int[] types = writer.getMidiFileTypes();
852 for (int j = 0; j < types.length; j++ ) {
853 allTypes.add(types[j]);
854 }
855 }
856 int[] resultTypes = new int[allTypes.size()];
857 int index = 0;
858 Iterator<Integer> iterator = allTypes.iterator();
859 while (iterator.hasNext()) {
860 Integer integer = iterator.next();
861 resultTypes[index++] = integer.intValue();
862 }
863 return resultTypes;
864 }
865
866 /**
867 * Indicates whether file writing support for the specified MIDI file type
868 * is provided by the system.
869 *
870 * @param fileType the file type for which write capabilities are queried
871 * @return {@code true} if the file type is supported, otherwise
872 * {@code false}
873 */
874 public static boolean isFileTypeSupported(int fileType) {
875
876 List<MidiFileWriter> providers = getMidiFileWriters();
891 * @param sequence the sequence for which MIDI file type support is queried
892 * @return the set of unique supported file types. If no file types are
893 * supported, returns an array of length 0.
894 * @throws NullPointerException if {@code sequence} is {@code null}
895 */
896 public static int[] getMidiFileTypes(final Sequence sequence) {
897 Objects.requireNonNull(sequence);
898
899 List<MidiFileWriter> providers = getMidiFileWriters();
900 Set<Integer> allTypes = new HashSet<>();
901
902 // gather from all the providers
903
904 for (int i = 0; i < providers.size(); i++ ) {
905 MidiFileWriter writer = providers.get(i);
906 int[] types = writer.getMidiFileTypes(sequence);
907 for (int j = 0; j < types.length; j++ ) {
908 allTypes.add(types[j]);
909 }
910 }
911 int[] resultTypes = new int[allTypes.size()];
912 int index = 0;
913 Iterator<Integer> iterator = allTypes.iterator();
914 while (iterator.hasNext()) {
915 Integer integer = iterator.next();
916 resultTypes[index++] = integer.intValue();
917 }
918 return resultTypes;
919 }
920
921 /**
922 * Indicates whether a MIDI file of the file type specified can be written
923 * from the sequence indicated.
924 *
925 * @param fileType the file type for which write capabilities are queried
926 * @param sequence the sequence for which file writing support is queried
927 * @return {@code true} if the file type is supported for this sequence,
928 * otherwise {@code false}
929 * @throws NullPointerException if {@code sequence} is {@code null}
930 */
931 public static boolean isFileTypeSupported(final int fileType,
|