Android Open Source - OrzEye Youdao Translater A P I Connection






From Project

Back to project page OrzEye.

License

The source code is released under:

GNU General Public License

If you think the Android project OrzEye 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.dylan.orzeye.dictionary;
//from   w w  w . j a  v  a  2s.  co m
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

public class YoudaoTranslaterAPIConnection {

  private static final int REQUEST_TIME_OUT = 1000 * 10;
  private static final int READ_TIME_OUT = 1000 * 5;

  public static HttpURLConnection getHttpConnection(String urlString) {
    HttpURLConnection con = null;

    try {
      con = (HttpURLConnection) new URL(urlString).openConnection();

      con.setReadTimeout(READ_TIME_OUT);
      con.setConnectTimeout(REQUEST_TIME_OUT);
    } catch (MalformedURLException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }

    return con;
  }

  public static boolean closeHttpConnection(HttpURLConnection con) {
    try {
      con.getInputStream().close();
      return true;
    } catch (IOException e) {
      e.printStackTrace();
    }
    return false;
  }
}




Java Source Code List

com.dylan.orzeye.CameraActivity.java
com.dylan.orzeye.DrawRectView.java
com.dylan.orzeye.SplashActivity.java
com.dylan.orzeye.dictionary.DictionaryTool.java
com.dylan.orzeye.dictionary.YoudaoJsonParser.java
com.dylan.orzeye.dictionary.YoudaoTranslaterAPIConnection.java
com.dylan.orzeye.dictionary.YoudaoTranslater.java
com.dylan.orzeye.image.ImageProcessTool.java
com.dylan.orzeye.ocr.OCRTool.java