Package software.amazon.awssdk.crt.http
Class HttpStreamBase
- java.lang.Object
-
- software.amazon.awssdk.crt.CrtResource
-
- software.amazon.awssdk.crt.http.HttpStreamBase
-
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
Http2Stream
,HttpStream
public class HttpStreamBase extends CrtResource
An base class represents a single Http Request/Response for both HTTP/1.1 and HTTP/2 and wraps the native resources from the aws-c-http library. Can be used to update the Window size, or to abort the stream early in the middle of sending/receiving Http Bodies.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class software.amazon.awssdk.crt.CrtResource
CrtResource.ResourceInstance
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
HttpStreamBase(long ptr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate()
Activates the client stream.protected boolean
canReleaseReferencesImmediately()
Determines whether a resource releases its dependencies at the same time the native handle is released or if it waits.int
getResponseStatusCode()
Retrieves the Http Response Status Codevoid
incrementWindow(int windowSize)
Increment the flow-control window, so that response data continues downloading.protected void
releaseNativeHandle()
Cleans up the stream's associated native handle-
Methods inherited from class software.amazon.awssdk.crt.CrtResource
acquireNativeHandle, addRef, addReferenceTo, close, collectNativeResource, collectNativeResources, decRef, getNativeHandle, getResourceLogDescription, isNull, logNativeResources, releaseReferences, removeReferenceTo, setDescription, swapReferenceTo, waitForNoResources
-
-
-
-
Method Detail
-
canReleaseReferencesImmediately
protected boolean canReleaseReferencesImmediately()
Determines whether a resource releases its dependencies at the same time the native handle is released or if it waits. Resources that wait are responsible for calling releaseReferences() manually.- Specified by:
canReleaseReferencesImmediately
in classCrtResource
- Returns:
- true if this resource releases synchronously, false if this resource performs async shutdown
-
releaseNativeHandle
protected void releaseNativeHandle()
Cleans up the stream's associated native handle- Specified by:
releaseNativeHandle
in classCrtResource
-
incrementWindow
public void incrementWindow(int windowSize)
Increment the flow-control window, so that response data continues downloading.If
HttpClientConnectionManagerOptions.withManualWindowManagement(boolean)
was set true, each HTTP stream has a flow-control window that shrinks as response body data is downloaded (headers do not affect the size of the window).HttpClientConnectionManagerOptions.withWindowSize(long)
sets the starting size for each HTTP stream's window. Whenever the window reaches zero, data stops downloading. Increment the window to keep data flowing. Maintain a larger window to keep up a high download throughput, parts cannot download in parallel unless the window is large enough to hold multiple parts. Maintain a smaller window to limit the amount of data buffered in memory.If manual window management is disabled this call has no effect.
- Parameters:
windowSize
- How many bytes to increment the sliding window by.- See Also:
HttpClientConnectionManagerOptions.withManualWindowManagement(boolean)
-
activate
public void activate()
Activates the client stream.
-
getResponseStatusCode
public int getResponseStatusCode()
Retrieves the Http Response Status Code- Returns:
- The Http Response Status Code
-
-