• 调用第三方接口的具体代码



     private String getKobe(String mburl)
     {
           URL url = null;
           BufferedReader reader = null;
           String str="";
           try
           {
                   url = new URL(mburl);
                   reader = new BufferedReader(new InputStreamReader(url.openStream(),"UTF-8"));
                   String line=null;
                   do
                   {
                            line = reader.readLine();
                            if(line!=null)
                            {
                                    str +=line;
                            }
                    }
                    while(line!=null);
             }
             catch (Exception e)
            {
                   System.out.println("查询地址解析错误,"+e.getMessage());
                   return "callfail";
            } 
            finally
           {
                   if(reader != null)
                  {
                         try
                         {
                                 reader.close();
                         }
                         catch (IOException e)
                         {
                                  e.printStackTrace();
                         }
                    }
             }

              return str;

      }

  • 相关阅读:
    char类型到底是有符号还是无符号
    GNU C编译器的gnu11和c11
    kotlin之包
    mysql 各个版本驱动jar包
    网络优化
    Android 布局优化
    Android之MVVM开发模式
    Android蓝牙开发技术学习总结
    Android 电量优化
    Android中图片优化
  • 原文地址:https://www.cnblogs.com/jirglt/p/2936292.html
Copyright © 2020-2023  润新知