Code example for HttpGet

Methods: addHeader

0
                long expectedLength)
            throws ClientProtocolException, IOException { 
            url = normalizeUrl(url);
            Log.i(LOG_TAG, "Get " + url);
 
            mHttpGet = new HttpGet(url);
            int expectedStatusCode = HttpStatus.SC_OK;
            if (startOffset > 0) {
                String range = "bytes=" + startOffset + "-";
                if (expectedLength >= 0) {
                    range += expectedLength-1;
                } 
                Log.i(LOG_TAG, "requesting byte range " + range);
                mHttpGet.addHeader("Range", range);
                expectedStatusCode = HttpStatus.SC_PARTIAL_CONTENT;
            } 
            HttpResponse response = mHttpClient.execute(mHttpGet);
            long bytesToSkip = 0;
            int statusCode = response.getStatusLine().getStatusCode();
            if (statusCode != expectedStatusCode) {
Stop searching for code, let great code find you!  Add Codota to your java IDE