Code example for HttpEntity

Methods: consumeContent, getContent, getContentLength

0
 
    return client;
  } 
 
  protected static byte[] parseResponse(HttpEntity entity) throws IOException {
    if (entity == null || entity.getContentLength() == 0)
      return null; 
 
    if (entity.getContentLength() < 0)
      throw new IOException("Unknown content length!");
 
    byte[] responseBytes            = new byte[(int)entity.getContentLength()];
    DataInputStream dataInputStream = new DataInputStream(entity.getContent());
    dataInputStream.readFully(responseBytes);
    dataInputStream.close();
 
    entity.consumeContent();
    return responseBytes;
  } 
 
  protected static class MmsConnectionParameters { 
    private final String mmsc;