zoukankan      html  css  js  c++  java
  • 调用第三方接口的具体代码


     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;

      }

  • 相关阅读:
    云时代架构阅读笔记一——架构师必备最全SQL优化方案
    虚拟机VMware安装Ubuntuix
    假期周总结八
    虚拟机VMware安装Kali Linux
    codeforces 401D (数位DP)
    2014 多校联合训练赛6 Fighting the Landlords
    lightoj 1224
    lightoj 1020 (博弈)
    lightoj 1019
    lightoj 1018 (状态压缩DP)
  • 原文地址:https://www.cnblogs.com/jirglt/p/2936292.html
Copyright © 2011-2022 走看看