public static byte[] toByteArray(Consumer<OutputStream> os) {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        os.accept(buffer);

        return buffer.toByteArray();
    }
Used to extract resource name (e.g. "#{resource['picture.png'}")
primefaces/src/main/java/org/primefaces/util/ResourceUtils.java