Package | Description |
---|---|
cn.hutool.core.io.unit |
数据单位相关封装,包括DataUnit数据单位和DataSize数据大小
|
Modifier and Type | Method and Description |
---|---|
static DataSize |
DataSize.of(BigDecimal amount,
DataUnit unit)
获得指定
DataUnit 对应的DataSize |
static DataSize |
DataSize.of(long amount,
DataUnit unit)
获得指定
DataUnit 对应的DataSize |
static DataSize |
DataSize.ofBytes(long bytes)
获得对应bytes的DataSize
|
static DataSize |
DataSize.ofGigabytes(long gigabytes)
获得对应gigabytes的DataSize
|
static DataSize |
DataSize.ofKilobytes(long kilobytes)
获得对应kilobytes的DataSize
|
static DataSize |
DataSize.ofMegabytes(long megabytes)
获得对应megabytes的DataSize
|
static DataSize |
DataSize.ofTerabytes(long terabytes)
获得对应terabytes的DataSize
|
static DataSize |
DataSize.parse(CharSequence text)
获取指定数据大小文本对应的DataSize对象,如果无单位指定,默认获取
DataUnit.BYTES
例如:
"12KB" -- parses as "12 kilobytes"
"5MB" -- parses as "5 megabytes"
"20" -- parses as "20 bytes"
|
static DataSize |
DataSize.parse(CharSequence text,
DataUnit defaultUnit)
Obtain a DataSize from a text string such as
12MB using
the specified default DataUnit if no unit is specified. |
Modifier and Type | Method and Description |
---|---|
int |
DataSize.compareTo(DataSize other) |
Copyright © 2024. All rights reserved.