Class OpenFileSize
java.lang.Object
cloud.opencode.base.string.format.OpenFileSize
File Size Format Utility - Provides file size formatting methods.
文件大小格式化工具 - 提供文件大小格式化方法。
Features | 主要功能:
- Bytes to human-readable format (B, KB, MB, GB, TB, PB) - 字节到可读格式
- Human-readable format to bytes parsing - 可读格式到字节解析
- Configurable decimal scale - 可配置小数位数
Usage Examples | 使用示例:
String size = OpenFileSize.format(1536); // "1.50 KB"
long bytes = OpenFileSize.parse("2.5 MB"); // 2621440
Security | 安全性:
- Thread-safe: Yes (stateless utility) - 线程安全: 是(无状态工具类)
- Null-safe: Yes (parse returns 0 for null) - 空值安全: 是
- Since:
- JDK 25, opencode-base-string V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
-
Method Details
-
format
-
format
-
parse
-