< prev index next >
src/java.desktop/share/classes/javax/sound/sampled/spi/AudioFileWriter.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,36 ****
package javax.sound.sampled.spi;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
! import java.util.Objects;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import static javax.sound.sampled.AudioFileFormat.Type;
--- 26,36 ----
package javax.sound.sampled.spi;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
! import java.util.Arrays;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import static javax.sound.sampled.AudioFileFormat.Type;
*** 61,81 ****
* @param fileType the file type for which write capabilities are queried
* @return {@code true} if the file type is supported, otherwise
* {@code false}
* @throws NullPointerException if {@code fileType} is {@code null}
*/
! public boolean isFileTypeSupported(Type fileType) {
! Objects.requireNonNull(fileType);
!
! Type types[] = getAudioFileTypes();
!
! for(int i=0; i<types.length; i++) {
! if( fileType.equals( types[i] ) ) {
! return true;
! }
! }
! return false;
}
/**
* Obtains the file types that this audio file writer can write from the
* audio input stream specified.
--- 61,72 ----
* @param fileType the file type for which write capabilities are queried
* @return {@code true} if the file type is supported, otherwise
* {@code false}
* @throws NullPointerException if {@code fileType} is {@code null}
*/
! public boolean isFileTypeSupported(final Type fileType) {
! return Arrays.stream(getAudioFileTypes()).anyMatch(fileType::equals);
}
/**
* Obtains the file types that this audio file writer can write from the
* audio input stream specified.
*** 97,116 ****
* @return {@code true} if the file type is supported for this audio input
* stream, otherwise {@code false}
* @throws NullPointerException if {@code fileType} or {@code stream} are
* {@code null}
*/
! public boolean isFileTypeSupported(Type fileType, AudioInputStream stream) {
! Objects.requireNonNull(fileType);
! Type types[] = getAudioFileTypes( stream );
!
! for(int i=0; i<types.length; i++) {
! if( fileType.equals( types[i] ) ) {
! return true;
! }
! }
! return false;
}
/**
* Writes a stream of bytes representing an audio file of the file type
* indicated to the output stream provided. Some file types require that the
--- 88,101 ----
* @return {@code true} if the file type is supported for this audio input
* stream, otherwise {@code false}
* @throws NullPointerException if {@code fileType} or {@code stream} are
* {@code null}
*/
! public boolean isFileTypeSupported(final Type fileType,
! final AudioInputStream stream) {
! return Arrays.stream(getAudioFileTypes(stream))
! .anyMatch(fileType::equals);
}
/**
* Writes a stream of bytes representing an audio file of the file type
* indicated to the output stream provided. Some file types require that the
< prev index next >