public final class SimpleString extends Object implements CharSequence, Serializable, Comparable<SimpleString>
byte[]
, this
minimises expensive copying between String objects.
This object is used heavily throughout HornetQ for performance reasons.Constructor and Description |
---|
SimpleString(byte[] data)
creates a SimpleString from a byte array
|
SimpleString(String string)
creates a SimpleString from a conventional String
|
Modifier and Type | Method and Description |
---|---|
char |
charAt(int pos) |
int |
compareTo(SimpleString o) |
SimpleString |
concat(char c)
Concatenates a SimpleString and a char
|
SimpleString |
concat(SimpleString toAdd)
Concatenates 2 SimpleString's
|
SimpleString |
concat(String toAdd)
Concatenates a SimpleString and a String
|
boolean |
contains(char c)
checks to see if this SimpleString contains the char parameter passed in
|
boolean |
equals(Object other) |
void |
getChars(int srcBegin,
int srcEnd,
char[] dst,
int dstPos)
This method performs a similar function to
String.getChars(int, int, char[], int) . |
byte[] |
getData()
returns the underlying byte array of this SimpleString
|
int |
hashCode() |
int |
length() |
int |
sizeof()
returns the size of this SimpleString
|
static int |
sizeofNullableString(SimpleString str)
returns the size of a SimpleString which could be null
|
static int |
sizeofString(SimpleString str)
returns the size of a SimpleString
|
SimpleString[] |
split(char delim)
Splits this SimpleString into an array of SimpleString using the char param as the delimiter.
|
boolean |
startsWith(SimpleString other)
returns true if the SimpleString parameter starts with the same data as this one.
|
CharSequence |
subSequence(int start,
int end) |
static SimpleString |
toSimpleString(String string)
Returns a SimpleString constructed from the
string parameter. |
String |
toString() |
public SimpleString(String string)
string
- the string to transformpublic SimpleString(byte[] data)
data
- the byte array to usepublic static SimpleString toSimpleString(String string)
string
parameter.
If string
is null
, the return value will be null
too.string
- String used to instantiate a SimpleString.public int length()
length
in interface CharSequence
public char charAt(int pos)
charAt
in interface CharSequence
public CharSequence subSequence(int start, int end)
subSequence
in interface CharSequence
public int compareTo(SimpleString o)
compareTo
in interface Comparable<SimpleString>
public byte[] getData()
public boolean startsWith(SimpleString other)
other
- the SimpelString to look forpublic String toString()
toString
in interface CharSequence
toString
in class Object
public SimpleString[] split(char delim)
delim
- public boolean contains(char c)
c
- the char to check forpublic SimpleString concat(String toAdd)
toAdd
- the String to concatenate with.public SimpleString concat(SimpleString toAdd)
toAdd
- the SimpleString to concatenate with.public SimpleString concat(char c)
c
- the char to concate with.public int sizeof()
public static int sizeofString(SimpleString str)
str
- the SimpleString to checkpublic static int sizeofNullableString(SimpleString str)
str
- the SimpleString to checkpublic void getChars(int srcBegin, int srcEnd, char[] dst, int dstPos)
String.getChars(int, int, char[], int)
.
This is mainly used by the Parsers on FilterssrcBegin
- srcEnd
- dst
- dstPos
- Copyright © 2018 JBoss by Red Hat. All rights reserved.