< prev index next >
src/java.desktop/share/classes/javax/sound/sampled/spi/FormatConversionProvider.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1999, 2016, 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.stream.Stream;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import static javax.sound.sampled.AudioFormat.Encoding;
--- 23,33 ----
* questions.
*/
package javax.sound.sampled.spi;
! import java.util.Arrays;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import static javax.sound.sampled.AudioFormat.Encoding;
*** 80,90 ****
* @return {@code true} if the encoding is supported, otherwise
* {@code false}
* @throws NullPointerException if {@code sourceEncoding} is {@code null}
*/
public boolean isSourceEncodingSupported(final Encoding sourceEncoding) {
! return Stream.of(getSourceEncodings()).anyMatch(sourceEncoding::equals);
}
/**
* Indicates whether the format converter supports conversion to the
* specified target format encoding.
--- 80,91 ----
* @return {@code true} if the encoding is supported, otherwise
* {@code false}
* @throws NullPointerException if {@code sourceEncoding} is {@code null}
*/
public boolean isSourceEncodingSupported(final Encoding sourceEncoding) {
! return Arrays.stream(getSourceEncodings())
! .anyMatch(sourceEncoding::equals);
}
/**
* Indicates whether the format converter supports conversion to the
* specified target format encoding.
*** 94,104 ****
* @return {@code true} if the encoding is supported, otherwise
* {@code false}
* @throws NullPointerException if {@code targetEncoding} is {@code null}
*/
public boolean isTargetEncodingSupported(final Encoding targetEncoding) {
! return Stream.of(getTargetEncodings()).anyMatch(targetEncoding::equals);
}
/**
* Obtains the set of target format encodings supported by the format
* converter given a particular source format. If no target format encodings
--- 95,106 ----
* @return {@code true} if the encoding is supported, otherwise
* {@code false}
* @throws NullPointerException if {@code targetEncoding} is {@code null}
*/
public boolean isTargetEncodingSupported(final Encoding targetEncoding) {
! return Arrays.stream(getTargetEncodings())
! .anyMatch(targetEncoding::equals);
}
/**
* Obtains the set of target format encodings supported by the format
* converter given a particular source format. If no target format encodings
*** 121,131 ****
* @throws NullPointerException if {@code targetEncoding} or
* {@code sourceFormat} are {@code null}
*/
public boolean isConversionSupported(final Encoding targetEncoding,
final AudioFormat sourceFormat) {
! return Stream.of(getTargetEncodings(sourceFormat))
.anyMatch(targetEncoding::equals);
}
/**
* Obtains the set of target formats with the encoding specified supported
--- 123,133 ----
* @throws NullPointerException if {@code targetEncoding} or
* {@code sourceFormat} are {@code null}
*/
public boolean isConversionSupported(final Encoding targetEncoding,
final AudioFormat sourceFormat) {
! return Arrays.stream(getTargetEncodings(sourceFormat))
.anyMatch(targetEncoding::equals);
}
/**
* Obtains the set of target formats with the encoding specified supported
*** 153,163 ****
* {@code sourceFormat} are {@code null}
*/
public boolean isConversionSupported(final AudioFormat targetFormat,
final AudioFormat sourceFormat) {
final Encoding targetEncoding = targetFormat.getEncoding();
! return Stream.of(getTargetFormats(targetEncoding, sourceFormat))
.anyMatch(targetFormat::matches);
}
/**
* Obtains an audio input stream with the specified encoding from the given
--- 155,165 ----
* {@code sourceFormat} are {@code null}
*/
public boolean isConversionSupported(final AudioFormat targetFormat,
final AudioFormat sourceFormat) {
final Encoding targetEncoding = targetFormat.getEncoding();
! return Arrays.stream(getTargetFormats(targetEncoding, sourceFormat))
.anyMatch(targetFormat::matches);
}
/**
* Obtains an audio input stream with the specified encoding from the given
< prev index next >