< prev index next >
src/java.desktop/share/classes/javax/sound/sampled/spi/MixerProvider.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1999, 2015, 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
*** 23,33 ****
* questions.
*/
package javax.sound.sampled.spi;
! import java.util.Objects;
import javax.sound.sampled.Mixer;
/**
* A provider or factory for a particular mixer type. This mechanism allows the
--- 23,33 ----
* questions.
*/
package javax.sound.sampled.spi;
! import java.util.Arrays;
import javax.sound.sampled.Mixer;
/**
* A provider or factory for a particular mixer type. This mechanism allows the
*** 52,72 ****
* @return {@code true} if the specified mixer is supported, otherwise
* {@code false}
* @throws NullPointerException if {@code info} is {@code null}
* @see #getMixerInfo()
*/
! public boolean isMixerSupported(Mixer.Info info) {
! Objects.requireNonNull(info);
!
! Mixer.Info infos[] = getMixerInfo();
!
! for(int i=0; i<infos.length; i++){
! if( info.equals( infos[i] ) ) {
! return true;
! }
! }
! return false;
}
/**
* Obtains the set of info objects representing the mixer or mixers provided
* by this MixerProvider.
--- 52,63 ----
* @return {@code true} if the specified mixer is supported, otherwise
* {@code false}
* @throws NullPointerException if {@code info} is {@code null}
* @see #getMixerInfo()
*/
! public boolean isMixerSupported(final Mixer.Info info) {
! return Arrays.stream(getMixerInfo()).anyMatch(info::equals);
}
/**
* Obtains the set of info objects representing the mixer or mixers provided
* by this MixerProvider.
< prev index next >