Class HumanReadableBytes
java.lang.Object
org.apache.druid.java.util.common.HumanReadableBytes
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic Stringformat(long bytes, long precision, HumanReadableBytes.UnitSystem unitSystem) Returns a human-readable string version of input valuelonggetBytes()intinthashCode()static longstatic longparse the case-insensitive string number, which is either:toString()static HumanReadableBytesvalueOf(int bytes) static HumanReadableBytesvalueOf(long bytes)
-
Field Details
-
ZERO
-
-
Constructor Details
-
HumanReadableBytes
-
HumanReadableBytes
public HumanReadableBytes(long bytes)
-
-
Method Details
-
getBytes
public long getBytes() -
getBytesInInt
public int getBytesInInt() -
equals
-
hashCode
public int hashCode() -
toString
-
valueOf
-
valueOf
-
parse
-
parse
parse the case-insensitive string number, which is either:a number string
or
a number string with a suffix which indicates the unit the of number the unit must be one of following k - kilobyte = 1000 m - megabyte = 1,000,000 g - gigabyte = 1,000,000,000 t - terabyte = 1,000,000,000,000 p - petabyte = 1,000,000,000,000,000 Ki(B) - kilo binary byte = 1024 Mi(B) - mega binary byte = 1024*1204 Gi(B) - giga binary byte = 1024*1024*1024 Ti(B) - tera binary byte = 1024*1024*1024*1024 Pi(B) - peta binary byte = 1024*1024*1024*1024*1024
- Parameters:
nullValue- to be returned when given number is null or empty- Returns:
- nullValue if input is null or empty value of number
- Throws:
IAE- if the input is invalid
-
format
Returns a human-readable string version of input value- Parameters:
bytes- input value. Negative value is also allowedprecision- [0,3]unitSystem- which unit system is adopted to format the input value, seeHumanReadableBytes.UnitSystem
-