in hadoop-testutils/src/main/java/org/apache/hadoop/hbase/oss/EmbeddedS3.java [232:254]
private void innerListing(String prefix, String delimiter,
List<S3ObjectSummary> summaries, List<String> prefixes) {
Set<String> commonPrefixes = new HashSet<>();
for (String key : bucket.keySet()) {
if (!key.startsWith(prefix)) {
continue;
}
if (delimiter != null) {
int index = key.indexOf(delimiter, prefix.length());
if (index > 0) {
// Finding the delimiter means non-recursive listing
// Add the first-level child to common prefixes and continue
commonPrefixes.add(key.substring(0, index));
continue;
}
}
S3ObjectSummary summary = new S3ObjectSummary();
summary.setKey(key);
summary.setSize(bucket.get(key).data.length());
summaries.add(summary);
}
prefixes.addAll(commonPrefixes);
}