Class ClajType

java.lang.Object
com.xpdustry.claj.common.status.ClajType

public class ClajType extends Object
Must be in printable ASCII, between 1 and 16 BYTES.

Type will be truncated if greater than MAX_SIZE, spaces will be replaced by '_', and unknown characters replaced by '?'.

  • Field Details

    • MIN_SIZE

      public static final int MIN_SIZE
      In bytes.
      See Also:
    • MAX_SIZE

      public static final int MAX_SIZE
      In bytes.
      See Also:
    • rawType

      protected final byte[] rawType
    • type

      protected final String type
    • hash

      protected final int hash
  • Constructor Details

  • Method Details

    • type

      public String type()
    • typeSize

      public int typeSize()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • write

      public ByteBuffer write()
    • write

      public void write(ByteBuffer out)
    • write

      public void write(arc.util.io.ByteBufferOutput out)
    • read

      public static ClajType read(ByteBuffer in)
      See Also:
    • read

      public static ClajType read(arc.util.io.ByteBufferInput in)
      See Also:
    • decode

      public static String decode(byte[] data)
      Data will be truncated if length is greater than MAX_SIZE.
    • encode

      public static byte[] encode(String str)
      str will be truncated if length is greater than MAX_SIZE.
    • truncate

      public static byte[] truncate(byte[] data)
      Copy data if greater than MAX_SIZE.
    • validate

      public static boolean validate(byte[] data)
      Replaces spaces by '_' and invalid characters by '?', in place.
    • of

      public static ClajType of(String str)
      Returns:
      the parsed ClajType, or null if it's invalid. Else the the dedicated constructor to adapt it.