public Headers getHttpHeaders ( ) { Headers headers = new Headers ( ) ; if ( byteRange != null ) { StringBuilder rangeBuilder = new StringBuilder ( "bytes=" ) ; long start ; if ( byteRange . offset >= 0 ) { rangeBuilder . append ( byteRange . offset ) ; start = byteRange . offset ; } else { start = 1 ; } rangeBuilder . append ( "-" ) ; if ( byteRange . length > 0 ) { rangeBuilder . append ( start + byteRange . length - 1 ) ; } Header rangeHeader = new BasicHeader ( "Range" , rangeBuilder . toString ( ) ) ; headers . addHeader ( rangeHeader ) ; } return headers ; }
Get the HTTP headers to be used for download request .