Package io.grpc.stub
Class StreamObservers
- java.lang.Object
-
- io.grpc.stub.StreamObservers
-
public final class StreamObservers extends Object
Utility functions for working withStreamObserverand it's common subclasses likeCallStreamObserver.
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <V> voidcopyWithFlowControl(Iterable<V> source, CallStreamObserver<V> target)Deprecated.Of questionable utility and generally not used.static <V> voidcopyWithFlowControl(Iterator<V> source, CallStreamObserver<V> target)Deprecated.Of questionable utility and generally not used.static <T> voidnextAndComplete(StreamObserver<T> responseObserver, T response)Utility method to callStreamObserver.onNext(Object)andStreamObserver.onCompleted()on the specified responseObserver.
-
-
-
Method Detail
-
nextAndComplete
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/10957") public static <T> void nextAndComplete(StreamObserver<T> responseObserver, T response)
Utility method to callStreamObserver.onNext(Object)andStreamObserver.onCompleted()on the specified responseObserver.
-
copyWithFlowControl
@Deprecated @ExperimentalApi("https://github.com/grpc/grpc-java/issues/4694") public static <V> void copyWithFlowControl(Iterator<V> source, CallStreamObserver<V> target)
Deprecated.Of questionable utility and generally not used.Copy the values of anIteratorto the targetCallStreamObserverwhile properly accounting for outbound flow-control. After calling this method,targetshould no longer be used.For clients this method is safe to call inside
ClientResponseObserver.beforeStart(io.grpc.stub.ClientCallStreamObserver<ReqT>), on servers it is safe to call inside the service method implementation.- Parameters:
source- of values expressed as anIterator.target-CallStreamObserverwhich accepts values from the source.
-
copyWithFlowControl
@Deprecated @ExperimentalApi("https://github.com/grpc/grpc-java/issues/4694") public static <V> void copyWithFlowControl(Iterable<V> source, CallStreamObserver<V> target)
Deprecated.Of questionable utility and generally not used.Copy the values of anIterableto the targetCallStreamObserverwhile properly accounting for outbound flow-control. After calling this method,targetshould no longer be used.For clients this method is safe to call inside
ClientResponseObserver.beforeStart(io.grpc.stub.ClientCallStreamObserver<ReqT>), on servers it is safe to call inside the service method implementation.- Parameters:
source- of values expressed as anIterable.target-CallStreamObserverwhich accepts values from the source.
-
-