use of javax.sound.sampled.AudioFileFormat in project jdk8u_jdk by JetBrains.
the class WaveFloatFileReader method getAudioFileFormat.
public AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException, IOException {
InputStream stream = new FileInputStream(file);
AudioFileFormat format;
try {
format = getAudioFileFormat(new BufferedInputStream(stream));
} finally {
stream.close();
}
return format;
}
use of javax.sound.sampled.AudioFileFormat in project Minim by ddf.
the class MpegAudioFileReader method getAudioFileFormat.
/**
* Returns AudioFileFormat from URL.
*/
public AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException {
if (TDebug.TraceAudioFileReader) {
TDebug.out("MpegAudioFileReader.getAudioFileFormat(URL): begin");
}
long lFileLengthInBytes = AudioSystem.NOT_SPECIFIED;
URLConnection conn = url.openConnection();
// Tell shoucast server (if any) that SPI support shoutcast stream.
conn.setRequestProperty("Icy-Metadata", "1");
InputStream inputStream = conn.getInputStream();
AudioFileFormat audioFileFormat = null;
try {
audioFileFormat = getAudioFileFormat(inputStream, lFileLengthInBytes);
} finally {
inputStream.close();
}
if (TDebug.TraceAudioFileReader) {
TDebug.out("MpegAudioFileReader.getAudioFileFormat(URL): end");
}
return audioFileFormat;
}
Aggregations