Package org.pkl.core

Class DataSize

java.lang.Object
org.pkl.core.DataSize
All Implemented Interfaces:
Serializable, Value

public final class DataSize extends Object implements Value
Java representation of a pkl.base#DataSize value.
See Also:
  • Constructor Details

    • DataSize

      public DataSize(double value, DataSizeUnit unit)
      Constructs a new data size with the given value and unit.
  • Method Details

    • ofBytes

      public static DataSize ofBytes(double value)
      Constructs a new data size with the given value and unit DataSizeUnit.BYTES.
    • ofKilobytes

      public static DataSize ofKilobytes(double value)
      Constructs a new data size with the given value and unit DataSizeUnit.KILOBYTES.
    • ofKibibytes

      public static DataSize ofKibibytes(double value)
      Constructs a new data size with the given value and unit DataSizeUnit.KIBIBYTES.
    • ofMegabytes

      public static DataSize ofMegabytes(double value)
      Constructs a new data size with the given value and unit DataSizeUnit.MEGABYTES.
    • ofMebibytes

      public static DataSize ofMebibytes(double value)
      Constructs a new data size with the given value and unit DataSizeUnit.MEBIBYTES.
    • ofGigabytes

      public static DataSize ofGigabytes(double value)
      Constructs a new data size with the given value and unit DataSizeUnit.GIGABYTES.
    • ofGibibytes

      public static DataSize ofGibibytes(double value)
      Constructs a new data size with the given value and unit DataSizeUnit.GIBIBYTES.
    • ofTerabytes

      public static DataSize ofTerabytes(double value)
      Constructs a new data size with the given value and unit DataSizeUnit.TERABYTES.
    • ofTebibytes

      public static DataSize ofTebibytes(double value)
      Constructs a new data size with the given value and unit DataSizeUnit.TEBIBYTES.
    • ofPetabytes

      public static DataSize ofPetabytes(double value)
      Constructs a new data size with the given value and unit DataSizeUnit.PETABYTES.
    • ofPebibytes

      public static DataSize ofPebibytes(double value)
      Constructs a new data size with the given value and unit DataSizeUnit.PEBIBYTES.
    • getValue

      public double getValue()
      Returns the value of this data size. The value is relative to the unit and may be negative.
    • getUnit

      public DataSizeUnit getUnit()
      Returns the unit of this data size.
    • inBytes

      public double inBytes()
      Returns the value of this data size measured in DataSizeUnit.BYTES.
    • inKilobytes

      public double inKilobytes()
      Returns the value of this data size measured in DataSizeUnit.KILOBYTES.
    • inKibibytes

      public double inKibibytes()
      Returns the value of this data size measured in DataSizeUnit.KIBIBYTES.
    • inMegabytes

      public double inMegabytes()
      Returns the value of this data size measured in DataSizeUnit.MEGABYTES.
    • inMebibytes

      public double inMebibytes()
      Returns the value of this data size measured in DataSizeUnit.MEBIBYTES.
    • inGigabytes

      public double inGigabytes()
      Returns the value of this data size measured in DataSizeUnit.GIGABYTES.
    • inGibibytes

      public double inGibibytes()
      Returns the value of this data size measured in DataSizeUnit.GIBIBYTES.
    • inTerabytes

      public double inTerabytes()
      Returns the value of this data size measured in DataSizeUnit.TERABYTES.
    • inTebibytes

      public double inTebibytes()
      Returns the value of this data size measured in DataSizeUnit.TEBIBYTES.
    • inPetabytes

      public double inPetabytes()
      Returns the value of this data size measured in DataSizeUnit.PETABYTES.
    • inPebibytes

      public double inPebibytes()
      Returns the value of this data size measured in DataSizeUnit.PEBIBYTES.
    • inWholeBytes

      public long inWholeBytes()
      Returns the value of this data size measured in whole DataSizeUnit.BYTES.
    • inWholeKilobytes

      public long inWholeKilobytes()
      Returns the value of this data size measured in whole DataSizeUnit.KILOBYTES.
    • inWholeKibibytes

      public long inWholeKibibytes()
      Returns the value of this data size measured in whole DataSizeUnit.KIBIBYTES.
    • inWholeMegabytes

      public long inWholeMegabytes()
      Returns the value of this data size measured in whole DataSizeUnit.MEGABYTES.
    • inWholeMebibytes

      public long inWholeMebibytes()
      Returns the value of this data size measured in whole DataSizeUnit.MEBIBYTES.
    • inWholeGigabytes

      public long inWholeGigabytes()
      Returns the value of this data size measured in whole DataSizeUnit.GIGABYTES.
    • inWholeGibibytes

      public long inWholeGibibytes()
      Returns the value of this data size measured in whole DataSizeUnit.GIBIBYTES.
    • inWholeTerabytes

      public long inWholeTerabytes()
      Returns the value of this data size measured in whole DataSizeUnit.TERABYTES.
    • inWholeTebibytes

      public long inWholeTebibytes()
      Returns the value of this data size measured in whole DataSizeUnit.TEBIBYTES.
    • inWholePetabytes

      public long inWholePetabytes()
      Returns the value of this data size measured in whole DataSizeUnit.PETABYTES.
    • inWholePebibytes

      public long inWholePebibytes()
      Returns the value of this data size measured in whole DataSizeUnit.PEBIBYTES.
    • convertTo

      public DataSize convertTo(DataSizeUnit other)
      Returns a new data size with the given unit and this value converted to the given unit.
    • convertValueTo

      public double convertValueTo(DataSizeUnit other)
      Returns the value of this data size converted to the given unit.
    • accept

      public void accept(ValueVisitor visitor)
      Invokes the given visitor's visit method for this Value.
      Specified by:
      accept in interface Value
    • accept

      public <T> T accept(ValueConverter<T> converter)
      Invokes the given converters's convert method for this Value.
      Specified by:
      accept in interface Value
    • getClassInfo

      public PClassInfo<?> getClassInfo()
      Returns information about the Pkl class associated with this Value.
      Specified by:
      getClassInfo in interface Value
    • equals

      public boolean equals(@Nullable @Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object