List of usage examples for org.apache.http.util EntityUtilsHC4 toByteArray
public static byte[] toByteArray(final HttpEntity entity) throws IOException
From source file:at.bitfire.davdroid.webdav.WebDavResource.java
public void get(String acceptedMimeTypes) throws URISyntaxException, IOException, HttpException, DavException { HttpGetHC4 get = new HttpGetHC4(location); get.addHeader("Accept", acceptedMimeTypes); @Cleanup/*from www . j a v a2s .c o m*/ CloseableHttpResponse response = httpClient.execute(get, context); checkResponse(response); HttpEntity entity = response.getEntity(); if (entity == null) throw new DavNoContentException(); properties.contentType = ContentType.get(entity); content = EntityUtilsHC4.toByteArray(entity); }
From source file:com.granita.icloudcalsync.webdav.WebDavResource.java
public void get(String acceptedMimeTypes) throws URISyntaxException, IOException, HttpException, DavException { HttpGetHC4 get = new HttpGetHC4(location); get.addHeader("Accept", acceptedMimeTypes); @Cleanup// w w w. j av a 2 s . com CloseableHttpResponse response = httpClient.execute(get, context); checkResponse(response); HttpEntity entity = response.getEntity(); if (entity == null) throw new DavNoContentException(); content = EntityUtilsHC4.toByteArray(entity); }