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 ActiveMQ Artemis for performance reasons.
| Modifier and Type | Class and Description |
|---|---|
static class |
SimpleString.ByteBufSimpleStringPool |
static class |
SimpleString.StringSimpleStringPool |
| Constructor and Description |
|---|
SimpleString(byte[] data)
creates a SimpleString from a byte array
|
SimpleString(char c) |
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(io.netty.buffer.ByteBuf byteBuf,
int offset,
int length)
|
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() |
boolean |
isEmpty() |
int |
length() |
static SimpleString |
readNullableSimpleString(io.netty.buffer.ByteBuf buffer) |
static SimpleString |
readNullableSimpleString(io.netty.buffer.ByteBuf buffer,
SimpleString.ByteBufSimpleStringPool pool) |
static SimpleString |
readSimpleString(io.netty.buffer.ByteBuf buffer) |
static SimpleString |
readSimpleString(io.netty.buffer.ByteBuf buffer,
int length) |
static SimpleString |
readSimpleString(io.netty.buffer.ByteBuf buffer,
SimpleString.ByteBufSimpleStringPool pool) |
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.
|
SimpleString |
subSeq(int start,
int end) |
CharSequence |
subSequence(int start,
int end) |
static SimpleString |
toSimpleString(String string)
Returns a SimpleString constructed from the
string parameter. |
static SimpleString |
toSimpleString(String string,
SimpleString.StringSimpleStringPool pool) |
String |
toString() |
static void |
writeNullableSimpleString(io.netty.buffer.ByteBuf buffer,
SimpleString val) |
static void |
writeSimpleString(io.netty.buffer.ByteBuf buffer,
SimpleString val) |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitchars, codePointspublic SimpleString(String string)
string - the string to transformpublic SimpleString(byte[] data)
data - the byte array to usepublic SimpleString(char c)
public 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 static SimpleString toSimpleString(String string, SimpleString.StringSimpleStringPool pool)
public boolean isEmpty()
public int length()
length in interface CharSequencepublic char charAt(int pos)
charAt in interface CharSequencepublic CharSequence subSequence(int start, int end)
subSequence in interface CharSequencepublic static SimpleString readNullableSimpleString(io.netty.buffer.ByteBuf buffer)
public static SimpleString readNullableSimpleString(io.netty.buffer.ByteBuf buffer, SimpleString.ByteBufSimpleStringPool pool)
public static SimpleString readSimpleString(io.netty.buffer.ByteBuf buffer)
public static SimpleString readSimpleString(io.netty.buffer.ByteBuf buffer, SimpleString.ByteBufSimpleStringPool pool)
public static SimpleString readSimpleString(io.netty.buffer.ByteBuf buffer, int length)
public static void writeNullableSimpleString(io.netty.buffer.ByteBuf buffer,
SimpleString val)
public static void writeSimpleString(io.netty.buffer.ByteBuf buffer,
SimpleString val)
public SimpleString subSeq(int start, int end)
public int compareTo(SimpleString o)
compareTo in interface Comparable<SimpleString>public byte[] getData()
public boolean startsWith(SimpleString other)
other - the SimpleString to look forpublic String toString()
toString in interface CharSequencetoString in class Objectpublic boolean equals(io.netty.buffer.ByteBuf byteBuf,
int offset,
int length)
true if the SimpleString encoded content into bytes is equals to s,
false otherwise.
It assumes that the bytes content is read using readSimpleString(ByteBuf, int) ie starting right after the
length field.
public SimpleString[] split(char delim)
delim - The delimiter to split this SimpleString on.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 - The srcBeginsrcEnd - The srcEnddst - The destination arraydstPos - The destination positionCopyright © 2018 The Apache Software Foundation. All Rights Reserved.