org.apache.qpid.framing
Class AMQShortString

java.lang.Object
  extended by 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.


Field Summary
static AMQShortString EMPTY_STRING
           
 
Constructor Summary
AMQShortString(byte[] data)
           
AMQShortString(byte[] data, int pos)
           
AMQShortString(char[] data)
           
AMQShortString(CharSequence charSequence)
           
AMQShortString(String data)
           
 
Method Summary
 char[] asChars()
           
 String asString()
           
 char charAt(int index)
           
 int compareTo(AMQShortString name)
           
 boolean contains(byte b)
           
 boolean endsWith(AMQShortString otherString)
           
 boolean endsWith(String s)
           
 boolean equals(AMQShortString otherString)
           
 boolean equals(CharSequence s)
           
 boolean equals(Object o)
           
 byte[] getBytes()
           
 int hashCode()
           
 AMQShortString intern()
           
static AMQShortString join(Collection<AMQShortString> terms, AMQShortString delim)
           
 int length()
          Get the length of the short string
static void main(String[] args)
           
static AMQShortString readFromBuffer(org.apache.mina.common.ByteBuffer buffer)
           
static AMQShortString readFromByteArray(byte[] byteEncodedDestination, int pos)
           
 void setDirty()
           
 AMQShortString shrink()
           
 boolean startsWith(AMQShortString otherString)
           
 boolean startsWith(CharSequence otherString)
           
 boolean startsWith(String s)
           
 CharSequence subSequence(int start, int end)
           
 int toIntValue()
           
 AMQShortStringTokenizer tokenize(byte delim)
           
 String toString()
           
static AMQShortString valueOf(Object obj)
           
 void writeToBuffer(org.apache.mina.common.ByteBuffer buffer)
           
 int writeToByteArray(byte[] encoding, int pos)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_STRING

public static final AMQShortString EMPTY_STRING
Constructor Detail

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)
Method Detail

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