public class ApacheInputStreamEntity extends FilterInputStream implements org.apache.http.HttpEntity
Class for ApacheInputStream. Apache connector in Jersey v2.32 supports passing an HttpEntity as the body. In this case Apache connector will not read entire data into memory. Content length is a must to use this conversion.
in| Constructor and Description |
|---|
ApacheInputStreamEntity(InputStream in,
Long contentLength) |
| Modifier and Type | Method and Description |
|---|---|
void |
consumeContent()
Deprecated.
(4.1) Use
org.apache.http.util.EntityUtils#consume(HttpEntity) |
InputStream |
getContent() |
org.apache.http.Header |
getContentEncoding() |
long |
getContentLength() |
org.apache.http.Header |
getContentType() |
boolean |
isChunked() |
boolean |
isRepeatable() |
boolean |
isStreaming() |
void |
writeTo(OutputStream outputStream) |
available, close, mark, markSupported, read, read, read, reset, skippublic ApacheInputStreamEntity(InputStream in, Long contentLength)
public boolean isRepeatable()
isRepeatable in interface org.apache.http.HttpEntitypublic boolean isChunked()
isChunked in interface org.apache.http.HttpEntitypublic long getContentLength()
getContentLength in interface org.apache.http.HttpEntitypublic org.apache.http.Header getContentType()
getContentType in interface org.apache.http.HttpEntitypublic org.apache.http.Header getContentEncoding()
getContentEncoding in interface org.apache.http.HttpEntitypublic InputStream getContent() throws IOException, UnsupportedOperationException
getContent in interface org.apache.http.HttpEntityIOExceptionUnsupportedOperationExceptionpublic void writeTo(OutputStream outputStream) throws IOException
writeTo in interface org.apache.http.HttpEntityIOExceptionpublic boolean isStreaming()
isStreaming in interface org.apache.http.HttpEntity@Deprecated public void consumeContent() throws IOException
org.apache.http.util.EntityUtils#consume(HttpEntity)From HttpEntity:
This method is deprecated since version 4.1. Please use standard java convention to ensure
resource deallocation by calling InputStream.close() on the input stream returned by
getContent()
This method is called to indicate that the content of this entity is no longer required. All entity implementations are expected to release all allocated resources as a result of this method invocation. Content streaming entities are also expected to dispose of the remaining content, if any. Wrapping entities should delegate this call to the wrapped entity.
This method is of particular importance for entities being received from a connection. The entity needs to be consumed completely in order to re-use the
connection with keep-alive.
consumeContent in interface org.apache.http.HttpEntityIOException - if an I/O error occurs.and #writeTo(OutputStream)Copyright © 2016–2024. All rights reserved.