import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
+import org.apache.commons.io.IOUtils;
import org.argeo.api.cms.CmsEditable;
import org.argeo.api.cms.CmsEvent;
import org.argeo.api.cms.CmsStyle;
throws RepositoryException {
Node content = fileNode.getNode(Node.JCR_CONTENT);
-// try (InputStream in = JcrUtils.getFileAsStream(fileNode)) {
-// BufferedImage img = ImageIO.read(in);
-// System.out.println("width=" + img.getWidth() + ", height=" + img.getHeight());
-// } catch (IOException e) {
-// throw new RuntimeException(e);
-// }
+ boolean test = false;
+ if (test) {
+ try (InputStream in = JcrUtils.getFileAsStream(fileNode);
+ OutputStream out = Files.newOutputStream(Paths.get("/home/mbaudier/tmp/" + fileNode.getName()));) {
+// BufferedImage img = ImageIO.read(in);
+// System.out.println(fileNode.getName() + ": width=" + img.getWidth() + ", height=" + img.getHeight());
+ IOUtils.copy(in, out);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+// try (InputStream in = JcrUtils.getFileAsStream(fileNode);) {
+// ImageData imageData = new ImageData(in);
+// System.out.println(fileNode.getName() + ": width=" + imageData.width + ", height=" + imageData.height);
+// } catch (IOException e) {
+// throw new RuntimeException(e);
+// }
+ }
// TODO move it deeper in the middleware.
if (!content.isNodeType(EntityType.box.get())) {
if (content.getSession().hasPermission(content.getPath(), Session.ACTION_SET_PROPERTY)) {