• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2015 The gRPC Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package io.grpc.internal;
18 
19 import io.grpc.Attributes;
20 import io.grpc.Compressor;
21 import io.grpc.Deadline;
22 import io.grpc.DecompressorRegistry;
23 import io.grpc.Status;
24 import java.io.InputStream;
25 import javax.annotation.Nonnull;
26 
27 /**
28  * An implementation of {@link ClientStream} that silently does nothing for the operations.
29  */
30 public class NoopClientStream implements ClientStream {
31   public static final NoopClientStream INSTANCE = new NoopClientStream();
32 
33   @Override
setAuthority(String authority)34   public void setAuthority(String authority) {}
35 
36   @Override
start(ClientStreamListener listener)37   public void start(ClientStreamListener listener) {}
38 
39   @Override
getAttributes()40   public Attributes getAttributes() {
41     return Attributes.EMPTY;
42   }
43 
44   @Override
request(int numMessages)45   public void request(int numMessages) {}
46 
47   @Override
writeMessage(InputStream message)48   public void writeMessage(InputStream message) {}
49 
50   @Override
flush()51   public void flush() {}
52 
53   @Override
isReady()54   public boolean isReady() {
55     return false;
56   }
57 
58   @Override
cancel(Status status)59   public void cancel(Status status) {}
60 
61   @Override
halfClose()62   public void halfClose() {}
63 
64   @Override
setMessageCompression(boolean enable)65   public void setMessageCompression(boolean enable) {
66     // noop
67   }
68 
69   @Override
setCompressor(Compressor compressor)70   public void setCompressor(Compressor compressor) {}
71 
72   @Override
setFullStreamDecompression(boolean fullStreamDecompression)73   public void setFullStreamDecompression(boolean fullStreamDecompression) {}
74 
75   @Override
setDecompressorRegistry(DecompressorRegistry decompressorRegistry)76   public void setDecompressorRegistry(DecompressorRegistry decompressorRegistry) {}
77 
78   @Override
setMaxInboundMessageSize(int maxSize)79   public void setMaxInboundMessageSize(int maxSize) {}
80 
81   @Override
setMaxOutboundMessageSize(int maxSize)82   public void setMaxOutboundMessageSize(int maxSize) {}
83 
84   @Override
setDeadline(@onnull Deadline deadline)85   public void setDeadline(@Nonnull Deadline deadline) {}
86 }
87