Android Open Source - Punchspork Http Helper






From Project

Back to project page Punchspork.

License

The source code is released under:

Copyright (c) 2011 David Shere Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Softwa...

If you think the Android project Punchspork listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.wolliw.punchspork;
//  w  w  w  . j a  v  a 2 s .co  m
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.apache.http.HttpResponse;

public class HttpHelper {
   
  public static String request(HttpResponse response){
    String result = "";
    try{
      InputStream in = response.getEntity().getContent();
      BufferedReader reader = new BufferedReader(new InputStreamReader(in));
      StringBuilder str = new StringBuilder();
      String line = null;
      while((line = reader.readLine()) != null){
        str.append(line + "\n");
      }
      in.close();
      result = str.toString();
    }catch(Exception ex){
      result = "Error";
    }
    return result;
  }
}




Java Source Code List

com.wolliw.punchspork.HttpHelper.java
com.wolliw.punchspork.Punchspork.java
com.wolliw.punchspork.RecipeActivity.java
com.wolliw.punchspork.Recipe.java