@Override public byte[] encode(BufferedImage bufferedImage) throws IOException {
  ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
  encode(bufferedImage,outputStream);
  return outputStream.toByteArray();
}

@ Override public byte [ ] encode ( BufferedImage bufferedImage ) throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( ) ; encode ( bufferedImage , outputStream ) ; return outputStream . toByteArray ( ) ; }
encodes an image in jpeg format .
