/**
  * Returns an input stream to the image in the given file. If the file is an audio file, the
  * embedded album art is returned.
  */
 private InputStream getImageInputStream(File file) throws IOException {
   JaudiotaggerParser parser = new JaudiotaggerParser();
   if (parser.isApplicable(file)) {
     MediaFile mediaFile = mediaFileService.getMediaFile(file);
     return new ByteArrayInputStream(parser.getImageData(mediaFile));
   } else {
     return new FileInputStream(file);
   }
 }
 private void sendUnscaled(File file, HttpServletResponse response) throws IOException {
   JaudiotaggerParser parser = new JaudiotaggerParser();
   if (!parser.isApplicable(file)) {
     response.setContentType(StringUtil.getMimeType(FilenameUtils.getExtension(file.getName())));
   }
   InputStream in = null;
   try {
     in = getImageInputStream(file);
     IOUtils.copy(in, response.getOutputStream());
   } finally {
     IOUtils.closeQuietly(in);
   }
 }