Class DataSize

    • Method Detail

      • bytes

        public static DataSize bytes​(long count)
        Constructs a new DataSize object representing the specified amount of bytes.
        Parameters:
        count - the amount of bytes
        Returns:
        the newly created DataSize object
      • kilobytes

        public static DataSize kilobytes​(long count)
        Constructs a new DataSize object representing the specified amount of kilobytes.
        Parameters:
        count - the amount of kilobytes
        Returns:
        the newly created DataSize object
      • megabytes

        public static DataSize megabytes​(long count)
        Constructs a new DataSize object representing the specified amount of megabytes.
        Parameters:
        count - the amount of megabytes
        Returns:
        the newly created DataSize object
      • gigabytes

        public static DataSize gigabytes​(long count)
        Constructs a new DataSize object representing the specified amount of gigabytes.
        Parameters:
        count - the amount of gigabytes
        Returns:
        the newly created DataSize object
      • terabytes

        public static DataSize terabytes​(long count)
        Constructs a new DataSize object representing the specified amount of terabytes.
        Parameters:
        count - the amount of terabytes
        Returns:
        the newly created DataSize object
      • petabytes

        public static DataSize petabytes​(long count)
        Constructs a new DataSize object representing the specified amount of petabytes.
        Parameters:
        count - the amount of petabytes
        Returns:
        the newly created DataSize object
      • kibibytes

        public static DataSize kibibytes​(long count)
        Constructs a new DataSize object representing the specified amount of kibibytes.
        Parameters:
        count - the amount of kibibytes
        Returns:
        the newly created DataSize object
      • mebibytes

        public static DataSize mebibytes​(long count)
        Constructs a new DataSize object representing the specified amount of mebibytes.
        Parameters:
        count - the amount of mebibytes
        Returns:
        the newly created DataSize object
      • gibibytes

        public static DataSize gibibytes​(long count)
        Constructs a new DataSize object representing the specified amount of gibibytes.
        Parameters:
        count - the amount of gibibytes
        Returns:
        the newly created DataSize object
      • tebibytes

        public static DataSize tebibytes​(long count)
        Constructs a new DataSize object representing the specified amount of tebibytes.
        Parameters:
        count - the amount of tebibytes
        Returns:
        the newly created DataSize object
      • pebibytes

        public static DataSize pebibytes​(long count)
        Constructs a new DataSize object representing the specified amount of pebibytes.
        Parameters:
        count - the amount of pebibytes
        Returns:
        the newly created DataSize object
      • parse

        public static DataSize parse​(CharSequence size,
                                     DataSizeUnit defaultUnit)
        Parses a given CharSequence to a DataSize object. If no unit is provided by the input sequence, the default unit parameter is used.
        Parameters:
        size - the string representation of the DataSize to parse
        defaultUnit - the fallback default unit to use for the newly created DataSize
        Returns:
        a valid new DataSize object representing the parsed string
        Throws:
        IllegalArgumentException - if the input sequence cannot be parsed correctly
      • getQuantity

        public long getQuantity()
        Gets the quantity of the current DataSize object.
        Returns:
        the quantity of the current data size
      • toBytes

        public long toBytes()
        Returns the quantity of the current DataSize object in bytes.
        Returns:
        the converted quantity
      • toKilobytes

        public long toKilobytes()
        Returns the quantity of the current DataSize object in kilobytes.
        Returns:
        the converted quantity
      • toMegabytes

        public long toMegabytes()
        Returns the quantity of the current DataSize object in megabytes.
        Returns:
        the converted quantity
      • toGigabytes

        public long toGigabytes()
        Returns the quantity of the current DataSize object in gigabytes.
        Returns:
        the converted quantity
      • toTerabytes

        public long toTerabytes()
        Returns the quantity of the current DataSize object in terabytes.
        Returns:
        the converted quantity
      • toPetabytes

        public long toPetabytes()
        Returns the quantity of the current DataSize object in petabytes.
        Returns:
        the converted quantity
      • toKibibytes

        public long toKibibytes()
        Returns the quantity of the current DataSize object in kibibytes.
        Returns:
        the converted quantity
      • toMebibytes

        public long toMebibytes()
        Returns the quantity of the current DataSize object in mebibytes.
        Returns:
        the converted quantity
      • toGibibytes

        public long toGibibytes()
        Returns the quantity of the current DataSize object in gibibytes.
        Returns:
        the converted quantity
      • toTebibytes

        public long toTebibytes()
        Returns the quantity of the current DataSize object in gebibytes.
        Returns:
        the converted quantity
      • toPebibytes

        public long toPebibytes()
        Returns the quantity of the current DataSize object in pebibytes.
        Returns:
        the converted quantity
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object