public class ByteSize extends Object implements Comparable<ByteSize>
bytesize ::= zero
| [ sign ] intnumber
| [ sign ] size
[ size
[ size
[ size
[ size
[ size ]
]
]
]
]
.
sign ::= '-' | '+' .
intnumber ::= digit { digit } .
size ::= floatnum [ suffix ] .
floatnum ::= intnumber [ '.' intnumber ] .
suffix ::= 'kb' | 'mb' | 'gb' | 'tb' | 'pb'
| 'b' | 'k' | 'm' | 'g' | 't' | 'p'
.
Примеры:| Modifier and Type | Class and Description |
|---|---|
static class |
ByteSize.Options |
| Modifier and Type | Field and Description |
|---|---|
protected static Pattern |
_number2 |
protected int |
bytes |
protected int |
gbytes |
protected int |
kbytes |
protected int |
mbytes |
protected int |
pbytes |
protected int |
sign |
protected int |
tbytes |
| Constructor and Description |
|---|
ByteSize(BigInteger size) |
ByteSize(long size) |
| Modifier and Type | Method and Description |
|---|---|
ByteSize |
add(ByteSize bs) |
int |
compareTo(ByteSize bc) |
boolean |
equals(Object obj) |
int |
getNameSize(ByteName name) |
int |
getSign() |
BigInteger |
getSize() |
int |
hashCode() |
boolean |
isZero() |
protected static Pattern |
number() |
protected static Pattern |
number2() |
static ByteSize |
parse(String text)
Парсин значения
|
String |
toString() |
String |
toString(ByteSize.Options opts) |
String |
toStringRoundMin() |
String |
toStringRoundMin(int digitAfterPoint) |
static String |
toStringRoundMin(long size,
int digitAfterPoint) |
protected static Pattern |
zero() |
protected int sign
protected int bytes
protected int kbytes
protected int mbytes
protected int gbytes
protected int tbytes
protected int pbytes
protected static Pattern _number2
public ByteSize(BigInteger size)
public ByteSize(long size)
protected static Pattern number()
protected static Pattern zero()
protected static Pattern number2()
public static ByteSize parse(String text)
text - текстовое представлениеpublic BigInteger getSize()
public int getSign()
public int getNameSize(ByteName name)
public boolean isZero()
public int compareTo(ByteSize bc)
compareTo in interface Comparable<ByteSize>public String toStringRoundMin()
public static String toStringRoundMin(long size, int digitAfterPoint)
public String toStringRoundMin(int digitAfterPoint)
public String toString(ByteSize.Options opts)
Copyright © 2018. All rights reserved.