1 /*
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
27
28 import java.io.File;
29 import java.io.IOException;
30 import java.io.OutputStream;
31 import java.util.Arrays;
32
33 import javax.sound.sampled.AudioInputStream;
34 import javax.sound.sampled.AudioSystem;
35
36 import static javax.sound.sampled.AudioFileFormat.Type;
37
38 /**
39 * Provider for audio file writing services. Classes providing concrete
40 * implementations can write one or more types of audio file from an audio
41 * stream.
42 *
43 * @author Kara Kytle
44 * @since 1.3
45 */
46 public abstract class AudioFileWriter {
47
48 /**
49 * Obtains the file types for which file writing support is provided by this
50 * audio file writer.
51 *
52 * @return array of file types. If no file types are supported, an array of
53 * length 0 is returned.
54 */
55 public abstract Type[] getAudioFileTypes();
56
57 /**
58 * Indicates whether file writing support for the specified file type is
59 * provided by this audio file writer.
60 *
61 * @param fileType the file type for which write capabilities are queried
62 * @return {@code true} if the file type is supported, otherwise
63 * {@code false}
64 * @throws NullPointerException if {@code fileType} is {@code null}
65 */
66 public boolean isFileTypeSupported(final Type fileType) {
|
1 /*
2 * Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
27
28 import java.io.File;
29 import java.io.IOException;
30 import java.io.OutputStream;
31 import java.util.Arrays;
32
33 import javax.sound.sampled.AudioInputStream;
34 import javax.sound.sampled.AudioSystem;
35
36 import static javax.sound.sampled.AudioFileFormat.Type;
37
38 /**
39 * Provider for audio file writing services. Classes providing concrete
40 * implementations can write one or more types of audio file from an audio
41 * stream.
42 *
43 * @author Kara Kytle
44 * @since 1.3
45 */
46 public abstract class AudioFileWriter {
47
48 /**
49 * Constructs an {@code AudioFileWriter}.
50 */
51 protected AudioFileWriter() {}
52
53 /**
54 * Obtains the file types for which file writing support is provided by this
55 * audio file writer.
56 *
57 * @return array of file types. If no file types are supported, an array of
58 * length 0 is returned.
59 */
60 public abstract Type[] getAudioFileTypes();
61
62 /**
63 * Indicates whether file writing support for the specified file type is
64 * provided by this audio file writer.
65 *
66 * @param fileType the file type for which write capabilities are queried
67 * @return {@code true} if the file type is supported, otherwise
68 * {@code false}
69 * @throws NullPointerException if {@code fileType} is {@code null}
70 */
71 public boolean isFileTypeSupported(final Type fileType) {
|