org.openide.filesystems.FileUtil.normalizeFileOnUnixAlike()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中org.openide.filesystems.FileUtil.normalizeFileOnUnixAlike()方法的一些代码示例,展示了FileUtil.normalizeFileOnUnixAlike()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.normalizeFileOnUnixAlike()方法的具体详情如下:
包路径:org.openide.filesystems.FileUtil
类名称:FileUtil
方法名:normalizeFileOnUnixAlike

FileUtil.normalizeFileOnUnixAlike介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

  1. private static File normalizeFileImpl(File file) {
  2. // XXX should use NIO in JDK 7; see #6358641
  3. Parameters.notNull("file", file); //NOI18N
  4. File retFile;
  5. LOG.log(Level.FINE, "FileUtil.normalizeFile for {0}", file); // NOI18N
  6. long now = System.currentTimeMillis();
  7. if ((Utilities.isWindows() || (Utilities.getOperatingSystem() == Utilities.OS_OS2))) {
  8. retFile = normalizeFileOnWindows(file);
  9. } else if (Utilities.isMac()) {
  10. retFile = normalizeFileOnMac(file);
  11. } else {
  12. retFile = normalizeFileOnUnixAlike(file);
  13. }
  14. File ret = (file.getPath().equals(retFile.getPath())) ? file : retFile;
  15. long took = System.currentTimeMillis() - now;
  16. if (took > 500) {
  17. LOG.log(Level.WARNING, "FileUtil.normalizeFile({0}) took {1} ms. Result is {2}", new Object[]{file, took, ret});
  18. }
  19. return ret;
  20. }

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

  1. /**
  2. * Normalize a file path to a clean form.
  3. * This method may for example make sure that the returned file uses
  4. * the correct case on Windows; that old Windows 8.3 filenames are changed to the long form;
  5. * that relative paths are changed to be
  6. * absolute; etc.
  7. * Unlike {@link File#getCanonicalFile} this method will not traverse symbolic links on Unix.
  8. * @param file file to normalize
  9. * @return normalized file
  10. * @since 4.48
  11. */
  12. public static File normalizeFile(File file) {
  13. if ((Utilities.isWindows () || (Utilities.getOperatingSystem () == Utilities.OS_OS2))) {
  14. file = normalizeFileOnWindows(file);
  15. } else if (Utilities.getOperatingSystem() == Utilities.OS_MAC) {
  16. file = normalizeFileOnMac(file);
  17. } else {
  18. file = normalizeFileOnUnixAlike(file);
  19. }
  20. return file;
  21. }

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

  1. /**
  2. * Normalize a file path to a clean form.
  3. * This method may for example make sure that the returned file uses
  4. * the correct case on Windows; that old Windows 8.3 filenames are changed to the long form;
  5. * that relative paths are changed to be
  6. * absolute; etc.
  7. * Unlike {@link File#getCanonicalFile} this method will not traverse symbolic links on Unix.
  8. * @param file file to normalize
  9. * @return normalized file
  10. * @since 4.48
  11. */
  12. public static File normalizeFile(File file) {
  13. if ((Utilities.isWindows () || (Utilities.getOperatingSystem () == Utilities.OS_OS2))) {
  14. file = normalizeFileOnWindows(file);
  15. } else if (Utilities.getOperatingSystem() == Utilities.OS_MAC) {
  16. file = normalizeFileOnMac(file);
  17. } else {
  18. file = normalizeFileOnUnixAlike(file);
  19. }
  20. return file;
  21. }

相关文章