Skip to content

Commit

Permalink
S3FileSystemStore: Removed unused getFiles method
Browse files Browse the repository at this point in the history
  • Loading branch information
dgault committed May 14, 2024
1 parent a54a40e commit 51399b7
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions src/loci/formats/S3FileSystemStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,48 +251,4 @@ private TreeSet<String> getKeysFor(String suffix) throws IOException {

return keys;
}

public ArrayList<String> getFiles() throws IOException {
ArrayList<String> keys = new ArrayList<String>();

// Get the base bucket name from splitting the root path and removing the prefixed protocol and end-point
String[] pathSplit = root.toString().split(File.separator);
String bucketName = pathSplit[2];

// Append the desired key onto the remaining prefix
String key2 = root.toString().substring(root.toString().indexOf(pathSplit[3]), root.toString().length());
ListObjectsRequest listObjectsRequest = new ListObjectsRequest()
.withBucketName(bucketName)
.withPrefix(key2)
;

ObjectListing listObjectsResponse = null;
String lastKey = null;

do {
if ( listObjectsResponse != null ) {
listObjectsRequest = listObjectsRequest
.withMarker(lastKey)
;
}

listObjectsResponse = client.listObjects(listObjectsRequest);
List<S3ObjectSummary> objects = listObjectsResponse.getObjectSummaries();

// Iterate over results
ListIterator<S3ObjectSummary> iterVals = objects.listIterator();
while (iterVals.hasNext()) {
S3ObjectSummary object = (S3ObjectSummary) iterVals.next();
String k = object.getKey();
String key = k.substring(k.indexOf(key2) + key2.length() + 1, k.length());
if (!key.isEmpty()) {
keys.add(key.substring(0, key.length()-1));
}
lastKey = k;
}
} while ( listObjectsResponse.isTruncated() );
return keys;
}


}

0 comments on commit 51399b7

Please sign in to comment.