Class MemorySize

    • Constructor Detail

      • MemorySize

        public MemorySize​(long bytes)
        Constructs a new MemorySize.
        Parameters:
        bytes - The size, in bytes. Must be zero or larger.
    • Method Detail

      • ofMebiBytes

        public static MemorySize ofMebiBytes​(long mebiBytes)
      • getBytes

        public long getBytes()
        Gets the memory size in bytes.
      • getKibiBytes

        public long getKibiBytes()
        Gets the memory size in Kibibytes (= 1024 bytes).
      • getMebiBytes

        public int getMebiBytes()
        Gets the memory size in Mebibytes (= 1024 Kibibytes).
      • getGibiBytes

        public long getGibiBytes()
        Gets the memory size in Gibibytes (= 1024 Mebibytes).
      • getTebiBytes

        public long getTebiBytes()
        Gets the memory size in Tebibytes (= 1024 Gibibytes).
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • toHumanReadableString

        public String toHumanReadableString()
      • multiply

        public MemorySize multiply​(double multiplier)
      • parseBytes

        public static long parseBytes​(String text)
                               throws IllegalArgumentException
        Parses the given string as bytes. The supported expressions are listed under MemorySize.
        Parameters:
        text - The string to parse
        Returns:
        The parsed size, in bytes.
        Throws:
        IllegalArgumentException - Thrown, if the expression cannot be parsed.