RequestT - The type of each request.@BetaApi(value="The surface for streaming is not stable yet and may change in the future.")
public interface ClientStream<RequestT>
After sending requests, users must either call closeSend() or closeSendWithError(Throwable) on the stream. The error, if any, will be propagated to the
server.
Example usage:
ClientStream<String> stream = ...;
List<String> lines = getLinesFromFile();
for (String line : lines) {
stream.send(line);
}
stream.closeSend();
| Modifier and Type | Method and Description |
|---|---|
void |
closeSend()
Closes the stream.
|
void |
closeSendWithError(Throwable t)
Closes the stream with an error.
|
boolean |
isSendReady()
Reports whether a new request can be sent without excessive buffering.
|
void |
send(RequestT request)
Sends a request to the server.
|
void send(RequestT request)
void closeSendWithError(Throwable t)
ClientStream.void closeSend()
ClientStream.
Note that if close() itself throws, a further call to closeSendWithError is
not allowed.
boolean isSendReady()
This is only an optimization hint to the user. It is correct, if suboptimal, to call send if isSendReady returns false.