Package com.chatmotorapi.api
Class ChunkSize
java.lang.Object
com.chatmotorapi.api.ChunkSize
public class ChunkSize extends Object
A utility class for handling chunk sizes with different units (bytes, kilobytes, megabytes, gigabytes).
It provides methods to create, convert, and display chunk sizes in various units.
-
Method Summary
Modifier and Type Method Description static ChunkSize
ofBytes(int bytes)
Creates a ChunkSize object from a size in bytes.static ChunkSize
ofGigabytes(int gigabytes)
Creates a ChunkSize object from a size in gigabytes.static ChunkSize
ofKilobytes(int kilobytes)
Creates a ChunkSize object from a size in kilobytes.static ChunkSize
ofMegabytes(int megabytes)
Creates a ChunkSize object from a size in megabytes.int
toBytes()
Gets the size in bytes.int
toGigabytes()
Gets the size in gigabytes.int
toKilobytes()
Gets the size in kilobytes.int
toMegabytes()
Gets the size in megabytes.String
toString()
Returns a string representation of the size, with the appropriate unit.
-
Method Details
-
ofBytes
Creates a ChunkSize object from a size in bytes.- Parameters:
bytes
- The size in bytes.- Returns:
- A ChunkSize object representing the specified size in bytes.
-
ofKilobytes
Creates a ChunkSize object from a size in kilobytes.- Parameters:
kilobytes
- The size in kilobytes.- Returns:
- A ChunkSize object representing the specified size in kilobytes.
-
ofMegabytes
Creates a ChunkSize object from a size in megabytes.- Parameters:
megabytes
- The size in megabytes.- Returns:
- A ChunkSize object representing the specified size in megabytes.
-
ofGigabytes
Creates a ChunkSize object from a size in gigabytes.- Parameters:
gigabytes
- The size in gigabytes.- Returns:
- A ChunkSize object representing the specified size in gigabytes.
-
toBytes
public int toBytes()Gets the size in bytes.- Returns:
- The size in bytes.
-
toKilobytes
public int toKilobytes()Gets the size in kilobytes.- Returns:
- The size in kilobytes.
-
toMegabytes
public int toMegabytes()Gets the size in megabytes.- Returns:
- The size in megabytes.
-
toGigabytes
public int toGigabytes()Gets the size in gigabytes.- Returns:
- The size in gigabytes.
-
toString
Returns a string representation of the size, with the appropriate unit.
-