小编bob*_*ope的帖子

在Java Android App中将输入流转换为字符串值

我正在编写函数时遇到问题.我正在尝试将输入流转换为字符串值.我写了两个函数,我试图提取String值,但我的Log.e响应返回NULL.以下是我的语法.我究竟做错了什么?谢谢

public JSONArray GetCityDetails(String StateID) {

    @SuppressWarnings("deprecation")
    String url = "http://mywebsite.com/getCity.php?StateID="+URLEncoder.encode(StateID);

    HttpEntity httpEntity = null;

    try{

         DefaultHttpClient httpClient = new DefaultHttpClient();
         HttpGet httpGet = new HttpGet(url);

         HttpResponse httpResponse = httpClient.execute(httpGet);

         httpEntity = httpResponse.getEntity();


    } catch(ClientProtocolException e){
        e.printStackTrace();

    } catch(IOException e){
        e.printStackTrace();
    }


    JSONArray jsonArray = null;
    if(httpEntity !=null){
        try{

            InputStream entityResponse = httpEntity.getContent();
            // not working
            String entityResponseAfterFunctionCall2 = readFully(entityResponse);
            // not working
            String entityResponseAfterFunctionCall3 = letsDoThisAgain(entityResponse);
            Log.e("Entity Response Dude: ", entityResponseAfterFunctionCall3);

            jsonArray = new JSONArray(entityResponseAfterFunctionCall3);

        } catch(JSONException e){
            e.printStackTrace(); …
Run Code Online (Sandbox Code Playgroud)

java android

5
推荐指数
2
解决办法
1万
查看次数

ssh_exchange_identification读取连接由同行重置 - Homestead Laravel

我正在尝试使用vagrant ssh命令连接到Homestead,但我收到以下错误消息.我正在使用Windows 7.如何解决此问题?

ssh_exchange_identification读取连接由对等方重置

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos-64-x64-vbox4210'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: rafael_default_1396403974194_51967
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for …
Run Code Online (Sandbox Code Playgroud)

ssh ssh-keys laravel-4

5
推荐指数
1
解决办法
4656
查看次数

标签 统计

android ×1

java ×1

laravel-4 ×1

ssh ×1

ssh-keys ×1