InputStream in = node.getProperty("jcr:data").getStream();
ByteArrayOutputStream out = new ByteArrayOutputStream(500 * 1024);
makeThumbnail(in, out);
out.flush();
node.setProperty("dms:Thumbnail", new ByteArrayInputStream(out
.toByteArray()));
node.save();
ByteArrayOutputStream out = new ByteArrayOutputStream(500 * 1024);
makeThumbnail(in, out);
out.flush();
node.setProperty("dms:Thumbnail", new ByteArrayInputStream(out
.toByteArray()));
node.save();