@Test public void getStream() { TestObserver<StreamDownloadTask.TaskSnapshot> storageTestObserver = RxFirebaseStorage.getStream(mockStorageRef) .test(); testOnSuccessListener.getValue().onSuccess(streamSnapshot); verify(mockStorageRef).getStream(); storageTestObserver.assertNoErrors(); storageTestObserver.assertValueCount(1); storageTestObserver.assertValueSet(Collections.singletonList(streamSnapshot)); storageTestObserver.assertComplete(); storageTestObserver.dispose(); }
@NonNull public static Single<StreamDownloadTask.TaskSnapshot> getStream(@NonNull final StorageReference storageRef) { return Single.create(new SingleOnSubscribe<StreamDownloadTask.TaskSnapshot>() { public void subscribe(final SingleEmitter<StreamDownloadTask.TaskSnapshot> emitter) throws Exception { final StorageTask<StreamDownloadTask.TaskSnapshot> taskSnapshotStorageTask = storageRef.getStream().addOnSuccessListener(new OnSuccessListener<StreamDownloadTask.TaskSnapshot>() { @Override public void onSuccess(StreamDownloadTask.TaskSnapshot taskSnapshot) { emitter.onSuccess(taskSnapshot); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { if (!emitter.isDisposed()) emitter.onError(e); } }); emitter.setCancellable(new Cancellable() { @Override public void cancel() throws Exception { taskSnapshotStorageTask.cancel(); } }); } }); }
RxFirebaseStorage { @NonNull public static Single<StreamDownloadTask.TaskSnapshot> getStream(@NonNull final StorageReference storageRef) { return Single.create(new SingleOnSubscribe<StreamDownloadTask.TaskSnapshot>() { public void subscribe(final SingleEmitter<StreamDownloadTask.TaskSnapshot> emitter) throws Exception { final StorageTask<StreamDownloadTask.TaskSnapshot> taskSnapshotStorageTask = storageRef.getStream().addOnSuccessListener(new OnSuccessListener<StreamDownloadTask.TaskSnapshot>() { @Override public void onSuccess(StreamDownloadTask.TaskSnapshot taskSnapshot) { emitter.onSuccess(taskSnapshot); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { if (!emitter.isDisposed()) emitter.onError(e); } }); emitter.setCancellable(new Cancellable() { @Override public void cancel() throws Exception { taskSnapshotStorageTask.cancel(); } }); } }); } }
RxFirebaseStorage { @NonNull public static Single<StreamDownloadTask.TaskSnapshot> getStream(@NonNull final StorageReference storageRef) { return Single.create(new SingleOnSubscribe<StreamDownloadTask.TaskSnapshot>() { public void subscribe(final SingleEmitter<StreamDownloadTask.TaskSnapshot> emitter) throws Exception { final StorageTask<StreamDownloadTask.TaskSnapshot> taskSnapshotStorageTask = storageRef.getStream().addOnSuccessListener(new OnSuccessListener<StreamDownloadTask.TaskSnapshot>() { @Override public void onSuccess(StreamDownloadTask.TaskSnapshot taskSnapshot) { emitter.onSuccess(taskSnapshot); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { if (!emitter.isDisposed()) emitter.onError(e); } }); emitter.setCancellable(new Cancellable() { @Override public void cancel() throws Exception { taskSnapshotStorageTask.cancel(); } }); } }); }  }
RxFirebaseStorage { @NonNull public static Single<StreamDownloadTask.TaskSnapshot> getStream(@NonNull final StorageReference storageRef) { return Single.create(new SingleOnSubscribe<StreamDownloadTask.TaskSnapshot>() { public void subscribe(final SingleEmitter<StreamDownloadTask.TaskSnapshot> emitter) throws Exception { final StorageTask<StreamDownloadTask.TaskSnapshot> taskSnapshotStorageTask = storageRef.getStream().addOnSuccessListener(new OnSuccessListener<StreamDownloadTask.TaskSnapshot>() { @Override public void onSuccess(StreamDownloadTask.TaskSnapshot taskSnapshot) { emitter.onSuccess(taskSnapshot); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { if (!emitter.isDisposed()) emitter.onError(e); } }); emitter.setCancellable(new Cancellable() { @Override public void cancel() throws Exception { taskSnapshotStorageTask.cancel(); } }); } }); }  @NonNull static Maybe<byte[]> getBytes(@NonNull final StorageReference storageRef,
                                         final long maxDownloadSizeBytes); @NonNull static Maybe<Uri> getDownloadUrl(@NonNull final StorageReference storageRef); @NonNull static Single<FileDownloadTask.TaskSnapshot> getFile(@NonNull final StorageReference storageRef,
                                                                @NonNull final File destinationFile); @NonNull static Single<FileDownloadTask.TaskSnapshot> getFile(@NonNull final StorageReference storageRef,
                                                                @NonNull final Uri destinationUri); @NonNull static Maybe<StorageMetadata> getMetadata(@NonNull final StorageReference storageRef); @NonNull static Single<StreamDownloadTask.TaskSnapshot> getStream(@NonNull final StorageReference storageRef); @NonNull static Single<StreamDownloadTask.TaskSnapshot> getStream(@NonNull final StorageReference storageRef,
                                                                    @NonNull final StreamDownloadTask.StreamProcessor processor); @NonNull static Single<UploadTask.TaskSnapshot> putBytes(@NonNull final StorageReference storageRef,
                                                           @NonNull final byte[] bytes); @NonNull static Single<UploadTask.TaskSnapshot> putBytes(@NonNull final StorageReference storageRef,
                                                           @NonNull final byte[] bytes,
                                                           @NonNull final StorageMetadata metadata); @NonNull static Single<UploadTask.TaskSnapshot> putFile(@NonNull final StorageReference storageRef,
                                                          @NonNull final Uri uri); @NonNull static Single<UploadTask.TaskSnapshot> putFile(@NonNull final StorageReference storageRef,
                                                          @NonNull final Uri uri,
                                                          @NonNull final StorageMetadata metadata); @NonNull static Single<UploadTask.TaskSnapshot> putFile(@NonNull final StorageReference storageRef,
                                                          @NonNull final Uri uri,
                                                          @NonNull final StorageMetadata metadata,
                                                          @NonNull final Uri existingUploadUri); @NonNull static Single<UploadTask.TaskSnapshot> putStream(@NonNull final StorageReference storageRef,
                                                            @NonNull final InputStream stream,
                                                            @NonNull final StorageMetadata metadata); @NonNull static Single<UploadTask.TaskSnapshot> putStream(@NonNull final StorageReference storageRef,
                                                            @NonNull final InputStream stream); @NonNull static Maybe<StorageMetadata> updateMetadata(@NonNull final StorageReference storageRef,
                                                        @NonNull final StorageMetadata metadata); @NonNull static Completable delete(@NonNull final StorageReference storageRef); }
RxFirebaseStorage { @NonNull public static Single<StreamDownloadTask.TaskSnapshot> getStream(@NonNull final StorageReference storageRef) { return Single.create(new SingleOnSubscribe<StreamDownloadTask.TaskSnapshot>() { public void subscribe(final SingleEmitter<StreamDownloadTask.TaskSnapshot> emitter) throws Exception { final StorageTask<StreamDownloadTask.TaskSnapshot> taskSnapshotStorageTask = storageRef.getStream().addOnSuccessListener(new OnSuccessListener<StreamDownloadTask.TaskSnapshot>() { @Override public void onSuccess(StreamDownloadTask.TaskSnapshot taskSnapshot) { emitter.onSuccess(taskSnapshot); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { if (!emitter.isDisposed()) emitter.onError(e); } }); emitter.setCancellable(new Cancellable() { @Override public void cancel() throws Exception { taskSnapshotStorageTask.cancel(); } }); } }); }  @NonNull static Maybe<byte[]> getBytes(@NonNull final StorageReference storageRef,
                                         final long maxDownloadSizeBytes); @NonNull static Maybe<Uri> getDownloadUrl(@NonNull final StorageReference storageRef); @NonNull static Single<FileDownloadTask.TaskSnapshot> getFile(@NonNull final StorageReference storageRef,
                                                                @NonNull final File destinationFile); @NonNull static Single<FileDownloadTask.TaskSnapshot> getFile(@NonNull final StorageReference storageRef,
                                                                @NonNull final Uri destinationUri); @NonNull static Maybe<StorageMetadata> getMetadata(@NonNull final StorageReference storageRef); @NonNull static Single<StreamDownloadTask.TaskSnapshot> getStream(@NonNull final StorageReference storageRef); @NonNull static Single<StreamDownloadTask.TaskSnapshot> getStream(@NonNull final StorageReference storageRef,
                                                                    @NonNull final StreamDownloadTask.StreamProcessor processor); @NonNull static Single<UploadTask.TaskSnapshot> putBytes(@NonNull final StorageReference storageRef,
                                                           @NonNull final byte[] bytes); @NonNull static Single<UploadTask.TaskSnapshot> putBytes(@NonNull final StorageReference storageRef,
                                                           @NonNull final byte[] bytes,
                                                           @NonNull final StorageMetadata metadata); @NonNull static Single<UploadTask.TaskSnapshot> putFile(@NonNull final StorageReference storageRef,
                                                          @NonNull final Uri uri); @NonNull static Single<UploadTask.TaskSnapshot> putFile(@NonNull final StorageReference storageRef,
                                                          @NonNull final Uri uri,
                                                          @NonNull final StorageMetadata metadata); @NonNull static Single<UploadTask.TaskSnapshot> putFile(@NonNull final StorageReference storageRef,
                                                          @NonNull final Uri uri,
                                                          @NonNull final StorageMetadata metadata,
                                                          @NonNull final Uri existingUploadUri); @NonNull static Single<UploadTask.TaskSnapshot> putStream(@NonNull final StorageReference storageRef,
                                                            @NonNull final InputStream stream,
                                                            @NonNull final StorageMetadata metadata); @NonNull static Single<UploadTask.TaskSnapshot> putStream(@NonNull final StorageReference storageRef,
                                                            @NonNull final InputStream stream); @NonNull static Maybe<StorageMetadata> updateMetadata(@NonNull final StorageReference storageRef,
                                                        @NonNull final StorageMetadata metadata); @NonNull static Completable delete(@NonNull final StorageReference storageRef);  }