while (listing.isTruncated()) {
listing = client.listNextBatchOfObjects(listing);
objects.addAll(listing.getObjectSummaries());
}
// @checkstyle LineLength (2 lines)
final Directives dirs = new Directives()
.add("directory").attr("prefix", key);
for (final String prefix : listing.getCommonPrefixes()) {
dirs.add("commonPrefix").set(prefix).up();
}
for (final S3ObjectSummary object : objects) {
dirs.add("object")
.add("path")
.set(object.getKey()).up()
.add("size")
.set(Long.toString(object.getSize())).up()
.up();