Class ClajType

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

public class ClajType extends Object
Must be in ASCII, 16 BYTES max, and without spaces.
Type will be truncated if greater than SIZE, and spaces will be replaced by '_'.
  • Field Details

    • ASCII

      public static final Charset ASCII
    • SIZE

      public static final int 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 SIZE.
    • encode

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

      public static byte[] truncate(byte[] data, int max, boolean copy)
    • of

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