io.vertx.reactivex.core.streams.ReadStream Maven / Gradle / Ivy
/*
* Copyright 2014 Red Hat, Inc.
*
* Red Hat licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.vertx.reactivex.core.streams;
import java.util.Map;
import io.reactivex.Observable;
import io.reactivex.Flowable;
import io.reactivex.Single;
import io.reactivex.Completable;
import io.reactivex.Maybe;
import io.vertx.core.Handler;
/**
* Represents a stream of items that can be read from.
*
* Any class that implements this interface can be used by a {@link io.vertx.reactivex.core.streams.Pump} to pump data from it
* to a {@link io.vertx.reactivex.core.streams.WriteStream}.
*
*
* NOTE: This class has been automatically generated from the {@link io.vertx.core.streams.ReadStream original} non RX-ified interface using Vert.x codegen.
*/
@io.vertx.lang.reactivex.RxGen(io.vertx.core.streams.ReadStream.class)
public interface ReadStream extends StreamBase {
io.vertx.core.streams.ReadStream getDelegate();
/**
* Set an exception handler on the read stream.
* @param handler the exception handler
* @return a reference to this, so the API can be used fluently
*/
public ReadStream exceptionHandler(Handler handler);
/**
* Set a data handler. As data is read, the handler will be called with the data.
* @param handler
* @return a reference to this, so the API can be used fluently
*/
public ReadStream handler(Handler handler);
/**
* Pause the ReadSupport
. While it's paused, no data will be sent to the dataHandler
* @return a reference to this, so the API can be used fluently
*/
public ReadStream pause();
/**
* Resume reading. If the ReadSupport
has been paused, reading will recommence on it.
* @return a reference to this, so the API can be used fluently
*/
public ReadStream resume();
/**
* Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called.
* @param endHandler
* @return a reference to this, so the API can be used fluently
*/
public ReadStream endHandler(Handler endHandler);
io.reactivex.Observable toObservable();
io.reactivex.Flowable toFlowable();
public static ReadStream newInstance(io.vertx.core.streams.ReadStream arg) {
return arg != null ? new ReadStreamImpl(arg) : null;
}
public static ReadStream newInstance(io.vertx.core.streams.ReadStream arg, io.vertx.lang.reactivex.TypeArg __typeArg_T) {
return arg != null ? new ReadStreamImpl(arg, __typeArg_T) : null;
}
}
class ReadStreamImpl implements ReadStream {
private final io.vertx.core.streams.ReadStream delegate;
public final io.vertx.lang.reactivex.TypeArg __typeArg_0;
public ReadStreamImpl(io.vertx.core.streams.ReadStream delegate) {
this.delegate = delegate;
this.__typeArg_0 = io.vertx.lang.reactivex.TypeArg.unknown();
}
public ReadStreamImpl(io.vertx.core.streams.ReadStream delegate, io.vertx.lang.reactivex.TypeArg typeArg_0) {
this.delegate = delegate;
this.__typeArg_0 = typeArg_0;
}
public io.vertx.core.streams.ReadStream getDelegate() {
return delegate;
}
private io.reactivex.Observable observable;
private io.reactivex.Flowable flowable;
public synchronized io.reactivex.Observable toObservable() {
if (observable == null) {
java.util.function.Function