Example usage for org.apache.http.entity BufferedHttpEntity writeTo

List of usage examples for org.apache.http.entity BufferedHttpEntity writeTo

Introduction

In this page you can find the example usage for org.apache.http.entity BufferedHttpEntity writeTo.

Prototype

public void writeTo(OutputStream outputStream) throws IOException 

Source Link

Usage

From source file:xin.nic.sdk.registrar.util.HttpUtil.java

/**
 * ?Entity?/*from   www  .  ja v  a2s .c  o  m*/
 * 
 * @param httpEntity
 * @return
 * @throws Exception
 */
public static byte[] getData(HttpEntity httpEntity) throws Exception {
    BufferedHttpEntity bufferedHttpEntity = new BufferedHttpEntity(httpEntity);
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    bufferedHttpEntity.writeTo(byteArrayOutputStream);
    byte[] responseBytes = byteArrayOutputStream.toByteArray();
    return responseBytes;
}