public final class EntityUtils
extends java.lang.Object
HttpEntity
s.Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getContentCharSet(HttpEntity entity)
Obtains character set of the entity, if known.
|
static byte[] |
toByteArray(HttpEntity entity)
Read the contents of an entity and return it as a byte array.
|
static java.lang.String |
toString(HttpEntity entity)
Read the contents of an entity and return it as a String.
|
static java.lang.String |
toString(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.
|
public static byte[] toByteArray(HttpEntity entity) throws java.io.IOException
entity
- java.io.IOException
- if an error occurs reading the input streamjava.lang.IllegalArgumentException
- if entity is null or if content length > Integer.MAX_VALUEpublic static java.lang.String getContentCharSet(HttpEntity entity) throws ParseException
entity
- must not be nullParseException
- if header elements cannot be parsedjava.lang.IllegalArgumentException
- if entity is nullpublic static java.lang.String toString(HttpEntity entity, java.lang.String defaultCharset) throws java.io.IOException, ParseException
entity
- must not be nulldefaultCharset
- character set to be applied if none found in the entityParseException
- if header elements cannot be parsedjava.lang.IllegalArgumentException
- if entity is null or if content length > Integer.MAX_VALUEjava.io.IOException
- if an error occurs reading the input streampublic static java.lang.String toString(HttpEntity entity) throws java.io.IOException, ParseException
entity
- ParseException
- if header elements cannot be parsedjava.lang.IllegalArgumentException
- if entity is null or if content length > Integer.MAX_VALUEjava.io.IOException
- if an error occurs reading the input stream