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 Details

    • ofBytes

      public static ChunkSize ofBytes​(int bytes)
      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

      public static ChunkSize ofKilobytes​(int kilobytes)
      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

      public static ChunkSize ofMegabytes​(int megabytes)
      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

      public static ChunkSize ofGigabytes​(int gigabytes)
      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

      public String toString()
      Returns a string representation of the size, with the appropriate unit.
      Overrides:
      toString in class Object
      Returns:
      A string representing the size with the appropriate unit.