In this post under RxJava, I will explain with example the purpose of autoConnect method in ConnectableObservable class. We can use the autoConnect method to inform in advance how many observers will subscribe to the ConnectableObservable. Once the mentioned number of observers subscribe to the ConnectableObservable, the observable will behave like an cold observable and…… Continue reading ConnectableObservable autoConnect method
ConnectableObservale Example
In this post under RxJava I will explain with example what is a ConnectableObservale. They are two kinds of Observables. One is called Hot and another Cold. Whatever Observables you have seen in my previous posts are all Cold. You will see the differencebetween them when more than one Observer subscribes to the Observable. Whenever…… Continue reading ConnectableObservale Example
Creating Observable from Runnable, Callable, and Action
In this post under RxJava, I will explain with example how to create Observable from Runnable, Callable, and Action interfaces. When creating Observable from Runnable interface, the Observable will execute the code inside Runnable and either throw an error or just completes. When creating Observable from Callable interface, the Observable will execute the code inside…… Continue reading Creating Observable from Runnable, Callable, and Action
Creating a Custom Cold Stateful Observable
In this post under RxJava, I will show with example how to create your own custom cold stateful Observable using “generate” method. The custom cold stateful Observable will hold state information that’s why I said stateful in the previous statement. They are two versions of this method. Below are there syntax 1 -> public static…… Continue reading Creating a Custom Cold Stateful Observable
Parsing an HTML fragment as a body of new html document
In this post under Jsoup, I will explain with example how to parse a html fragment as a body of a new html document. Suppose you have a html fragment as shown below <a href=’wwww.google.com’/> Which you want as body of a new html document as shown below for your reference <html> <head></head> <body> <a…… Continue reading Parsing an HTML fragment as a body of new html document
Parsing an HTML document
In this post under Jsoup, I will explain with example how to parse an HTML data. The HTML data can be present in a local file, in a String, or at a URL. Jsoup provides overloaded methods to parse html data at these locations For our example we will have local file named “Input1.html” in…… Continue reading Parsing an HTML document
Searching Mails
In this post under Java Mail, I will explain with example how to search mails in an inbox. To start a search we need to establish criterias and only those mails matching the criterias will be displayed. To establish criteria we will take the help of javax.mail.search.SearchTerm abstract class. Even though SearchTerm is an abstract…… Continue reading Searching Mails
Receiving Email using POP3 protocol
In this post under Java Mail, I will explain with example how to receive email using POP3 protocal. The steps involved are 1) Setup the properties object2) Create a Session object3) Get a Store instance using Session’s getStore method4) Connect to the store using email address and application password5) Get the inbox folder from the…… Continue reading Receiving Email using POP3 protocol
Creating a Custom Cold Stateless Observable
In this post under RxJava, I will show with example how to create your own custom cold stateless Observable using “generate” method. The custom cold stateless Observable will not hold any state information that’s why I said stateless in the previous statement. Below is the syntax of generate method Syntax public static <T> @NonNull Observable<T>…… Continue reading Creating a Custom Cold Stateless Observable
Observable defer method
In this post under RxJava, I will show with example how to create an Observable instance with the help of Observable class’s static method “defer”. In all my previous post, we used to create an Observable instance immediately for example Observable<Long> observable = Observable.interval(500, TimeUnit.MILLISECONDS); When the above code snippet is executed, it creates an…… Continue reading Observable defer method