Hi I am working on Adobe Experience manager(AEM) CQ5. Now my task is I have to count the size unused dam images from repository. While iterating it I am getting the byte size each file but I am not able to count the bytes of all images at a time in a loop. Here is the code sample
while (iterator.hasNext()) {
Node node = session.getNode(iterator.nextNode().getPaath());
Resource res = resourceResolver = resourceResolver.getResource(node.getPath());
byte[] result = null;
try {
Node ntFileNode = getSession().getNode("Path");
Node ntResourceNode = ntFileNode.getNode("jcr:content");
InputStream is = ntResourceNode.getProperty("jcr:data").getBinary().getStream();
BufferedInputStream bin = new BufferedInputStream(is);
result = IOUtils.toByteArray(bin);
bin.close();
is.close();
System.out.print("Bytes of Images " + result); // here I am getting bytes of images but in individual. I want to get the total count of bytes of all images.
} // while loop ends
Can anyone suggest me where I have to make changes in the above code?