Package org.apache.hadoop.hbase.util
Class PrettyPrinter
java.lang.Object
org.apache.hadoop.hbase.util.PrettyPrinter
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
format
(String value, PrettyPrinter.Unit unit) private static String
humanReadableByte
(long size) Convert a long size to a human readable string.private static long
humanReadableIntervalToSec
(String humanReadableInterval) Convert a human readable time interval to seconds.private static long
humanReadableSizeToBytes
(String humanReadableSize) Convert a human readable size to bytes.private static String
humanReadableTTL
(long interval) static String
toString
(Collection<?> collection) Pretty prints a collection of any type to a string.static String
valueOf
(String pretty, PrettyPrinter.Unit unit) Convert a human readable string to its value.
-
Field Details
-
LOG
-
INTERVAL_REGEX
- See Also:
-
INTERVAL_PATTERN
-
SIZE_REGEX
- See Also:
-
SIZE_PATTERN
-
-
Constructor Details
-
PrettyPrinter
public PrettyPrinter()
-
-
Method Details
-
format
-
valueOf
Convert a human readable string to its value.- Returns:
- the value corresponding to the human readable string
- Throws:
HBaseException
- See Also:
-
humanReadableTTL
-
humanReadableIntervalToSec
Convert a human readable time interval to seconds. Examples of the human readable time intervals are: 50 DAYS 1 HOUR 30 MINUTES , 25000 SECONDS etc. The units of time specified can be in uppercase as well as lowercase. Also, if a single number is specified without any time unit, it is assumed to be in seconds.- Returns:
- value in seconds
- Throws:
HBaseException
-
humanReadableByte
Convert a long size to a human readable string. Example: 10763632640 -> 10763632640 B (10GB 25MB)- Parameters:
size
- the size in bytes- Returns:
- human readable string
-
humanReadableSizeToBytes
Convert a human readable size to bytes. Examples of the human readable size are: 50 GB 20 MB 1 KB , 25000 B etc. The units of size specified can be in uppercase as well as lowercase. Also, if a single number is specified without any time unit, it is assumed to be in bytes.- Parameters:
humanReadableSize
- human readable size- Returns:
- value in bytes
- Throws:
HBaseException
-
toString
Pretty prints a collection of any type to a string. Relies on toString() implementation of the object type.- Parameters:
collection
- collection to pretty print.- Returns:
- Pretty printed string for the collection.
-