< prev index next >
src/java.desktop/share/classes/com/sun/media/sound/SunFileReader.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1999, 2015, 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, 2016, 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
*** 45,55 ****
* @author Jan Borgersen
*/
abstract class SunFileReader extends AudioFileReader {
@Override
! public final AudioFileFormat getAudioFileFormat(final InputStream stream)
throws UnsupportedAudioFileException, IOException {
stream.mark(200); // The biggest value which was historically used
try {
return getAudioFileFormatImpl(stream);
} catch (final EOFException ignored) {
--- 45,55 ----
* @author Jan Borgersen
*/
abstract class SunFileReader extends AudioFileReader {
@Override
! public final StandardFileFormat getAudioFileFormat(final InputStream stream)
throws UnsupportedAudioFileException, IOException {
stream.mark(200); // The biggest value which was historically used
try {
return getAudioFileFormatImpl(stream);
} catch (final EOFException ignored) {
*** 85,99 ****
@Override
public AudioInputStream getAudioInputStream(final InputStream stream)
throws UnsupportedAudioFileException, IOException {
stream.mark(200); // The biggest value which was historically used
try {
! final AudioFileFormat fileFormat = getAudioFileFormatImpl(stream);
// we've got everything, the stream is supported and it is at the
// beginning of the audio data, so return an AudioInputStream
! return new AudioInputStream(stream, fileFormat.getFormat(),
! fileFormat.getFrameLength());
} catch (UnsupportedAudioFileException | EOFException ignored) {
// stream is unsupported or the header is less than was expected
stream.reset();
throw new UnsupportedAudioFileException();
}
--- 85,99 ----
@Override
public AudioInputStream getAudioInputStream(final InputStream stream)
throws UnsupportedAudioFileException, IOException {
stream.mark(200); // The biggest value which was historically used
try {
! final StandardFileFormat format = getAudioFileFormatImpl(stream);
// we've got everything, the stream is supported and it is at the
// beginning of the audio data, so return an AudioInputStream
! return new AudioInputStream(stream, format.getFormat(),
! format.getLongFrameLength());
} catch (UnsupportedAudioFileException | EOFException ignored) {
// stream is unsupported or the header is less than was expected
stream.reset();
throw new UnsupportedAudioFileException();
}
*** 138,148 ****
* @throws IOException if an I/O exception occurs
* @throws EOFException is used incorrectly by our readers instead of
* UnsupportedAudioFileException if the header is less than was
* expected
*/
! abstract AudioFileFormat getAudioFileFormatImpl(InputStream stream)
throws UnsupportedAudioFileException, IOException;
// HELPER METHODS
/**
--- 138,148 ----
* @throws IOException if an I/O exception occurs
* @throws EOFException is used incorrectly by our readers instead of
* UnsupportedAudioFileException if the header is less than was
* expected
*/
! abstract StandardFileFormat getAudioFileFormatImpl(InputStream stream)
throws UnsupportedAudioFileException, IOException;
// HELPER METHODS
/**
< prev index next >