final List<S3ObjectSummary> list = listing.getObjectSummaries();
final Iterator<S3ObjectSummary> it = list.iterator();
while (it.hasNext()) {
final S3ObjectSummary os = it.next();
String key = os.getKey();
final int childDepth = getDepth(os.getKey());
if (childDepth != depth) {
continue;
}
// Remove the prefix
if (bop.hasObject()) {
if (key.startsWith(bop.getObject())) {
key = key.substring(bop.getObject().length());
}
// This has been the prefix itself
if (key.isEmpty()) {
continue;
}
}
final long modificationDate = dateToLong(os.getLastModified());
S3FileStatus fileStatus;
if (objectRepresentsDirectory(os)) {
fileStatus = new S3FileStatus(extendPath(f, key), 0, true, modificationDate, 0L);
} else {
fileStatus = new S3FileStatus(extendPath(f, key), os.getSize(), false, modificationDate, 0L);
}
resultList.add(fileStatus);
}