Saving drag and drop StreamResource to BufferedImage

I have following code for my drag and drop:
public void streamingFinished(final StreamingEndEvent event) {
StreamResource resource = showFile(fileName, html5File.getType(), bas);

private StreamResource showFile(final String name, final String type, final ByteArrayOutputStream bas) {
// resource for serving the file contents
final StreamSource streamSource = new StreamSource() {
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