@@ -0,0 +1,2440 @@
+package com.iflytek.iflyrec.test;%0A%0Aimport com.google.gson.JsonObject;%0A%0Aimport org.apache.http.HttpEntity;%0Aimport org.apache.http.HttpStatus;%0Aimport org.apache.http.StatusLine;%0Aimport org.apache.http.client.methods.CloseableHttpResponse;%0Aimport org.apache.http.client.methods.HttpPost;%0Aimport org.apache.http.entity.StringEntity;%0Aimport org.apache.http.impl.client.CloseableHttpClient;%0Aimport org.apache.http.impl.client.HttpClients;%0Aimport org.apache.http.util.EntityUtils;%0A%0Aimport java.io.IOException;%0A%0Apublic class Fanyi %7B%0A    public static String doPost(String url, String params) throws Exception %7B%0A%0A        CloseableHttpClient httpclient = HttpClients.createDefault();%0A%0A        HttpPost httpPost = new HttpPost(url);%0A%0A        httpPost.setHeader(%22Accept%22, %22application/json%22);%0A%0A        httpPost.setHeader(%22Content-Type%22, %22application/json%22);%0A%0A        String charSet = %22UTF-8%22;%0A%0A        StringEntity entity = new StringEntity(params, charSet);%0A%0A        httpPost.setEntity(entity);%0A%0A        CloseableHttpResponse response = null;%0A%0A        try %7B%0A%0A            response = httpclient.execute(httpPost);%0A%0A            StatusLine status = response.getStatusLine();%0A%0A            int state = status.getStatusCode();%0A%0A            if (state == HttpStatus.SC_OK) %7B%0A%0A                HttpEntity responseEntity = response.getEntity();%0A%0A                String jsonString = EntityUtils.toString(responseEntity);%0A                System.out.println(jsonString);%0A                return jsonString;%0A%0A            %7D else %7B%0A                System.out.print(%22%E8%AF%B7%E6%B1%82%E8%BF%94%E5%9B%9E:%22 + state + %22(%22 + url + %22)%22);%0A            %7D%0A%0A        %7D finally %7B%0A%0A            if (response != null) %7B%0A%0A                try %7B%0A%0A                    response.close();%0A%0A                %7D catch (IOException e) %7B%0A%0A                    e.printStackTrace();%0A%0A                %7D%0A%0A            %7D%0A%0A            try %7B%0A%0A                httpclient.close();%0A%0A            %7D catch (IOException e) %7B%0A%0A                e.printStackTrace();%0A%0A            %7D%0A%0A        %7D%0A%0A        return null;%0A%0A    %7D%0A%0A%0A    public static void main(String%5B%5D args) throws Exception %7B%0A%0A        JsonObject json = new JsonObject();%0A%0A        String s = %22%E5%A4%A9%E9%9D%92%E8%89%B2%E7%AD%89%E7%83%9F%E9%9B%A8%E8%80%8C%E6%88%91%E5%9C%A8%E7%AD%89%E4%BD%A0%22;%0A        json.addProperty(%22content%22, s);%0A%0A        json.addProperty(%22sourceLanguage%22, 1);%0A%0A        json.addProperty(%22targetLanguage%22, 2);%0A%0A        json.addProperty(%22appId%22, %22q3s298%22);%0A%0A        doPost(%22http://api.iflyrec.com/PublicTranslation/quickTranslate%22, json.toString());%0A%0A    %7D%0A%7D%0A

add iflytek translate Test