Package org.apache.qpid.protonj2.types
Class Symbol
- java.lang.Object
-
- org.apache.qpid.protonj2.types.Symbol
-
- All Implemented Interfaces:
java.lang.Comparable<Symbol>
public final class Symbol extends java.lang.Object implements java.lang.Comparable<Symbol>
Class that represents an AMQP Symbol value. The creation of a Symbol object occurs during a lookup operation which cannot find an already stored version of the string or byte buffer view of the Symbol's ASCII bytes.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Symbol other)booleanequals(java.lang.Object other)intgetLength()static SymbolgetSymbol(java.lang.String stringValue)static SymbolgetSymbol(ProtonBuffer symbolBytes)static SymbolgetSymbol(ProtonBuffer symbolBuffer, boolean copyOnCreate)inthashCode()java.lang.StringtoString()static SymbolvalueOf(java.lang.String symbolVal)voidwriteTo(ProtonBuffer target)Writes the internalSymbolbytes to the providedProtonBuffer.
-
-
-
Method Detail
-
getLength
public int getLength()
- Returns:
- the number of bytes that comprise the Symbol value.
-
compareTo
public int compareTo(Symbol other)
- Specified by:
compareToin interfacejava.lang.Comparable<Symbol>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
writeTo
public void writeTo(ProtonBuffer target)
Writes the internalSymbolbytes to the providedProtonBuffer. This is a raw ASCII encoding of the Symbol without and AMQP type encoding.- Parameters:
target- The buffer where the Symbol bytes should be written to.
-
valueOf
public static Symbol valueOf(java.lang.String symbolVal)
-
getSymbol
public static Symbol getSymbol(ProtonBuffer symbolBytes)
-
getSymbol
public static Symbol getSymbol(ProtonBuffer symbolBuffer, boolean copyOnCreate)
- Parameters:
symbolBuffer- TheProtonBufferversion of theSymbolvalue.copyOnCreate- Should the provided buffer be copied during creation of a newSymbol.- Returns:
- a
Symbolthat matches the givenString.
-
-