|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.http.util.EntityUtilsHC4
public final class EntityUtilsHC4
Static helpers for dealing with HttpEntitys.
| Method Summary | |
|---|---|
static void |
consume(org.apache.http.HttpEntity entity)
Ensures that the entity content is fully consumed and the content stream, if exists, is closed. |
static void |
consumeQuietly(org.apache.http.HttpEntity entity)
Ensures that the entity content is fully consumed and the content stream, if exists, is closed. |
static java.lang.String |
getContentCharSet(org.apache.http.HttpEntity entity)
Deprecated. (4.1.3) use ContentType.getOrDefault(HttpEntity) |
static java.lang.String |
getContentMimeType(org.apache.http.HttpEntity entity)
Deprecated. (4.1.3) use ContentType.getOrDefault(HttpEntity) |
static byte[] |
toByteArray(org.apache.http.HttpEntity entity)
Read the contents of an entity and return it as a byte array. |
static java.lang.String |
toString(org.apache.http.HttpEntity entity)
Read the contents of an entity and return it as a String. |
static java.lang.String |
toString(org.apache.http.HttpEntity entity,
java.nio.charset.Charset defaultCharset)
Get the entity content as a String, using the provided default character set if none is found in the entity. |
static java.lang.String |
toString(org.apache.http.HttpEntity entity,
java.lang.String defaultCharset)
Get the entity content as a String, using the provided default character set if none is found in the entity. |
static void |
updateEntity(org.apache.http.HttpResponse response,
org.apache.http.HttpEntity entity)
Updates an entity in a response by first consuming an existing entity, then setting the new one. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void consumeQuietly(org.apache.http.HttpEntity entity)
entity - the entity to consume.
public static void consume(org.apache.http.HttpEntity entity)
throws java.io.IOException
entity - the entity to consume.
java.io.IOException - if an error occurs reading the input stream
public static void updateEntity(org.apache.http.HttpResponse response,
org.apache.http.HttpEntity entity)
throws java.io.IOException
response - the response with an entity to update; must not be null.entity - the entity to set in the response.
java.io.IOException - if an error occurs while reading the input stream on the existing
entity.
java.lang.IllegalArgumentException - if response is null.
public static byte[] toByteArray(org.apache.http.HttpEntity entity)
throws java.io.IOException
entity - the entity to read from=
HttpEntity.getContent() is null.
java.io.IOException - if an error occurs reading the input stream
java.lang.IllegalArgumentException - if entity is null or if content length > Integer.MAX_VALUE
@Deprecated
public static java.lang.String getContentCharSet(org.apache.http.HttpEntity entity)
throws org.apache.http.ParseException
ContentType.getOrDefault(HttpEntity)
entity - must not be null
org.apache.http.ParseException - if header elements cannot be parsed
java.lang.IllegalArgumentException - if entity is null
@Deprecated
public static java.lang.String getContentMimeType(org.apache.http.HttpEntity entity)
throws org.apache.http.ParseException
ContentType.getOrDefault(HttpEntity)
entity - must not be null
org.apache.http.ParseException - if header elements cannot be parsed
java.lang.IllegalArgumentException - if entity is null
public static java.lang.String toString(org.apache.http.HttpEntity entity,
java.nio.charset.Charset defaultCharset)
throws java.io.IOException,
org.apache.http.ParseException
entity - must not be nulldefaultCharset - character set to be applied if none found in the entity
HttpEntity.getContent() is null.
org.apache.http.ParseException - if header elements cannot be parsed
java.lang.IllegalArgumentException - if entity is null or if content length > Integer.MAX_VALUE
java.io.IOException - if an error occurs reading the input stream
java.nio.charset.UnsupportedCharsetException - Thrown when the named charset is not available in
this instance of the Java virtual machine
public static java.lang.String toString(org.apache.http.HttpEntity entity,
java.lang.String defaultCharset)
throws java.io.IOException,
org.apache.http.ParseException
entity - must not be nulldefaultCharset - character set to be applied if none found in the entity
HttpEntity.getContent() is null.
org.apache.http.ParseException - if header elements cannot be parsed
java.lang.IllegalArgumentException - if entity is null or if content length > Integer.MAX_VALUE
java.io.IOException - if an error occurs reading the input stream
java.nio.charset.UnsupportedCharsetException - Thrown when the named charset is not available in
this instance of the Java virtual machine
public static java.lang.String toString(org.apache.http.HttpEntity entity)
throws java.io.IOException,
org.apache.http.ParseException
entity - the entity to convert to a string; must not be null
org.apache.http.ParseException - if header elements cannot be parsed
java.lang.IllegalArgumentException - if entity is null or if content length > Integer.MAX_VALUE
java.io.IOException - if an error occurs reading the input stream
java.nio.charset.UnsupportedCharsetException - Thrown when the named charset is not available in
this instance of the Java virtual machine
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||