code: private byte[] getImageContent(InputStream in, String mime) throws FMSException {
  		byte[] imageInByte = null;
  		ByteArrayOutputStream baos = null;
  		try {
  			BufferedImage originalImage = ImageIO.read(in);
  			baos = new ByteArrayOutputStream();
  			ImageIO.write(originalImage, mime, baos);
  			baos.flush();
  			imageInByte = baos.toByteArray();
  			baos.close();
  		} catch (IOException e) {
  			throw new FMSException("Error while reading the upload file.", e);
  		} finally {
  			close(baos);
  			close(in);
  		}
  		return imageInByte;
  	}
docs: Method to return the byte[] value of the given image input stream
  
  @param in the input stream
  @param mime the mime type of the file
  @return byte[] the file content
  @throws FMSException