Byte array to vaadin image

How can I convert a byte array into a vaadin image, so that I can add this to a vaadin layout (it must be a vaadin component then)?


public static Image convertToImage(final byte imageData)
StreamSource streamSource = new StreamResource.StreamSource() {
public InputStream getStream()
return (imageData == null) ? null : new ByteArrayInputStream(

  return new Image(
                   null, new StreamResource(
                                            streamSource, "streamedSourceFromByteArray"));