Example usage for org.apache.commons.httpclient.methods ByteArrayRequestEntity getContent

List of usage examples for org.apache.commons.httpclient.methods ByteArrayRequestEntity getContent

Introduction

In this page you can find the example usage for org.apache.commons.httpclient.methods ByteArrayRequestEntity getContent.

Prototype

public byte[] getContent() 

Source Link

Usage

From source file:com.baidu.oped.apm.profiler.modifier.connector.httpclient3.interceptor.ExecuteInterceptor.java

private String readByteArray(ByteArrayRequestEntity entity, String charSet)
        throws UnsupportedEncodingException {
    if (entity.getContent() == null) {
        return "";
    }/*from  w  ww . ja  v a2 s .c  o  m*/

    final int length = entity.getContent().length > MAX_READ_SIZE ? MAX_READ_SIZE : entity.getContent().length;

    if (length <= 0) {
        return "";
    }

    return new String(entity.getContent(), 0, length, charSet);

}