org.apache.qpid.framing
Class AMQShortString
java.lang.Object
org.apache.qpid.framing.AMQShortString
- All Implemented Interfaces:
- CharSequence, Comparable<AMQShortString>
public final class AMQShortString
- extends Object
- implements CharSequence, Comparable<AMQShortString>
A short string is a representation of an AMQ Short String
Short strings differ from the Java String class by being limited to on ASCII characters (0-127)
and thus can be held more effectively in a byte buffer.
EMPTY_STRING
public static final AMQShortString EMPTY_STRING
AMQShortString
public AMQShortString(byte[] data)
AMQShortString
public AMQShortString(byte[] data,
int pos)
AMQShortString
public AMQShortString(String data)
AMQShortString
public AMQShortString(char[] data)
AMQShortString
public AMQShortString(CharSequence charSequence)
shrink
public AMQShortString shrink()
length
public int length()
- Get the length of the short string
- Specified by:
length
in interface CharSequence
- Returns:
- length of the underlying byte array
charAt
public char charAt(int index)
- Specified by:
charAt
in interface CharSequence
subSequence
public CharSequence subSequence(int start,
int end)
- Specified by:
subSequence
in interface CharSequence
writeToByteArray
public int writeToByteArray(byte[] encoding,
int pos)
readFromByteArray
public static AMQShortString readFromByteArray(byte[] byteEncodedDestination,
int pos)
readFromBuffer
public static AMQShortString readFromBuffer(org.apache.mina.common.ByteBuffer buffer)
getBytes
public byte[] getBytes()
writeToBuffer
public void writeToBuffer(org.apache.mina.common.ByteBuffer buffer)
endsWith
public boolean endsWith(String s)
endsWith
public boolean endsWith(AMQShortString otherString)
startsWith
public boolean startsWith(String s)
startsWith
public boolean startsWith(AMQShortString otherString)
startsWith
public boolean startsWith(CharSequence otherString)
asChars
public char[] asChars()
asString
public String asString()
equals
public boolean equals(Object o)
- Overrides:
equals
in class Object
equals
public boolean equals(AMQShortString otherString)
equals
public boolean equals(CharSequence s)
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
setDirty
public void setDirty()
toString
public String toString()
- Specified by:
toString
in interface CharSequence
- Overrides:
toString
in class Object
compareTo
public int compareTo(AMQShortString name)
- Specified by:
compareTo
in interface Comparable<AMQShortString>
tokenize
public AMQShortStringTokenizer tokenize(byte delim)
intern
public AMQShortString intern()
join
public static AMQShortString join(Collection<AMQShortString> terms,
AMQShortString delim)
toIntValue
public int toIntValue()
contains
public boolean contains(byte b)
valueOf
public static AMQShortString valueOf(Object obj)
main
public static void main(String[] args)
Licensed to the Apache Software Foundation