Android Open Source - face_rec_android Request Utils






From Project

Back to project page face_rec_android.

License

The source code is released under:

GNU General Public License

If you think the Android project face_rec_android 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 in.amolgupta.helpingfaceless.utils;
// w  w w  .j  av a 2 s . c  om
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

import com.squareup.okhttp.OkHttpClient;

public class RequestUtils {
  public static byte[] readFully(InputStream in) throws IOException {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    byte[] buffer = new byte[1024];
    for (int count; (count = in.read(buffer)) != -1;) {
      out.write(buffer, 0, count);
    }
    return out.toByteArray();
  }

  public static String get(URL url, OkHttpClient client) throws IOException {
    HttpURLConnection connection = client.open(url);
    InputStream in = null;
    try {
      // Read the response.
      in = connection.getInputStream();
      byte[] response = readFully(in);
      return new String(response, "UTF-8");
    } finally {
      if (in != null)
        in.close();
    }
  }
}




Java Source Code List

in.amolgupta.helpingfaceless.Views.Fragment.DashboardFragment.java
in.amolgupta.helpingfaceless.activities.HFBaseActivity.java
in.amolgupta.helpingfaceless.activities.HelpActivity.java
in.amolgupta.helpingfaceless.activities.HelpItemFragment.java
in.amolgupta.helpingfaceless.activities.HomeActivity.java
in.amolgupta.helpingfaceless.activities.ImageFragment.java
in.amolgupta.helpingfaceless.activities.PledgeFragment.java
in.amolgupta.helpingfaceless.activities.SetupActivity.java
in.amolgupta.helpingfaceless.activities.SigningActivity.java
in.amolgupta.helpingfaceless.activities.UploadForm.java
in.amolgupta.helpingfaceless.common.App.java
in.amolgupta.helpingfaceless.common.Constants.java
in.amolgupta.helpingfaceless.entities.ImageData.java
in.amolgupta.helpingfaceless.entities.NavItem.java
in.amolgupta.helpingfaceless.entities.TaskDetails.java
in.amolgupta.helpingfaceless.parser.CrowsourceDataParser.java
in.amolgupta.helpingfaceless.services.SendCSResponse.java
in.amolgupta.helpingfaceless.utils.ET.java
in.amolgupta.helpingfaceless.utils.LocationRequestData.java
in.amolgupta.helpingfaceless.utils.RequestUtils.java