Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Saving drag and drop StreamResource to BufferedImage
I have following code for my drag and drop:
@Override
public void streamingFinished(final StreamingEndEvent event) {
StreamResource resource = showFile(fileName, html5File.getType(), bas);
image.setVisible(true);
image.setSource(resource);
}
private StreamResource showFile(final String name, final String type, final ByteArrayOutputStream bas) {
// resource for serving the file contents
final StreamSource streamSource = new StreamSource() {
@Override
public InputStream getStream() {
if (bas != null) {
final byte[] byteArray = bas.toByteArray();
return new ByteArrayInputStream(byteArray);
}
return null;
}
};
final StreamResource resource = new StreamResource(streamSource, name);
return resource ;
}
image is a Vaadin embedded Image but I scale my pictures with the Scalr library and that only works with BufferedImage. Is there any way I can save this StreamResource to something else than a Vaadin Image? Like a file or something so I can load it as BufferedImage