optimized object list

This commit is contained in:
Page Asgardius 2022-10-12 12:36:22 -07:00
parent a776dfc5e4
commit 3a0dd2c461
3 changed files with 37 additions and 15 deletions

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<runningDeviceTargetSelectedWithDropDown>
<Target>
<type value="RUNNING_DEVICE_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="$USER_HOME$/.android/avd/4.7_WXGA_API_31.avd" />
</Key>
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2022-10-12T19:31:01.504763Z" />
</component>
</project>

View file

@ -92,14 +92,13 @@ public class ObjectInfo extends AppCompatActivity {
} }
ObjectListing result = s3client.listObjects(orequest); ObjectListing result = s3client.listObjects(orequest);
List<S3ObjectSummary> objects = result.getObjectSummaries(); List<S3ObjectSummary> objects = result.getObjectSummaries();
boolean nextbatch = false; for (S3ObjectSummary os : objects) {
while (result.isTruncated() || !nextbatch) { totalSize += os.getSize();
if (nextbatch) { totalItems++;
}
while (result.isTruncated()) {
result = s3client.listNextBatchOfObjects (result); result = s3client.listNextBatchOfObjects (result);
objects = result.getObjectSummaries(); objects = result.getObjectSummaries();
} else {
nextbatch = true;
}
for (S3ObjectSummary os : objects) { for (S3ObjectSummary os : objects) {
totalSize += os.getSize(); totalSize += os.getSize();
totalItems++; totalItems++;

View file

@ -115,14 +115,20 @@ public class ObjectSelect extends AppCompatActivity {
//System.out.println("Buckets:"); //System.out.println("Buckets:");
//int i=0; //int i=0;
List<S3ObjectSummary> objects = result.getObjectSummaries(); List<S3ObjectSummary> objects = result.getObjectSummaries();
boolean nextbatch = false; for (S3ObjectSummary os : objects) {
while (result.isTruncated() || !nextbatch) { filename = os.getKey().split("/");
if (nextbatch) { if (filename.length == treelevel+1) {
object.add(filename[treelevel]);
}
else {
object.add(filename[treelevel]+"/");
}
//i++;
}
while (result.isTruncated()) {
result = s3client.listNextBatchOfObjects (result); result = s3client.listNextBatchOfObjects (result);
objects = result.getObjectSummaries(); objects = result.getObjectSummaries();
} else {
nextbatch = true;
}
for (S3ObjectSummary os : objects) { for (S3ObjectSummary os : objects) {
filename = os.getKey().split("/"); filename = os.getKey().split("/");
if (filename.length == treelevel+1) { if (filename.length == treelevel+1) {