/** * Ensures that the entity content is fully consumed and the content stream, if exists, * is closed. * * @param entity the entity to consume. * @throws IOException if an error occurs reading the input stream * * @since 4.1 */ publicstaticvoidconsume(final HttpEntity entity)throws IOException { if (entity == null) { return; } if (entity.isStreaming()) { finalInputStreaminstream= entity.getContent(); if (instream != null) { instream.close(); } } }