Record Class MemorySize
java.lang.Object
java.lang.Record
org.apache.pulsar.client.api.v5.config.MemorySize
- Record Components:
bytes- the size in bytes
A type-safe representation of a memory size in bytes.
Use the static factory methods to create instances from common units:
MemorySize.ofMegabytes(64) // 64 MB
MemorySize.ofGigabytes(1) // 1 GB
MemorySize.ofKilobytes(512) // 512 KB
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongbytes()Returns the value of thebytesrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static MemorySizeofBytes(long bytes) Create a memory size from a number of bytes.static MemorySizeofGigabytes(long gb) Create a memory size from a number of gigabytes.static MemorySizeofKilobytes(long kb) Create a memory size from a number of kilobytes.static MemorySizeofMegabytes(long mb) Create a memory size from a number of megabytes.toString()
-
Constructor Details
-
MemorySize
public MemorySize(long bytes) Creates an instance of aMemorySizerecord class.- Parameters:
bytes- the value for thebytesrecord component
-
-
Method Details
-
ofBytes
Create a memory size from a number of bytes.- Parameters:
bytes- the size in bytes- Returns:
- a
MemorySizerepresenting the specified number of bytes
-
ofKilobytes
Create a memory size from a number of kilobytes.- Parameters:
kb- the size in kilobytes- Returns:
- a
MemorySizerepresenting the specified number of kilobytes
-
ofMegabytes
Create a memory size from a number of megabytes.- Parameters:
mb- the size in megabytes- Returns:
- a
MemorySizerepresenting the specified number of megabytes
-
ofGigabytes
Create a memory size from a number of gigabytes.- Parameters:
gb- the size in gigabytes- Returns:
- a
MemorySizerepresenting the specified number of gigabytes
-
toString
-
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
bytes
public long bytes()Returns the value of thebytesrecord component.- Returns:
- the value of the
bytesrecord component
-