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 ChunkSizeofBytes(int bytes)Creates a ChunkSize object from a size in bytes.static ChunkSizeofGigabytes(int gigabytes)Creates a ChunkSize object from a size in gigabytes.static ChunkSizeofKilobytes(int kilobytes)Creates a ChunkSize object from a size in kilobytes.static ChunkSizeofMegabytes(int megabytes)Creates a ChunkSize object from a size in megabytes.inttoBytes()Gets the size in bytes.inttoGigabytes()Gets the size in gigabytes.inttoKilobytes()Gets the size in kilobytes.inttoMegabytes()Gets the size in megabytes.StringtoString()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.
-