Class UTF8String

java.lang.Object
se.kuseman.payloadbuilder.api.execution.UTF8String
All Implemented Interfaces:
Comparable<UTF8String>, ValueVector

public class UTF8String extends Object implements Comparable<UTF8String>, ValueVector
A bytes reference used for data types that supports operations directly on under laying byte structures like Strings etc. NOTE! ValueVector is implemented here to let a single string become a literal value vector of it self to avoid creating a literal
  • Field Details

  • Method Details

    • getBytes

      public byte[] getBytes()
      Return a copy of the underlying utf8 bytes for this string
    • getBytes

      public void getBytes(byte[] destination)
      Return the bytes of this instance into destination byte array. Caller is responsible for correct length
    • size

      public int size()
      Description copied from interface: ValueVector
      Return size of vector
      Specified by:
      size in interface ValueVector
    • type

      public ResolvedType type()
      Description copied from interface: ValueVector
      Return type of vector values
      Specified by:
      type in interface ValueVector
    • isNull

      public boolean isNull(int row)
      Description copied from interface: ValueVector
      Return if value at provided row is null
      Specified by:
      isNull in interface ValueVector
    • getString

      public UTF8String getString(int row)
      Description copied from interface: ValueVector
      Get string at provided row.
      Specified by:
      getString in interface ValueVector
    • compareTo

      public int compareTo(UTF8String that)
      Compare this reference to another bytes reference
      Specified by:
      compareTo in interface Comparable<UTF8String>
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hasString

      public boolean hasString()
      Returns true if this instance has a String instance.
    • getByteLength

      public int getByteLength()
      Return the byte length of this instance.
    • toString

      public String toString()
      Return a string representation of this instance
      Overrides:
      toString in class Object
    • concat

      public static UTF8String concat(List<UTF8String> strings)
      Concats provided string with a comma delimiter
    • concat

      public static UTF8String concat(UTF8String delimeter, List<UTF8String> strings)
      Concats provided string with a delimiter
    • from

      public static UTF8String from(Object object)
      Creates a string from provided object. Will fallback to toString if no known type is found
    • from

      public static UTF8String from(boolean value)
    • from

      public static UTF8String from(String string)
    • utf8

      public static UTF8String utf8(byte[] bytes)
    • utf8

      public static UTF8String utf8(byte[] bytes, int offset, int length)
    • latin

      public static UTF8String latin(byte[] bytes)
    • latin

      public static UTF8String latin(byte[] bytes, int offset, int length)
      Create a utf8 string from latin encoded bytes. NOTE! Recommended usage is utf8 since this method allocates some when converting bytes.