Download data from S3

The last step of my application is to retrieve the data from the S3 server.
As far as visualization is concerned, there will be no problems because the overview screen will be the same as the one used when creating the case. We need to take our file.dat and rehost it so that it is readable as the Case object we created at the beginning.

Again, we’ll rely fully on the documentation provided by AWS and visible at this link

We know that our AWSManager connects to our server, now we need to figure out how to search for a file within it.

We get a list of case data:

with this portion of code to print all cases that are present in the bucket on the unity console.

Now we need to select just one of these cases based on the search field we entered in the application’s SearchPanel.

By adding the case search, we immediately get the desired result.

The next part is not more complicated but it introduces the concept of callback that I’ll explain better in a dedicated article. Given the sequence of operations, I left the commented code for me as well.

To make it short, we are going to check that the file found is not empty, we are going to read our file and copy it in our variable. Finally, we are going to convert it from bytes format to our Case object.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store