• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2017 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.Compressor;
20 import java.io.InputStream;
21 
22 /** Interface for framing gRPC messages. */
23 public interface Framer {
24   /**
25    * Writes out a payload message.
26    *
27    * @param message contains the message to be written out. It will be completely consumed.
28    */
writePayload(InputStream message)29   void writePayload(InputStream message);
30 
31   /** Flush the buffered payload. */
flush()32   void flush();
33 
34   /** Returns whether the framer is closed. */
isClosed()35   boolean isClosed();
36 
37   /** Closes, with flush. */
close()38   void close();
39 
40   /** Closes, without flush. */
dispose()41   void dispose();
42 
43   /** Enable or disable compression. */
setMessageCompression(boolean enable)44   Framer setMessageCompression(boolean enable);
45 
46   /** Set the compressor used for compression. */
setCompressor(Compressor compressor)47   Framer setCompressor(Compressor compressor);
48 
49   /** Set a size limit for each outbound message. */
setMaxOutboundMessageSize(int maxSize)50   void setMaxOutboundMessageSize(int maxSize);
51 }
52