Class PrettyPrinter

java.lang.Object
org.apache.hadoop.hbase.util.PrettyPrinter

@Private public final class PrettyPrinter extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • format

      public static String format(String value, PrettyPrinter.Unit unit)
    • valueOf

      public static String valueOf(String pretty, PrettyPrinter.Unit unit) throws HBaseException
      Convert a human readable string to its value.
      Returns:
      the value corresponding to the human readable string
      Throws:
      HBaseException
      See Also:
    • humanReadableTTL

      private static String humanReadableTTL(long interval)
    • humanReadableIntervalToSec

      private static long humanReadableIntervalToSec(String humanReadableInterval) throws HBaseException
      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

      private static String humanReadableByte(long size)
      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

      private static long humanReadableSizeToBytes(String humanReadableSize) throws HBaseException
      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

      public static String toString(Collection<?> collection)
      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.