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
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 TypeMethodDescriptionvoid
close()
boolean
boolean
Returns true if the underlying InputStream supports marking/resetting or if the underlying InputStreamRequestEntity is repeatable.void
writeTo
(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:
isChunked
in interfaceorg.apache.hc.core5.http.EntityDetails
- Overrides:
isChunked
in 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:
isRepeatable
in interfaceorg.apache.hc.core5.http.HttpEntity
- Overrides:
isRepeatable
in 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:
writeTo
in interfaceorg.apache.hc.core5.http.HttpEntity
- Overrides:
writeTo
in classorg.apache.hc.core5.http.io.entity.HttpEntityWrapper
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classorg.apache.hc.core5.http.io.entity.HttpEntityWrapper
- Throws:
IOException
-