Class JSONArrayWrappedRepeatableEntity
- java.lang.Object
-
- org.apache.http.entity.AbstractHttpEntity
-
- org.apache.http.entity.InputStreamEntity
-
- com.boomi.common.apache.http.entity.CloseableInputStreamEntity
-
- com.boomi.common.apache.http.entity.RepeatableInputStreamEntity
-
- com.boomi.connector.openapi.entity.JSONArrayWrappedRepeatableEntity
-
- All Implemented Interfaces:
CloseableHttpEntity
,Closeable
,AutoCloseable
,HttpEntity
public class JSONArrayWrappedRepeatableEntity extends RepeatableInputStreamEntity
-
-
Field Summary
-
Fields inherited from class org.apache.http.entity.AbstractHttpEntity
chunked, contentEncoding, contentType, OUTPUT_BUFFER_SIZE
-
-
Constructor Summary
Constructors Constructor Description JSONArrayWrappedRepeatableEntity(InputStream input, ContentType contentType)
Creates a new RepeatableEntity instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStream
getContent()
Returns the original InputStream, this input stream will be reset prior to being returned.void
writeTo(OutputStream outputStream)
Write the contents of the InputStream to the outputStream.-
Methods inherited from class com.boomi.common.apache.http.entity.RepeatableInputStreamEntity
isRepeatable
-
Methods inherited from class com.boomi.common.apache.http.entity.CloseableInputStreamEntity
close
-
Methods inherited from class org.apache.http.entity.InputStreamEntity
getContentLength, isStreaming
-
Methods inherited from class org.apache.http.entity.AbstractHttpEntity
consumeContent, getContentEncoding, getContentType, isChunked, setChunked, setContentEncoding, setContentEncoding, setContentType, setContentType, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.http.HttpEntity
consumeContent, getContentEncoding, getContentLength, getContentType, isChunked, isStreaming
-
-
-
-
Constructor Detail
-
JSONArrayWrappedRepeatableEntity
public JSONArrayWrappedRepeatableEntity(InputStream input, ContentType contentType)
Creates a new RepeatableEntity instance. This will attempt to wrap the incoming input stream with JSON brackets e.g [ ] before sending the data to the output stream. This constructor assumes that the provided stream has been already been "marked", i.e., callingInputStream.reset()
will position the stream at the position it was in when passed to this constructor.- Parameters:
input
- the input stream (required to support mark/rest)contentType
- the content type of the input stream
-
-
Method Detail
-
getContent
public InputStream getContent() throws IOException
Returns the original InputStream, this input stream will be reset prior to being returned.- Specified by:
getContent
in interfaceHttpEntity
- Overrides:
getContent
in classRepeatableInputStreamEntity
- Returns:
- returns the original stream before the stream was wrapped with array brackets.
- Throws:
IOException
-
writeTo
public void writeTo(OutputStream outputStream) throws IOException
Write the contents of the InputStream to the outputStream. If the InputStream is pre-wrapped with array brackets then no additional array brackets will be included, otherwise. This will write the start and end brackets.- Specified by:
writeTo
in interfaceHttpEntity
- Overrides:
writeTo
in classRepeatableInputStreamEntity
- Parameters:
outputStream
- the output stream to write entity content to- Throws:
IOException
-
-