Enum FileSizeUnit

    • Enum Constant Detail

      • GB

        public static final FileSizeUnit GB
        Gigabyte file size unit.
      • MB

        public static final FileSizeUnit MB
        Megabyte file size unit.
      • KB

        public static final FileSizeUnit KB
        Kilobyte file size unit.
      • B

        public static final FileSizeUnit B
        Byte file size unit.
    • Method Detail

      • values

        public static FileSizeUnit[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (FileSizeUnit c : FileSizeUnit.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static FileSizeUnit valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • convert

        public abstract long convert​(long sourceDuration,
                                     FileSizeUnit sourceUnit)
        Converts a value to a specified unit.
        Parameters:
        sourceDuration - the value.
        sourceUnit - the unit.
        Returns:
        The converted duration.
      • toB

        public abstract long toB​(long value)
        Convert to B.
        Parameters:
        value - the value
        Returns:
        size in B
      • toKB

        public abstract long toKB​(long value)
        Convert to KB.
        Parameters:
        value - the value
        Returns:
        size in KB
      • toMB

        public abstract long toMB​(long value)
        Convert to MB.
        Parameters:
        value - the value
        Returns:
        size in MB
      • toGB

        public abstract long toGB​(long value)
        Convert to GB.
        Parameters:
        value - the value
        Returns:
        size in GB