cn.hutool.core.io.FileUtil.readableFileSize()方法的使用及代码示例

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

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

FileUtil.readableFileSize介绍

[英]可读的文件大小
参考 http://stackoverflow.com/questions/3263892/format-file-size-as-mb-gb-etc
[中]可读的文件大小
参考 http://stackoverflow.com/questions/3263892/format-file-size-as-mb-gb-etc

代码示例

代码示例来源:origin: looly/hutool

/**
   * 可读的文件大小
   * @return 大小
   */
  public String readableFileSize() {
    return FileUtil.readableFileSize(file.length());
  }
}

代码示例来源:origin: looly/hutool

/**
 * 可读的文件大小
 * 
 * @param file 文件
 * @return 大小
 */
public static String readableFileSize(File file) {
  return readableFileSize(file.length());
}

代码示例来源:origin: looly/hutool

/**
 * 可读的文件大小
 * 
 * @param file 文件
 * @return 大小
 */
public static String readableFileSize(File file) {
  return readableFileSize(file.length());
}

代码示例来源:origin: looly/hutool

/**
   * 可读的文件大小
   * @return 大小
   */
  public String readableFileSize() {
    return FileUtil.readableFileSize(file.length());
  }
}

代码示例来源:origin: looly/hutool

@Override
  public String toString() {
    StringBuilder builder = new StringBuilder();

    SystemUtil.append(builder, "Max Memory:    ", FileUtil.readableFileSize(getMaxMemory()));
    SystemUtil.append(builder, "Total Memory:     ", FileUtil.readableFileSize(getTotalMemory()));
    SystemUtil.append(builder, "Free Memory:     ", FileUtil.readableFileSize(getFreeMemory()));
    SystemUtil.append(builder, "Usable Memory:     ", FileUtil.readableFileSize(getUsableMemory()));

    return builder.toString();
  }
}

代码示例来源:origin: looly/hutool

@Override
  public String toString() {
    StringBuilder builder = new StringBuilder();

    SystemUtil.append(builder, "Max Memory:    ", FileUtil.readableFileSize(getMaxMemory()));
    SystemUtil.append(builder, "Total Memory:     ", FileUtil.readableFileSize(getTotalMemory()));
    SystemUtil.append(builder, "Free Memory:     ", FileUtil.readableFileSize(getFreeMemory()));
    SystemUtil.append(builder, "Usable Memory:     ", FileUtil.readableFileSize(getUsableMemory()));

    return builder.toString();
  }
}

代码示例来源:origin: cn.hutool/hutool-all

/**
 * 可读的文件大小
 * 
 * @param file 文件
 * @return 大小
 */
public static String readableFileSize(File file) {
  return readableFileSize(file.length());
}

代码示例来源:origin: cn.hutool/hutool-all

/**
   * 可读的文件大小
   * @return 大小
   */
  public String readableFileSize() {
    return FileUtil.readableFileSize(file.length());
  }
}

代码示例来源:origin: cn.hutool/hutool-all

@Override
  public String toString() {
    StringBuilder builder = new StringBuilder();

    SystemUtil.append(builder, "Max Memory:    ", FileUtil.readableFileSize(getMaxMemory()));
    SystemUtil.append(builder, "Total Memory:     ", FileUtil.readableFileSize(getTotalMemory()));
    SystemUtil.append(builder, "Free Memory:     ", FileUtil.readableFileSize(getFreeMemory()));
    SystemUtil.append(builder, "Usable Memory:     ", FileUtil.readableFileSize(getUsableMemory()));

    return builder.toString();
  }
}

代码示例来源:origin: cn.hutool/hutool-system

@Override
  public String toString() {
    StringBuilder builder = new StringBuilder();

    SystemUtil.append(builder, "Max Memory:    ", FileUtil.readableFileSize(getMaxMemory()));
    SystemUtil.append(builder, "Total Memory:     ", FileUtil.readableFileSize(getTotalMemory()));
    SystemUtil.append(builder, "Free Memory:     ", FileUtil.readableFileSize(getFreeMemory()));
    SystemUtil.append(builder, "Usable Memory:     ", FileUtil.readableFileSize(getUsableMemory()));

    return builder.toString();
  }
}

相关文章