hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/web/client/OzoneBucket.java
public static void executeGetKey(HttpGet getRequest,
      CloseableHttpClient httpClient, OutputStream stream)
      throws IOException, OzoneException {

    HttpEntity entity = null;
    try {

      HttpResponse response = httpClient.execute(getRequest);
      int errorCode = response.getStatusLine().getStatusCode();
      entity = response.getEntity();

      if (errorCode == HTTP_OK) {
        entity.writeTo(stream);
        return;
      }

      if (entity == null) {
        throw new OzoneRestClientException("Unexpected null in http payload");
      }

      throw OzoneException.parse(EntityUtils.toString(entity));
    } finally {
      if (entity != null) {
        EntityUtils.consumeQuietly(entity);
      }
    }
  }
/**
   * Executes get key and returns the data.
   *
   * @param getRequest - http Get Request
   * @param httpClient - Client
   * @param stream     - Stream to write data to.
   * @throws IOException
   * @throws OzoneException
   */
Executes get key and returns the data.
@param getRequest - http Get Request
@param httpClient - Client
@param stream     - Stream to write data to.
Executes get key and returns the data . @param getRequest - http Get Request @param httpClient - Client @param stream - Stream to write data to .
public static void executeGetKey(HttpGet getRequest,
      CloseableHttpClient httpClient, OutputStream stream)
      throws IOException, OzoneException {
    HttpEntity entity = null;
    try {
      HttpResponse response = httpClient.execute(getRequest);
      int errorCode = response.getStatusLine().getStatusCode();
      entity = response.getEntity();
      if (errorCode == HTTP_OK) {
        entity.writeTo(stream);
        return;
      }
      if (entity == null) {
        throw new OzoneRestClientException("Unexpected null in http payload");
      }
      throw OzoneException.parse(EntityUtils.toString(entity));
    } finally {
      if (entity != null) {
        EntityUtils.consumeQuietly(entity);
      }
    }
  }
public static void executeGetKey ( HttpGet getRequest , CloseableHttpClient httpClient , OutputStream stream ) throws IOException , OzoneException { HttpEntity entity = null ; try { HttpResponse response = httpClient . execute ( getRequest ) ; int errorCode = response . getStatusLine ( ) . getStatusCode ( ) ; entity = response . getEntity ( ) ; if ( errorCode == HTTP_OK ) { entity . writeTo ( stream ) ; return ; } if ( entity == null ) { throw new OzoneRestClientException ( "Unexpected null in http payload" ) ; } throw OzoneException . parse ( EntityUtils . toString ( entity ) ) ; } finally { if ( entity != null ) { EntityUtils . consumeQuietly ( entity ) ; } } }
Executes get key and returns the data.
Executes get key and returns the data .