public final class MessageBytes
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
MessageBytes.MessageBytesFactory |
Modifier and Type | Field and Description |
---|---|
static int |
T_BYTES
getType() is T_BYTES if the the object used to create the MessageBytes
was a byte[]
|
static int |
T_CHARS
getType() is T_CHARS if the the object used to create the MessageBytes
was a char[]
|
static int |
T_NULL |
static int |
T_STR
getType() is T_STR if the the object used to create the MessageBytes
was a String
|
Modifier and Type | Method and Description |
---|---|
void |
duplicate(MessageBytes src)
Copy the src into this MessageBytes, allocating more space if needed.
|
boolean |
equals(MessageBytes mb) |
boolean |
equals(java.lang.Object obj) |
boolean |
equals(java.lang.String s)
Compares the message bytes to the specified String object.
|
boolean |
equalsIgnoreCase(java.lang.String s)
Compares the message bytes to the specified String object.
|
ByteChunk |
getByteChunk()
Returns the byte chunk, representing the byte[] and offset/length.
|
CharChunk |
getCharChunk()
Returns the char chunk, representing the char[] and offset/length.
|
java.nio.charset.Charset |
getCharset() |
MessageBytes |
getClone()
Deprecated.
Unused. Will be removed in Tomcat 8.0.x onwards.
|
int |
getInt()
Deprecated.
Unused. Will be removed in Tomcat 8.0.x onwards.
|
int |
getLength()
Returns the length of the original buffer.
|
long |
getLong()
Convert the buffer to an long, cache the value.
|
java.lang.String |
getString()
Returns the string value.
|
int |
getType()
Return the type of the original content.
|
int |
hashCode() |
int |
indexOf(char c)
Deprecated.
Unused. Will be removed in Tomcat 8.0.x onwards.
|
int |
indexOf(char c,
int starting)
Deprecated.
Unused. Will be removed in Tomcat 8.0.x onwards.
|
int |
indexOf(java.lang.String s) |
int |
indexOf(java.lang.String s,
int starting) |
int |
indexOfIgnoreCase(java.lang.String s,
int starting) |
boolean |
isNull() |
static MessageBytes |
newInstance()
Construct a new MessageBytes instance.
|
void |
recycle()
Resets the message bytes to an uninitialized (NULL) state.
|
void |
setBytes(byte[] b,
int off,
int len)
Sets the content to the specified subarray of bytes.
|
void |
setChars(char[] c,
int off,
int len)
Sets the content to be a char[]
|
void |
setCharset(java.nio.charset.Charset charset)
Set the Charset used for string<->byte conversions.
|
static void |
setFactory(MessageBytes.MessageBytesFactory mbf)
Deprecated.
Unused. Will be removed in Tomcat 8.0.x onwards.
|
void |
setInt(int i)
Deprecated.
Unused. Will be removed in Tomcat 8.0.x onwards.
|
void |
setLong(long l)
Set the buffer to the representation of a long.
|
void |
setString(java.lang.String s)
Set the content to be a string
|
boolean |
startsWith(java.lang.String s)
Deprecated.
Unused. Will be removed in Tomcat 8.0.x onwards.
|
boolean |
startsWithIgnoreCase(java.lang.String s,
int pos) |
void |
toBytes()
Do a char->byte conversion.
|
void |
toChars()
Convert to char[] and fill the CharChunk.
|
java.lang.String |
toString()
Compute the string value.
|
public static final int T_NULL
public static final int T_STR
public static final int T_BYTES
public static final int T_CHARS
public static MessageBytes newInstance()
@Deprecated public MessageBytes getClone()
Object.clone()
public boolean isNull()
public void recycle()
public void setBytes(byte[] b, int off, int len)
b
- the bytesoff
- the start offset of the byteslen
- the length of the bytespublic void setChars(char[] c, int off, int len)
c
- the charsoff
- the start offset of the charslen
- the length of the charspublic void setString(java.lang.String s)
s
- The stringpublic java.lang.String toString()
toString
in class java.lang.Object
public int getType()
public ByteChunk getByteChunk()
public CharChunk getCharChunk()
public java.lang.String getString()
public java.nio.charset.Charset getCharset()
public void setCharset(java.nio.charset.Charset charset)
charset
- The charsetpublic void toBytes()
public void toChars()
public int getLength()
public boolean equals(java.lang.String s)
s
- the String to comparetrue
if the comparison succeeded, false
otherwisepublic boolean equalsIgnoreCase(java.lang.String s)
s
- the String to comparetrue
if the comparison succeeded, false
otherwisepublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public boolean equals(MessageBytes mb)
@Deprecated public boolean startsWith(java.lang.String s)
s
- the stringpublic boolean startsWithIgnoreCase(java.lang.String s, int pos)
s
- the stringpos
- The start positiontrue
if the message bytes starts with the specified string.public int hashCode()
hashCode
in class java.lang.Object
@Deprecated public int indexOf(char c)
c
- the characterpublic int indexOf(java.lang.String s, int starting)
public int indexOf(java.lang.String s)
public int indexOfIgnoreCase(java.lang.String s, int starting)
@Deprecated public int indexOf(char c, int starting)
c
- the characterstarting
- The start positionpublic void duplicate(MessageBytes src) throws java.io.IOException
src
- The sourcejava.io.IOException
- Writing overflow data to the output channel failed@Deprecated public void setInt(int i)
i
- The intpublic void setLong(long l)
l
- The long@Deprecated public int getInt()
public long getLong()
@Deprecated public static void setFactory(MessageBytes.MessageBytesFactory mbf)
mbf
- New factory for MessageByte instancesCopyright © 2000-2020 Apache Software Foundation. All Rights Reserved.