zhyiwww
          用平實的筆,記錄編程路上的點點滴滴………
          posts - 536,comments - 394,trackbacks - 0

          A filename path may include redundant names such as `.' or `..' or symbolic links (on UNIX platforms). File.getCanonicalFile() converts a filename path to a unique canonical form suitable for comparisons.

          				
          						    File file1 = new File("./filename");
              File file2 = new File("filename");
              
              // Filename paths are not equal
              boolean b = file1.equals(file2);      // false
              
              // Normalize the paths
              try {
                  file1 = file1.getCanonicalFile(); // c:\almanac1.4\filename
                  file2 = file2.getCanonicalFile(); // c:\almanac1.4\filename
              } catch (IOException e) {
              }
              
              // Filename paths are now equal
              b = file1.equals(file2);              // true
          				
          		


          |----------------------------------------------------------------------------------------|
                                     版權聲明  版權所有 @zhyiwww
                      引用請注明來源 http://www.aygfsteel.com/zhyiwww   
          |----------------------------------------------------------------------------------------|
          posted on 2006-06-13 11:56 zhyiwww 閱讀(260) 評論(0)  編輯  收藏 所屬分類: code demo -java
          主站蜘蛛池模板: 徐州市| 大理市| 杭锦旗| 封丘县| 桐梓县| 卢湾区| 阆中市| 商河县| 扶绥县| 高邑县| 和硕县| 通渭县| 顺义区| 峨眉山市| 翁源县| 遂平县| 南江县| 通许县| 新巴尔虎右旗| 孟州市| 普兰店市| 大姚县| 友谊县| 会理县| 胶州市| 车致| 江北区| 门头沟区| 青川县| 陵水| 沁水县| 宣恩县| 都安| 民和| 赞皇县| 滦平县| 南皮县| 高清| 达日县| 施秉县| 修文县|