-
Notifications
You must be signed in to change notification settings - Fork 418
Add Firestore bundles snippets #286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| bundleStream.close(); | ||
|
|
||
| // Calling getResult() propagates errors | ||
| LoadBundleTaskProgress progress = task.getResult(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, what happens if we don't have this?
|
Also adding @schmidt-sebastian for another look |
firestore/app/src/main/java/com/google/example/firestore/kotlin/SolutionBundles.kt
Outdated
Show resolved
Hide resolved
…n/SolutionBundles.kt Co-authored-by: Rosário Pereira Fernandes <[email protected]>
| @Override | ||
| public Task<Query> then(@NonNull Task<LoadBundleTaskProgress> task) throws Exception { | ||
| // Close the stream | ||
| bundleStream.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sam - do you think the SDK should close the stream? I am not sure what the expected behavior is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering the same thing ... I personally would like that but I really don't do enough Java I/O programming to have an informed opinion.
| return connection.getInputStream(); | ||
| } | ||
|
|
||
| public void fetchBunldeFrom() throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo 😁
| public void fetchBunldeFrom() throws IOException { | |
| public void fetchBundleFrom() throws IOException { |
| fun getBundleStream(urlString: String?): InputStream { | ||
| val url = URL(urlString) | ||
| val connection = url.openConnection() as HttpURLConnection | ||
| return connection.inputStream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does firestore buffer the stream internally? otherwise it may be very inefficient to read from an unbuffered stream
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Android snippets for:
https://firebase.google.com/docs/firestore/solutions/serve-bundles