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 Constructor Description RepeatableInputStreamRequestEntity(HttpExecuteRequest request)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanisChunked()booleanisRepeatable()Returns 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.
-
-
-
Constructor Detail
-
RepeatableInputStreamRequestEntity
public RepeatableInputStreamRequestEntity(HttpExecuteRequest request)
-
-
Method Detail
-
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
public void writeTo(OutputStream output) throws IOException
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
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classorg.apache.hc.core5.http.io.entity.HttpEntityWrapper- Throws:
IOException
-
-