URIBuilder uri = uri( Hdfs.SERVICE_PATH, to );
addQueryParam( uri, "op", "CREATE" );
HttpPut nn = new HttpPut( uri.build() );
HttpResponse r = execute( nn );
if( r.getStatusLine().getStatusCode() != HttpStatus.SC_TEMPORARY_REDIRECT ) {
throw new HadoopException( r.getStatusLine().toString() );
}
EntityUtils.consumeQuietly( r.getEntity() );
Header[] h = r.getHeaders( "Location" );
if( h == null || h.length != 1 ) {
throw new HadoopException( "Invalid Location header." );
}
String loc = h[0].getValue();
HttpPut dn = new HttpPut( loc );
HttpEntity e = null;
if( text != null ) {