public class NoopClientStream extends Object implements ClientStream
ClientStream that silently does nothing for the operations.| Modifier and Type | Field and Description |
|---|---|
static NoopClientStream |
INSTANCE |
| Constructor and Description |
|---|
NoopClientStream() |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel(io.grpc.Status status)
Abnormally terminates the stream.
|
void |
flush()
Flushes any internally buffered messages to the remote end-point.
|
io.grpc.Attributes |
getAttributes()
Attributes that the stream holds at the current moment.
|
void |
halfClose()
Closes the local side of this stream and flushes any remaining messages.
|
boolean |
isReady()
If
true, indicates that the transport is capable of sending additional messages without
requiring excessive buffering internally. |
void |
request(int numMessages)
Requests up to the given number of messages from the call to be delivered via
StreamListener.messagesAvailable(StreamListener.MessageProducer). |
void |
setAuthority(String authority)
Override the default authority with
authority. |
void |
setCompressor(io.grpc.Compressor compressor)
Sets the compressor on the framer.
|
void |
setDeadline(io.grpc.Deadline deadline)
Sets the effective deadline of the RPC.
|
void |
setDecompressorRegistry(io.grpc.DecompressorRegistry decompressorRegistry)
Sets the registry to find a decompressor for the framer.
|
void |
setFullStreamDecompression(boolean fullStreamDecompression)
Enables full-stream decompression, allowing the client stream to use
GzipInflatingBuffer to decode inbound GZIP compressed streams. |
void |
setMaxInboundMessageSize(int maxSize)
Sets the max size accepted from the remote endpoint.
|
void |
setMaxOutboundMessageSize(int maxSize)
Sets the max size sent to the remote endpoint.
|
void |
setMessageCompression(boolean enable)
Enables per-message compression, if an encoding type has been negotiated.
|
void |
start(ClientStreamListener listener)
Starts stream.
|
void |
writeMessage(InputStream message)
Writes a message payload to the remote end-point.
|
public static final NoopClientStream INSTANCE
public void setAuthority(String authority)
ClientStreamauthority. May only be called before ClientStream.start(io.grpc.internal.ClientStreamListener).setAuthority in interface ClientStreampublic void start(ClientStreamListener listener)
ClientStreamClientStream.start(io.grpc.internal.ClientStreamListener) is called.
This method should not throw any exceptions.
start in interface ClientStreamlistener - non-null listener of stream eventspublic io.grpc.Attributes getAttributes()
ClientStreamgetAttributes in interface ClientStreampublic void request(int numMessages)
StreamStreamListener.messagesAvailable(StreamListener.MessageProducer). No additional
messages will be delivered. If the stream has a start() method, it must be called
before requesting messages.public void writeMessage(InputStream message)
StreamKnownLength to improve efficiency. This method will always return immediately
and will not wait for the write to complete. If the stream has a start() method, it
must be called before writing any messages.
It is recommended that the caller consult Stream.isReady() before calling this method to
avoid excessive buffering in the transport.
This method takes ownership of the InputStream, and implementations are responsible for
calling InputStream.close().
writeMessage in interface Streammessage - stream containing the serialized message to be sentpublic void flush()
Streampublic boolean isReady()
Streamtrue, indicates that the transport is capable of sending additional messages without
requiring excessive buffering internally. Otherwise, StreamListener.onReady() will be
called when it turns true.
This is just a suggestion and the application is free to ignore it, however doing so may result in excessive buffering within the transport.
public void cancel(io.grpc.Status status)
ClientStreamClientStreamListener.closed(io.grpc.Status, io.grpc.Metadata) is called. This method may only be called
after ClientStream.start(io.grpc.internal.ClientStreamListener), but else is safe to be called at any time and multiple times and
from any thread.cancel in interface ClientStreamstatus - must be non-OKpublic void halfClose()
ClientStreamClientStream.start(io.grpc.internal.ClientStreamListener).halfClose in interface ClientStreampublic void setMessageCompression(boolean enable)
StreamsetMessageCompression in interface Streampublic void setCompressor(io.grpc.Compressor compressor)
StreamsetCompressor in interface Streamcompressor - the compressor to usepublic void setFullStreamDecompression(boolean fullStreamDecompression)
ClientStreamGzipInflatingBuffer to decode inbound GZIP compressed streams.setFullStreamDecompression in interface ClientStreampublic void setDecompressorRegistry(io.grpc.DecompressorRegistry decompressorRegistry)
ClientStreamClientStream.start(io.grpc.internal.ClientStreamListener). If the transport does not support compression, this may do nothing.setDecompressorRegistry in interface ClientStreamdecompressorRegistry - the registry of decompressors for decoding responsespublic void setMaxInboundMessageSize(int maxSize)
ClientStreamsetMaxInboundMessageSize in interface ClientStreampublic void setMaxOutboundMessageSize(int maxSize)
ClientStreamsetMaxOutboundMessageSize in interface ClientStreampublic void setDeadline(@Nonnull io.grpc.Deadline deadline)
ClientStreamsetDeadline in interface ClientStream