9159金沙游艺场-奥门金沙游艺场-[欢迎您]

9159金沙游艺场为您呈现最新的面貌!,目前注册送体验金,欢迎您将成为影视娱乐行业新的风向标,是亚洲的优质娱乐先锋。

RxJava四个基础接口

日期:2019-10-07编辑作者:办公软件

RxJava四个基础接口,rxjava四个接口

Publisher

Subscriber

Subscription

Processor


public interface Publisher<T> {

    /**
     * Request {@link Publisher} to start streaming data.
     * <p>
     * This is a "factory method" and can be called multiple times, each time starting a new {@link Subscription}.
     * <p>
     * Each {@link Subscription} will work for only a single {@link Subscriber}.
     * <p>
     * A {@link Subscriber} should only subscribe once to a single {@link Publisher}.
     * <p>
     * If the {@link Publisher} rejects the subscription attempt or otherwise fails it will
     * signal the error via {@link Subscriber#onError}.
     *
     * @param s the {@link Subscriber} that will consume signals from this {@link Publisher}
     */
    public void subscribe(Subscriber<? super T> s);
}

public interface Subscriber<T> {
    /**
     * Invoked after calling {@link Publisher#subscribe(Subscriber)}.
     * <p>
     * No data will start flowing until {@link Subscription#request(long)} is invoked.
     * <p>
     * It is the responsibility of this {@link Subscriber} instance to call {@link Subscription#request(long)} whenever more data is wanted.
     * <p>
     * The {@link Publisher} will send notifications only in response to {@link Subscription#request(long)}.
     * 
     * @param s
     *            {@link Subscription} that allows requesting data via {@link Subscription#request(long)}
     */
    public void onSubscribe(Subscription s);

    /**
     * Data notification sent by the {@link Publisher} in response to requests to {@link Subscription#request(long)}.
     * 
     * @param t the element signaled
     */
    public void onNext(T t);

    /**
     * Failed terminal state.
     * <p>
     * No further events will be sent even if {@link Subscription#request(long)} is invoked again.
     *
     * @param t the throwable signaled
     */
    public void onError(Throwable t);

    /**
     * Successful terminal state.
     * <p>
     * No further events will be sent even if {@link Subscription#request(long)} is invoked again.
     */
    public void onComplete();
}

public interface Subscription {
    /**
     * No events will be sent by a {@link Publisher} until demand is signaled via this method.
     * <p>
     * It can be called however often and whenever needed—but the outstanding cumulative demand must never exceed Long.MAX_VALUE.
     * An outstanding cumulative demand of Long.MAX_VALUE may be treated by the {@link Publisher} as "effectively unbounded".
     * <p>
     * Whatever has been requested can be sent by the {@link Publisher} so only signal demand for what can be safely handled.
     * <p>
     * A {@link Publisher} can send less than is requested if the stream ends but
     * then must emit either {@link Subscriber#onError(Throwable)} or {@link Subscriber#onComplete()}.
     * 
     * @param n the strictly positive number of elements to requests to the upstream {@link Publisher}
     */
    public void request(long n);

    /**
     * Request the {@link Publisher} to stop sending data and clean up resources.
     * <p>
     * Data may still be sent to meet previously signalled demand after calling cancel as this request is asynchronous.
     */
    public void cancel();
}

public interface Processor<T, R> extends Subscriber<T>, Publisher<R> {
}

 

Publisher Subscriber Subscription Processor ----------------------------------- public interface PublisherT { /** * Request { @link Pu...

本文由9159金沙游艺场-奥门金沙游艺场-[欢迎您]发布于办公软件,转载请注明出处:RxJava四个基础接口

关键词:

关注Hiweed Linux Desktop 9159金沙游艺场2.0(图)

Hiweed Linux是基于Debian和Ubuntu的中文发行版,一位匿名读者告诉我们在沉寂了一年多后,Hiweed再次重装上阵。他写道 ...

详细>>

01发布下载

Linux 发行版Puppy Linux 是一个小巧可爱的系统,Puppy Linux 的ISO映像文件容量约只有为100 MB 左右。但是“麻雀虽小,五脏...

详细>>

X60下成功安装好Sabayon9159金沙游艺场

国庆期间成功在thinkpad X60上安装了Sabayon Linux. 安装过程非常顺利,默认开启的compiz 3D效果非常好看。 修改了CHOST到i...

详细>>

opensuse 9159金沙游艺场10.3初体验

终于下载并安装好了openSUSE10.3,很高兴见到opensuse10.3的真面目了,在这个版本里还是有不少新鲜元素的,由10.2主色调...

详细>>