Android BufferedHttpEntity - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android BufferedHttpEntity class.

This code example shows how to use the following methods:getContent
This code example shows how to use the following methods:
        this.statusCode = this.statusLine.getStatusCode();
 
        final HttpEntity wrappedHttpEntity = response.getEntity();
        if (wrappedHttpEntity != null) {
            try { 
                this.entity = new BufferedHttpEntity(wrappedHttpEntity);
            } catch (final IOException e) {
                this.entity = null;
            } 
        } 
    } 
 
    public final String getContent() throws IOException {
        if (this.entity != null) {
            return EntityUtils.toString(this.entity, HTTP.UTF_8);
        } 
        return null; 
    } 
 
    public final JSONArray getJSONArray() throws IOException {
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getContent
        HttpEntity entity = response.getEntity();
        BufferedHttpEntity bufHttpEntity;
        InputStream instream = null;
         
		try { 
			bufHttpEntity = new BufferedHttpEntity(entity);
			instream = bufHttpEntity.getContent();
		} catch (IOException e) {
			// TODO Auto-generated catch block 
			e.printStackTrace();
		}  
         
        drawable = new BitmapDrawable(BitmapFactory.decodeStream(instream));
	} 
	 
	/* 
	 * NOTE: this method doesn't work sometimes 
	 */ 
//	public ImageFromUrl(String url) { 
//		try { 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getContentLength, getContentType, writeTo
This code example shows how to use the following methods:getContentLength, getContentType, writeTo
This code example shows how to use the following methods:
        String responseBody = null;
        try { 
            HttpEntity entity = null;
            HttpEntity temp = response.getEntity();
            if(temp != null) {
                entity = new BufferedHttpEntity(temp);
            } 
            responseBody = EntityUtils.toString(entity,"UTF-8");
        } catch(IOException e) {
            sendFailureMessage(e, null);
        } 
 
        if(status.getStatusCode() >= 300) {
            sendFailureMessage(new HttpResponseException(status.getStatusCode(), status.getReasonPhrase()), responseBody);
        } else { 
            sendSuccessMessage(responseBody);
        } 
    } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getContent
	} 
	 
	private InputStream getBitmapStream() throws Exception {
		HttpEntity entity = getRequest(_url);
		 
		BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity);
		return new FlushedInputStream(bufHttpEntity.getContent());	
	} 
 
	private int determineSampleSize() throws Exception { 
		 
		Options options = new BitmapFactory.Options();
		options.inJustDecodeBounds = true;
		BitmapFactory.decodeStream(getBitmapStream(), null, options);
		Boolean scaleByHeight = Math.abs(options.outHeight - _targetHeight) >= Math.abs(options.outWidth - _targetWidth);
 
		if(options.outHeight * options.outWidth * 2 >= 200*200*2){
		         // Load, scaling to smallest power of 2 that'll get it <= desired dimensions 
		        double sampleSize = scaleByHeight
		              ? options.outHeight / _targetHeight
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getContent
        HttpClient httpclient = vehicleTracker.getHttpClient();
        HttpGet httpRequest = new HttpGet(URI.create(address));
        httpRequest.setHeader("User-Agent","Mozilla/5.0 (X11; Linux i686)");
        HttpResponse response = httpclient.execute(httpRequest);
        HttpEntity entity = response.getEntity();
        BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity);
        return bufHttpEntity.getContent();
    } 
 
    @Override 
    protected void onPostExecute(Bitmap result) {
        progressBar.setVisibility(View.INVISIBLE);
 
        if (isCancelled()) {
            Log.d(TAG, "onPostExecute skipped");
            return; 
        } 
        super.onPostExecute(result);
        if (result != null) {
            errorSign.setVisibility(View.INVISIBLE);
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getContent, consumeContent
			HttpGet httpRequest=new HttpGet(URI.create(imageAddress));
			httpclient=new DefaultHttpClient();
			httpclient.setParams(httpParameters);
			HttpResponse response=(HttpResponse)httpclient.execute(httpRequest);
			HttpEntity entity=response.getEntity();
			BufferedHttpEntity bufHttpEntity=new BufferedHttpEntity(entity);
			InputStream instream=bufHttpEntity.getContent();
			BitmapFactory.Options options=new BitmapFactory.Options();
		    //first decode with inJustDecodeBounds=true to check dimensions 
		    options.inJustDecodeBounds=true;
			options.inSampleSize=sampleSize;
			BitmapFactory.decodeStream(instream,null,options);
		    //decode bitmap with inSampleSize set 
		    options.inSampleSize=calculateInSampleSize(options,MAX_WIDTH,MAX_HEIGHT);
			options.inPurgeable=true;
			options.inInputShareable=true;
			options.inDither=true;
		    options.inJustDecodeBounds=false;
			//response=(HttpResponse)httpclient.execute(httpRequest); 
			//entity=response.getEntity(); 

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getContent

Related Android BufferedHttpEntity Questions & Answers:

See Code Examples for Android BufferedHttpEntity Methods: