Package dev.cel.common.values
Class CelByteString
- java.lang.Object
-
- dev.cel.common.values.CelByteString
-
@Immutable public final class CelByteString extends java.lang.ObjectCelByteString is an immutable sequence of a byte array.
-
-
Field Summary
Fields Modifier and Type Field Description static CelByteStringEMPTY
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CelByteStringconcat(CelByteString other)static CelByteStringcopyFromUtf8(java.lang.String utf8String)booleanequals(java.lang.Object o)inthashCode()Note that we do not use Arrays.hashCode directly due to its implementation using 31 as an odd prime, which is outdated and is more prone to hash collisions.booleanisEmpty()booleanisValidUtf8()Checks if the byte array is a valid utf-8 encoded text.static CelByteStringof(byte[] buffer)intsize()byte[]toByteArray()java.lang.StringtoString()java.lang.StringtoStringUtf8()static java.util.Comparator<CelByteString>unsignedLexicographicalComparator()
-
-
-
Field Detail
-
EMPTY
public static final CelByteString EMPTY
-
-
Method Detail
-
of
public static CelByteString of(byte[] buffer)
-
copyFromUtf8
public static CelByteString copyFromUtf8(java.lang.String utf8String)
-
unsignedLexicographicalComparator
public static java.util.Comparator<CelByteString> unsignedLexicographicalComparator()
-
toStringUtf8
public java.lang.String toStringUtf8()
-
isValidUtf8
public boolean isValidUtf8()
Checks if the byte array is a valid utf-8 encoded text.
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
toByteArray
public byte[] toByteArray()
-
concat
public CelByteString concat(CelByteString other)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
Note that we do not use Arrays.hashCode directly due to its implementation using 31 as an odd prime, which is outdated and is more prone to hash collisions. This code is very similar to what AutoValue generates.- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-