View Javadoc
1   /*
2    * Copyright 2014 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License, version 2.0 (the
5    * "License"); you may not use this file except in compliance with the License. You may obtain a
6    * 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 distributed under the License
11   * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing permissions and limitations under
13   * the License.
14   */
15  package io.netty.handler.codec.http2;
16  
17  import io.netty.buffer.ByteBuf;
18  import io.netty.channel.ChannelFuture;
19  import io.netty.channel.ChannelHandlerContext;
20  import io.netty.channel.ChannelPromise;
21  
22  /**
23   * Interface that defines an object capable of producing HTTP/2 data frames.
24   */
25  public interface Http2DataWriter {
26      /**
27       * Writes a {@code DATA} frame to the remote endpoint.
28       *
29       * @param ctx the context to use for writing.
30       * @param streamId the stream for which to send the frame.
31       * @param data the payload of the frame. This will be released by this method.
32       * @param padding the amount of padding to be added to the end of the frame
33       * @param endStream indicates if this is the last frame to be sent for the stream.
34       * @param promise the promise for the write.
35       * @return the future for the write.
36       */
37      ChannelFuture writeData(ChannelHandlerContext ctx, int streamId,
38              ByteBuf data, int padding, boolean endStream, ChannelPromise promise);
39  }