/**
* Writes a stream of bytes representing an audio file of the specified file
* type to the external file provided.
*
* @param stream the audio input stream containing audio data to be written
* to the file
* @param fileType the kind of audio file to write
* @param out the external file to which the file data should be written
* @return the number of bytes written to the file
* @throws IOException if an I/O exception occurs
* @throws IllegalArgumentException if the file type is not supported by the
* system
* @throws NullPointerException if {@code stream} or {@code fileType} or
* {@code out} are {@code null}
* @see #isFileTypeSupported
* @see #getAudioFileTypes
*/
public static int write(final AudioInputStream stream,
final AudioFileFormat.Type fileType,
final File out) throws IOException {
Objects.requireNonNull(stream);
Objects.requireNonNull(fileType);
Objects.requireNonNull(out);
for (final AudioFileWriter writer : getAudioFileWriters()) {
try {
return writer.write(stream, fileType, out);
} catch (final IllegalArgumentException ignored) {
// thrown if this provider cannot write the stream, try next
}
}
throw new IllegalArgumentException(
"could not write audio file: file type not supported: "
+ fileType);
}
AudioSystem.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:openjdk-jdk10
作者:
评论列表
文章目录