• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 package software.amazon.awssdk.crt.http;
7 
8 import software.amazon.awssdk.crt.CrtRuntimeException;
9 
10 import java.util.concurrent.CompletableFuture;
11 
12 /**
13  * An HttpStream represents a single HTTP/2 specific Http Request/Response.
14  */
15 public class Http2Stream extends HttpStreamBase {
16 
Http2Stream(long ptr)17     protected Http2Stream(long ptr) {
18         super(ptr);
19     }
20 
21     /**
22      * Reset the HTTP/2 stream. Note that if the stream closes before this async
23      * call is fully processed, the RST_STREAM frame will not be sent.
24      *
25      * @param errorCode aws_http2_error_code. Reason to reset the stream.
26      */
resetStream(final Http2ClientConnection.Http2ErrorCode errorCode)27     public void resetStream(final Http2ClientConnection.Http2ErrorCode errorCode) {
28         if (isNull()) {
29             throw new IllegalStateException("Http2Stream has been closed.");
30         }
31         http2StreamResetStream(getNativeHandle(), errorCode.getValue());
32     }
33 
34     /**
35      * TODO: getters for reset stream. Not sure anyone needs it though.
36      */
http2StreamResetStream(long http_stream, int errorCode)37     private static native void http2StreamResetStream(long http_stream, int errorCode);
38 }
39