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 閱讀(261) 評論(0)  編輯  收藏 所屬分類: code demo -java
          主站蜘蛛池模板: 曲沃县| 延边| 琼结县| 遂溪县| 河津市| 体育| 渝北区| 日喀则市| 铜陵市| 杨浦区| 绥芬河市| 射阳县| 民县| 邹平县| 凌源市| 齐齐哈尔市| 兰西县| 静安区| 新和县| 兰考县| 石家庄市| 游戏| 赤壁市| 射阳县| 同德县| 三亚市| 呼玛县| 澄迈县| 屏边| 龙川县| 西城区| 庆元县| 来宾市| 峨眉山市| 阿巴嘎旗| 肥东县| 佳木斯市| 洛阳市| 武鸣县| 深圳市| 麻城市|