mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix dta size bug
This commit is contained in:
parent
626691adec
commit
d0f37fe460
@ -12,6 +12,7 @@
|
||||
|
||||
### Bug修复
|
||||
* 【socket 】 修复Client创建失败资源未释放问题。
|
||||
* 【core 】 修复DataSizeUtil中EB单位错误问题(issue#I39O7I@Gitee)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -44,7 +44,7 @@ public enum DataUnit {
|
||||
*/
|
||||
TERABYTES("TB", DataSize.ofTerabytes(1));
|
||||
|
||||
public static final String[] UNIT_NAMES = new String[]{"B", "kB", "MB", "GB", "TB", "EB"};
|
||||
public static final String[] UNIT_NAMES = new String[]{"B", "kB", "MB", "GB", "TB", "PB", "EB"};
|
||||
|
||||
private final String suffix;
|
||||
|
||||
@ -77,4 +77,4 @@ public enum DataUnit {
|
||||
throw new IllegalArgumentException("Unknown data unit suffix '" + suffix + "'");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,13 @@ public class DataSizeUtilTest {
|
||||
|
||||
@Test
|
||||
public void formatTest(){
|
||||
final String format = DataSizeUtil.format(Long.MAX_VALUE);
|
||||
Assert.assertEquals("8,192 EB", format);
|
||||
String format = DataSizeUtil.format(Long.MAX_VALUE);
|
||||
Assert.assertEquals("8 EB", format);
|
||||
|
||||
format = DataSizeUtil.format(1024L * 1024 * 1024 * 1024 * 1024);
|
||||
Assert.assertEquals("1 PB", format);
|
||||
|
||||
format = DataSizeUtil.format(1024L * 1024 * 1024 * 1024);
|
||||
Assert.assertEquals("1 TB", format);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user