author | serb |
Tue, 13 May 2014 16:06:12 +0400 | |
changeset 24561 | 81c6f1aff26e |
parent 5506 | 202f599c92aa |
child 25128 | 2dfdfa369071 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
24561
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
2 |
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 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 |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package javax.sound.sampled.spi; |
|
27 |
||
28 |
import java.io.File; |
|
29 |
import java.io.InputStream; |
|
30 |
import java.io.IOException; |
|
31 |
import java.net.URL; |
|
32 |
||
33 |
import javax.sound.sampled.AudioFileFormat; |
|
34 |
import javax.sound.sampled.AudioInputStream; |
|
35 |
import javax.sound.sampled.UnsupportedAudioFileException; |
|
36 |
||
37 |
/** |
|
24561
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
38 |
* Provider for audio file reading services. Classes providing concrete |
2 | 39 |
* implementations can parse the format information from one or more types of |
40 |
* audio file, and can produce audio input streams from files of these types. |
|
41 |
* |
|
42 |
* @author Kara Kytle |
|
43 |
* @since 1.3 |
|
44 |
*/ |
|
45 |
public abstract class AudioFileReader { |
|
46 |
||
47 |
/** |
|
24561
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
48 |
* Obtains the audio file format of the input stream provided. The stream |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
49 |
* must point to valid audio file data. In general, audio file readers may |
2 | 50 |
* need to read some data from the stream before determining whether they |
24561
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
51 |
* support it. These parsers must be able to mark the stream, read enough |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
52 |
* data to determine whether they support the stream, and, if not, reset the |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
53 |
* stream's read pointer to its original position. If the input stream does |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
54 |
* not support this, this method may fail with an {@code IOException}. |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
55 |
* |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
56 |
* @param stream the input stream from which file format information should |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
57 |
* be extracted |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
58 |
* @return an {@code AudioFileFormat} object describing the audio file |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
59 |
* format |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
60 |
* @throws UnsupportedAudioFileException if the stream does not point to |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
61 |
* valid audio file data recognized by the system |
2 | 62 |
* @throws IOException if an I/O exception occurs |
63 |
* @see InputStream#markSupported |
|
64 |
* @see InputStream#mark |
|
65 |
*/ |
|
24561
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
66 |
public abstract AudioFileFormat getAudioFileFormat(InputStream stream) |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
67 |
throws UnsupportedAudioFileException, IOException; |
2 | 68 |
|
69 |
/** |
|
24561
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
70 |
* Obtains the audio file format of the URL provided. The URL must point to |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
71 |
* valid audio file data. |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
72 |
* |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
73 |
* @param url the URL from which file format information should be |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
74 |
* extracted |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
75 |
* @return an {@code AudioFileFormat} object describing the audio file |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
76 |
* format |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
77 |
* @throws UnsupportedAudioFileException if the URL does not point to valid |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
78 |
* audio file data recognized by the system |
2 | 79 |
* @throws IOException if an I/O exception occurs |
80 |
*/ |
|
24561
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
81 |
public abstract AudioFileFormat getAudioFileFormat(URL url) |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
82 |
throws UnsupportedAudioFileException, IOException; |
2 | 83 |
|
84 |
/** |
|
24561
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
85 |
* Obtains the audio file format of the {@code File} provided. |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
86 |
* The {@code File} must point to valid audio file data. |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
87 |
* |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
88 |
* @param file the {@code File} from which file format information |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
89 |
* should be extracted |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
90 |
* @return an {@code AudioFileFormat} object describing the audio file |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
91 |
* format |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
92 |
* @throws UnsupportedAudioFileException if the {@code File} does not point |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
93 |
* to valid audio file data recognized by the system |
2 | 94 |
* @throws IOException if an I/O exception occurs |
95 |
*/ |
|
24561
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
96 |
public abstract AudioFileFormat getAudioFileFormat(File file) |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
97 |
throws UnsupportedAudioFileException, IOException; |
2 | 98 |
|
99 |
/** |
|
24561
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
100 |
* Obtains an audio input stream from the input stream provided. The stream |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
101 |
* must point to valid audio file data. In general, audio file readers may |
2 | 102 |
* need to read some data from the stream before determining whether they |
24561
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
103 |
* support it. These parsers must be able to mark the stream, read enough |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
104 |
* data to determine whether they support the stream, and, if not, reset the |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
105 |
* stream's read pointer to its original position. If the input stream does |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
106 |
* not support this, this method may fail with an {@code IOException}. |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
107 |
* |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
108 |
* @param stream the input stream from which the {@code AudioInputStream} |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
109 |
* should be constructed |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
110 |
* @return an {@code AudioInputStream} object based on the audio file data |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
111 |
* contained in the input stream. |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
112 |
* @throws UnsupportedAudioFileException if the stream does not point to |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
113 |
* valid audio file data recognized by the system |
2 | 114 |
* @throws IOException if an I/O exception occurs |
115 |
* @see InputStream#markSupported |
|
116 |
* @see InputStream#mark |
|
117 |
*/ |
|
24561
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
118 |
public abstract AudioInputStream getAudioInputStream(InputStream stream) |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
119 |
throws UnsupportedAudioFileException, IOException; |
2 | 120 |
|
121 |
/** |
|
24561
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
122 |
* Obtains an audio input stream from the URL provided. The URL must point |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
123 |
* to valid audio file data. |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
124 |
* |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
125 |
* @param url the URL for which the {@code AudioInputStream} should be |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
126 |
* constructed |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
127 |
* @return an {@code AudioInputStream} object based on the audio file data |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
128 |
* pointed to by the URL |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
129 |
* @throws UnsupportedAudioFileException if the URL does not point to valid |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
130 |
* audio file data recognized by the system |
2 | 131 |
* @throws IOException if an I/O exception occurs |
132 |
*/ |
|
24561
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
133 |
public abstract AudioInputStream getAudioInputStream(URL url) |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
134 |
throws UnsupportedAudioFileException, IOException; |
2 | 135 |
|
136 |
/** |
|
24561
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
137 |
* Obtains an audio input stream from the {@code File} provided. |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
138 |
* The {@code File} must point to valid audio file data. |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
139 |
* |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
140 |
* @param file the {@code File} for which the {@code AudioInputStream} |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
141 |
* should be constructed |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
142 |
* @return an {@code AudioInputStream} object based on the audio file data |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
143 |
* pointed to by the File |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
144 |
* @throws UnsupportedAudioFileException if the {@code File} does not point |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
145 |
* to valid audio file data recognized by the system |
2 | 146 |
* @throws IOException if an I/O exception occurs |
147 |
*/ |
|
24561
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
148 |
public abstract AudioInputStream getAudioInputStream(File file) |
81c6f1aff26e
8042007: Javadoc cleanup of javax.sound.sampled.spi package
serb
parents:
5506
diff
changeset
|
149 |
throws UnsupportedAudioFileException, IOException; |
2 | 150 |
} |