置頂隨筆

          [置頂]反射實現 AOP 動態代理模式(Spring AOP 的實現 原理)

               摘要: 反射實現 AOP 動態代理模式(Spring AOP 的實現 原理)  閱讀全文

          posted @ 2008-03-04 21:59 DoubleJ 閱讀(68171) | 評論 (77)編輯 收藏

          2012年1月10日

          與IP相關的常用方法(java ip地址 解析)

          1,使用java獲取本機網卡信息
          關鍵接口:
          java.net.NetworkInterface.getNetworkInterfaces();
          --得到本地網卡信息;
           1try {
           2            Enumeration<NetworkInterface> interworkInterface = NetworkInterface
           3                    .getNetworkInterfaces();
           4            if (interworkInterface != null{
           5                NetworkInterface interfaces = null;
           6                while (interworkInterface.hasMoreElements()) {
           7                    interfaces = interworkInterface.nextElement();
           8                    System.out.println("displayName:"
           9                            + interfaces.getDisplayName());
          10                    System.out.println("Name"+interfaces.getName());
          11                    System.out.println("Ip:");
          12                    Enumeration<InetAddress> ips = interfaces.getInetAddresses();
          13                    while(ips.hasMoreElements()){
          14                        System.out.println(ips.nextElement());
          15                    }

          16                }

          17            }
           else {
          18                System.out.println("not found network interfaces!");
          19            }

          20        }
           catch (SocketException e) {
          21            e.printStackTrace();
          22        }

          結果如下:
          displayName:MS TCP Loopback interface
          Namelo
          Ip:
          /127.0.0.1
          displayName:Intel(R) Wireless WiFi Link 4965AG 
          - ????ü??????ò?????
          Nameeth0
          Ip:
          displayName:Intel(R) 82566MM Gigabit Network Connection 
          - ????ü??????ò?????
          Nameeth1
          Ip:
          /192.168.0.252

          關于亂碼問題,木有解決,可否有高手提示
          2,跟據主機名獲取IP地址
          1InetAddress baiduIp = InetAddress.getByName("www.baidu.com");
          2        System.out.println(baiduIp.getHostName());
          3        System.out.println(baiduIp.getHostAddress());
          結果為:
          www.baidu.com
          220.181.111.148

          posted @ 2012-01-10 14:34 DoubleJ 閱讀(449) | 評論 (0)編輯 收藏

          2008年3月4日

          反射實現 AOP 動態代理模式(Spring AOP 的實現 原理)

               摘要: 反射實現 AOP 動態代理模式(Spring AOP 的實現 原理)  閱讀全文

          posted @ 2008-03-04 21:59 DoubleJ 閱讀(68171) | 評論 (77)編輯 收藏

          僅列出標題  
          <2025年5月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          導航

          統計

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          文章檔案

          搜索

          最新評論

          主站蜘蛛池模板: 乐业县| 元谋县| 大新县| 盖州市| 鄂托克前旗| 开鲁县| 宜宾市| 绵阳市| 大港区| 潢川县| 临邑县| 敦煌市| 红原县| 九龙坡区| 江达县| 高雄市| 花垣县| 苍山县| 磐石市| 祁连县| 汨罗市| 绥棱县| 开远市| 长汀县| 景洪市| 嵩明县| 菏泽市| 荔浦县| 巍山| 汝州市| 荆州市| 从化市| 广东省| 炎陵县| 龙门县| 澄江县| 巨野县| 临朐县| 咸宁市| 北宁市| 双辽市|