use of com.emc.object.s3.bean.ListObjectsResult in project pravega by pravega.
the class S3FileSystemImpl method listObjects.
@Override
public ListObjectsResult listObjects(String bucketName, String prefix) {
ListObjectsResult result = new ListObjectsResult();
ArrayList<S3Object> list = new ArrayList<>();
Path path = Paths.get(this.baseDir, bucketName, prefix);
try {
if (Files.exists(path)) {
if (Files.isDirectory(path)) {
Files.list(path).forEach(file -> {
addFileAsObjectToList(file, list, bucketName);
});
} else {
addFileAsObjectToList(path, list, bucketName);
}
}
} catch (IOException e) {
throw new S3Exception("NoSuchKey", HttpStatus.SC_NOT_FOUND, "NoSuchKey", "");
}
result.setObjects(list);
return result;
}
Aggregations