@Test public void testGetAudioFileFormatWithUnsupportedFile() throws IOException { final FlacAudioFileReader flacAudioFileReader = new FlacAudioFileReader(); final File file = File.createTempFile("flacTest", ".wav"); final OutputStream out = new FileOutputStream(file); out.write(new byte[2048]); out.close(); try { flacAudioFileReader.getAudioInputStream(file); fail("Expected UnsupportedAudioFileException"); } catch (UnsupportedAudioFileException e) { } finally { file.delete(); } }
public AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException { InputStream inputStream = new FileInputStream(file); try { return getAudioInputStream(inputStream, (int) file.length()); } catch (UnsupportedAudioFileException e) { try { inputStream.close(); } catch (IOException e1) { e1.printStackTrace(); } throw e; } catch (IOException e) { try { inputStream.close(); } catch (IOException e1) { e1.printStackTrace(); } throw e; } }
FlacAudioFileReader extends AudioFileReader { public AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException { InputStream inputStream = new FileInputStream(file); try { return getAudioInputStream(inputStream, (int) file.length()); } catch (UnsupportedAudioFileException e) { try { inputStream.close(); } catch (IOException e1) { e1.printStackTrace(); } throw e; } catch (IOException e) { try { inputStream.close(); } catch (IOException e1) { e1.printStackTrace(); } throw e; } } }
FlacAudioFileReader extends AudioFileReader { public AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException { InputStream inputStream = new FileInputStream(file); try { return getAudioInputStream(inputStream, (int) file.length()); } catch (UnsupportedAudioFileException e) { try { inputStream.close(); } catch (IOException e1) { e1.printStackTrace(); } throw e; } catch (IOException e) { try { inputStream.close(); } catch (IOException e1) { e1.printStackTrace(); } throw e; } }  }
FlacAudioFileReader extends AudioFileReader { public AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException { InputStream inputStream = new FileInputStream(file); try { return getAudioInputStream(inputStream, (int) file.length()); } catch (UnsupportedAudioFileException e) { try { inputStream.close(); } catch (IOException e1) { e1.printStackTrace(); } throw e; } catch (IOException e) { try { inputStream.close(); } catch (IOException e1) { e1.printStackTrace(); } throw e; } }  AudioFileFormat getAudioFileFormat(File file); AudioFileFormat getAudioFileFormat(URL url); AudioFileFormat getAudioFileFormat(InputStream stream); AudioInputStream getAudioInputStream(File file); AudioInputStream getAudioInputStream(URL url); AudioInputStream getAudioInputStream(final InputStream stream); }
FlacAudioFileReader extends AudioFileReader { public AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException { InputStream inputStream = new FileInputStream(file); try { return getAudioInputStream(inputStream, (int) file.length()); } catch (UnsupportedAudioFileException e) { try { inputStream.close(); } catch (IOException e1) { e1.printStackTrace(); } throw e; } catch (IOException e) { try { inputStream.close(); } catch (IOException e1) { e1.printStackTrace(); } throw e; } }  AudioFileFormat getAudioFileFormat(File file); AudioFileFormat getAudioFileFormat(URL url); AudioFileFormat getAudioFileFormat(InputStream stream); AudioInputStream getAudioInputStream(File file); AudioInputStream getAudioInputStream(URL url); AudioInputStream getAudioInputStream(final InputStream stream); static final String KEY_DURATION; }