Class RepeatableInputStreamRequestEntity
java.lang.Object
org.apache.hc.core5.http.io.entity.HttpEntityWrapper
software.amazon.awssdk.http.apache5.internal.RepeatableInputStreamRequestEntity
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hc.core5.http.EntityDetails,org.apache.hc.core5.http.HttpEntity
@SdkInternalApi
public class RepeatableInputStreamRequestEntity
extends org.apache.hc.core5.http.io.entity.HttpEntityWrapper
Custom implementation of HttpEntity that delegates to an InputStreamEntity, with the one notable difference, that if the
underlying InputStream supports being reset, this RequestEntity will report that it is repeatable and will reset the stream on
all subsequent attempts to write out the request.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()booleanbooleanReturns true if the underlying InputStream supports marking/resetting or if the underlying InputStreamRequestEntity is repeatable.voidwriteTo(OutputStream output) Resets the underlying InputStream if this isn't the first attempt to write out the request, otherwise simply delegates to InputStreamRequestEntity to write out the data.Methods inherited from class org.apache.hc.core5.http.io.entity.HttpEntityWrapper
getContent, getContentEncoding, getContentLength, getContentType, getTrailerNames, getTrailers, isStreaming, toString
-
Constructor Details
-
RepeatableInputStreamRequestEntity
-
-
Method Details
-
isChunked
public boolean isChunked()- Specified by:
isChunkedin interfaceorg.apache.hc.core5.http.EntityDetails- Overrides:
isChunkedin classorg.apache.hc.core5.http.io.entity.HttpEntityWrapper
-
isRepeatable
public boolean isRepeatable()Returns true if the underlying InputStream supports marking/resetting or if the underlying InputStreamRequestEntity is repeatable.- Specified by:
isRepeatablein interfaceorg.apache.hc.core5.http.HttpEntity- Overrides:
isRepeatablein classorg.apache.hc.core5.http.io.entity.HttpEntityWrapper
-
writeTo
Resets the underlying InputStream if this isn't the first attempt to write out the request, otherwise simply delegates to InputStreamRequestEntity to write out the data.If an error is encountered the first time we try to write the request entity, we remember the original exception, and report that as the root cause if we continue to encounter errors, rather than masking the original error.
- Specified by:
writeToin interfaceorg.apache.hc.core5.http.HttpEntity- Overrides:
writeToin classorg.apache.hc.core5.http.io.entity.HttpEntityWrapper- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classorg.apache.hc.core5.http.io.entity.HttpEntityWrapper- Throws:
IOException
-