/** * Ensures that the entity content is fully consumed and the content stream, if exists, * is closed. The process is done, <i>quietly</i> , without throwing any IOException. * * @param entity the entity to consume. * * * @since 4.2 */ public static void consumeQuietly(final HttpEntity entity) { try { consume(entity); } catch (final IOException ignore) { } }
public void close() throws IOException { final HttpEntity entity = this.original.getEntity(); EntityUtilsHC4.consume(entity); }
if (entity != null) { try { EntityUtilsHC4.consume(entity); } catch (final IOException ex) {
try { try { EntityUtilsHC4.consume(response.getEntity()); } finally { response.close();
/** * Returns the response body as a String if the response was successful (a * 2xx status code). If no response body exists, this returns null. If the * response was unsuccessful (>= 300 status code), throws an * {@link HttpResponseException}. */ public String handleResponse(final HttpResponse response) throws HttpResponseException, IOException { final StatusLine statusLine = response.getStatusLine(); final HttpEntity entity = response.getEntity(); if (statusLine.getStatusCode() >= 300) { EntityUtilsHC4.consume(entity); throw new HttpResponseException(statusLine.getStatusCode(), statusLine.getReasonPhrase()); } return entity == null ? null : EntityUtilsHC4.toString(entity); }
/** * Updates an entity in a response by first consuming an existing entity, then setting the new one. * * @param response the response with an entity to update; must not be null. * @param entity the entity to set in the response. * @throws IOException if an error occurs while reading the input stream on the existing * entity. * @throws IllegalArgumentException if response is null. * * @since 4.3 */ public static void updateEntity( final HttpResponse response, final HttpEntity entity) throws IOException { Args.notNull(response, "Response"); consume(response.getEntity()); response.setEntity(entity); }
EntityUtilsHC4.consume(entity); } else { conn.close();
EntityUtilsHC4.consume(entity); } else { managedConn.close();
EntityUtilsHC4.consume(entity); } else { managedConn.close();