View Javadoc

1   /*
2    * Copyright 2016 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. 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, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package io.netty.channel.socket;
17  
18  import io.netty.channel.Channel;
19  import io.netty.channel.ChannelFuture;
20  import io.netty.channel.ChannelPromise;
21  
22  import java.net.Socket;
23  
24  /**
25   * A duplex {@link Channel} that has two sides that can be shutdown independently.
26   */
27  public interface DuplexChannel extends Channel {
28      /**
29       * Returns {@code true} if and only if the remote peer shut down its output so that no more
30       * data is received from this channel.  Note that the semantic of this method is different from
31       * that of {@link Socket#shutdownInput()} and {@link Socket#isInputShutdown()}.
32       */
33      boolean isInputShutdown();
34  
35      /**
36       * @see Socket#isOutputShutdown()
37       */
38      boolean isOutputShutdown();
39  
40      /**
41       * @see Socket#shutdownOutput()
42       */
43      ChannelFuture shutdownOutput();
44  
45      /**
46       * @see Socket#shutdownOutput()
47       *
48       * Will notify the given {@link ChannelPromise}
49       */
50      ChannelFuture shutdownOutput(ChannelPromise promise);
51  }