Package org.pkl.core
Class DataSize
java.lang.Object
org.pkl.core.DataSize
- All Implemented Interfaces:
Serializable,Value
Java representation of a
pkl.base#DataSize value.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDataSize(double value, DataSizeUnit unit) Constructs a new data size with the given value and unit. -
Method Summary
Modifier and TypeMethodDescription<T> Taccept(ValueConverter<T> converter) Invokes the given converters's convert method for thisValue.voidaccept(ValueVisitor visitor) Invokes the given visitor's visit method for thisValue.convertTo(DataSizeUnit other) Returns a new data size with the given unit and this value converted to the given unit.doubleconvertValueTo(DataSizeUnit other) Returns the value of this data size converted to the given unit.booleanPClassInfo<?>Returns information about the Pkl class associated with thisValue.getUnit()Returns the unit of this data size.doublegetValue()Returns the value of this data size.inthashCode()doubleinBytes()Returns the value of this data size measured inDataSizeUnit.BYTES.doubleReturns the value of this data size measured inDataSizeUnit.GIBIBYTES.doubleReturns the value of this data size measured inDataSizeUnit.GIGABYTES.doubleReturns the value of this data size measured inDataSizeUnit.KIBIBYTES.doubleReturns the value of this data size measured inDataSizeUnit.KILOBYTES.doubleReturns the value of this data size measured inDataSizeUnit.MEBIBYTES.doubleReturns the value of this data size measured inDataSizeUnit.MEGABYTES.doubleReturns the value of this data size measured inDataSizeUnit.PEBIBYTES.doubleReturns the value of this data size measured inDataSizeUnit.PETABYTES.doubleReturns the value of this data size measured inDataSizeUnit.TEBIBYTES.doubleReturns the value of this data size measured inDataSizeUnit.TERABYTES.longReturns the value of this data size measured in wholeDataSizeUnit.BYTES.longReturns the value of this data size measured in wholeDataSizeUnit.GIBIBYTES.longReturns the value of this data size measured in wholeDataSizeUnit.GIGABYTES.longReturns the value of this data size measured in wholeDataSizeUnit.KIBIBYTES.longReturns the value of this data size measured in wholeDataSizeUnit.KILOBYTES.longReturns the value of this data size measured in wholeDataSizeUnit.MEBIBYTES.longReturns the value of this data size measured in wholeDataSizeUnit.MEGABYTES.longReturns the value of this data size measured in wholeDataSizeUnit.PEBIBYTES.longReturns the value of this data size measured in wholeDataSizeUnit.PETABYTES.longReturns the value of this data size measured in wholeDataSizeUnit.TEBIBYTES.longReturns the value of this data size measured in wholeDataSizeUnit.TERABYTES.static DataSizeofBytes(double value) Constructs a new data size with the given value and unitDataSizeUnit.BYTES.static DataSizeofGibibytes(double value) Constructs a new data size with the given value and unitDataSizeUnit.GIBIBYTES.static DataSizeofGigabytes(double value) Constructs a new data size with the given value and unitDataSizeUnit.GIGABYTES.static DataSizeofKibibytes(double value) Constructs a new data size with the given value and unitDataSizeUnit.KIBIBYTES.static DataSizeofKilobytes(double value) Constructs a new data size with the given value and unitDataSizeUnit.KILOBYTES.static DataSizeofMebibytes(double value) Constructs a new data size with the given value and unitDataSizeUnit.MEBIBYTES.static DataSizeofMegabytes(double value) Constructs a new data size with the given value and unitDataSizeUnit.MEGABYTES.static DataSizeofPebibytes(double value) Constructs a new data size with the given value and unitDataSizeUnit.PEBIBYTES.static DataSizeofPetabytes(double value) Constructs a new data size with the given value and unitDataSizeUnit.PETABYTES.static DataSizeofTebibytes(double value) Constructs a new data size with the given value and unitDataSizeUnit.TEBIBYTES.static DataSizeofTerabytes(double value) Constructs a new data size with the given value and unitDataSizeUnit.TERABYTES.toString()
-
Constructor Details
-
DataSize
Constructs a new data size with the given value and unit.
-
-
Method Details
-
ofBytes
Constructs a new data size with the given value and unitDataSizeUnit.BYTES. -
ofKilobytes
Constructs a new data size with the given value and unitDataSizeUnit.KILOBYTES. -
ofKibibytes
Constructs a new data size with the given value and unitDataSizeUnit.KIBIBYTES. -
ofMegabytes
Constructs a new data size with the given value and unitDataSizeUnit.MEGABYTES. -
ofMebibytes
Constructs a new data size with the given value and unitDataSizeUnit.MEBIBYTES. -
ofGigabytes
Constructs a new data size with the given value and unitDataSizeUnit.GIGABYTES. -
ofGibibytes
Constructs a new data size with the given value and unitDataSizeUnit.GIBIBYTES. -
ofTerabytes
Constructs a new data size with the given value and unitDataSizeUnit.TERABYTES. -
ofTebibytes
Constructs a new data size with the given value and unitDataSizeUnit.TEBIBYTES. -
ofPetabytes
Constructs a new data size with the given value and unitDataSizeUnit.PETABYTES. -
ofPebibytes
Constructs a new data size with the given value and unitDataSizeUnit.PEBIBYTES. -
getValue
public double getValue()Returns the value of this data size. The value is relative to the unit and may be negative. -
getUnit
Returns the unit of this data size. -
inBytes
public double inBytes()Returns the value of this data size measured inDataSizeUnit.BYTES. -
inKilobytes
public double inKilobytes()Returns the value of this data size measured inDataSizeUnit.KILOBYTES. -
inKibibytes
public double inKibibytes()Returns the value of this data size measured inDataSizeUnit.KIBIBYTES. -
inMegabytes
public double inMegabytes()Returns the value of this data size measured inDataSizeUnit.MEGABYTES. -
inMebibytes
public double inMebibytes()Returns the value of this data size measured inDataSizeUnit.MEBIBYTES. -
inGigabytes
public double inGigabytes()Returns the value of this data size measured inDataSizeUnit.GIGABYTES. -
inGibibytes
public double inGibibytes()Returns the value of this data size measured inDataSizeUnit.GIBIBYTES. -
inTerabytes
public double inTerabytes()Returns the value of this data size measured inDataSizeUnit.TERABYTES. -
inTebibytes
public double inTebibytes()Returns the value of this data size measured inDataSizeUnit.TEBIBYTES. -
inPetabytes
public double inPetabytes()Returns the value of this data size measured inDataSizeUnit.PETABYTES. -
inPebibytes
public double inPebibytes()Returns the value of this data size measured inDataSizeUnit.PEBIBYTES. -
inWholeBytes
public long inWholeBytes()Returns the value of this data size measured in wholeDataSizeUnit.BYTES. -
inWholeKilobytes
public long inWholeKilobytes()Returns the value of this data size measured in wholeDataSizeUnit.KILOBYTES. -
inWholeKibibytes
public long inWholeKibibytes()Returns the value of this data size measured in wholeDataSizeUnit.KIBIBYTES. -
inWholeMegabytes
public long inWholeMegabytes()Returns the value of this data size measured in wholeDataSizeUnit.MEGABYTES. -
inWholeMebibytes
public long inWholeMebibytes()Returns the value of this data size measured in wholeDataSizeUnit.MEBIBYTES. -
inWholeGigabytes
public long inWholeGigabytes()Returns the value of this data size measured in wholeDataSizeUnit.GIGABYTES. -
inWholeGibibytes
public long inWholeGibibytes()Returns the value of this data size measured in wholeDataSizeUnit.GIBIBYTES. -
inWholeTerabytes
public long inWholeTerabytes()Returns the value of this data size measured in wholeDataSizeUnit.TERABYTES. -
inWholeTebibytes
public long inWholeTebibytes()Returns the value of this data size measured in wholeDataSizeUnit.TEBIBYTES. -
inWholePetabytes
public long inWholePetabytes()Returns the value of this data size measured in wholeDataSizeUnit.PETABYTES. -
inWholePebibytes
public long inWholePebibytes()Returns the value of this data size measured in wholeDataSizeUnit.PEBIBYTES. -
convertTo
Returns a new data size with the given unit and this value converted to the given unit. -
convertValueTo
Returns the value of this data size converted to the given unit. -
accept
Invokes the given visitor's visit method for thisValue. -
accept
Invokes the given converters's convert method for thisValue. -
getClassInfo
Returns information about the Pkl class associated with thisValue.- Specified by:
getClassInfoin interfaceValue
-
equals
-
hashCode
public int hashCode() -
toString
-