Пример #1
0
 /**
  * Creates a new buffered entity wrapper.
  *
  * @param entity the entity to wrap, not null
  * @throws IllegalArgumentException if wrapped is null
  */
 public BufferedHttpEntity(final HttpEntity entity) throws IOException {
   super(entity);
   if (!entity.isRepeatable() || entity.getContentLength() < 0) {
     this.buffer = EntityUtils.toByteArray(entity);
   } else {
     this.buffer = null;
   }
 }
  public Multistatus handleResponse(HttpResponse response) throws SardineException, IOException {
    super.validateResponse(response);

    // Process the response from the server.
    HttpEntity entity = response.getEntity();
    StatusLine statusLine = response.getStatusLine();
    if (entity == null) {
      throw new SardineException(
          "No entity found in response", statusLine.getStatusCode(), statusLine.getReasonPhrase());
    }
    return this.getMultistatus(entity.getContent());
  }