|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tomcat.util.buf.MessageBytes
public final class MessageBytes
This class is used to represent a subarray of bytes in an HTTP message. It represents all request/response elements. The byte/char conversions are delayed and cached. Everything is recyclable. The object can represent a byte[], a char[], or a (sub) String. All operations can be made in case sensitive mode or not.
Nested Class Summary | |
---|---|
static class |
MessageBytes.MessageBytesFactory
|
Field Summary | |
---|---|
static int |
T_BYTES
getType() is T_STR if the the object used to create the MessageBytes was a byte[] |
static int |
T_CHARS
getType() is T_STR 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 |
Method Summary | |
---|---|
void |
duplicate(MessageBytes src)
Copy the src into this MessageBytes, allocating more space if needed |
boolean |
equals(MessageBytes mb)
|
boolean |
equals(Object obj)
|
boolean |
equals(String s)
Compares the message bytes to the specified String object. |
boolean |
equalsIgnoreCase(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. |
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 |
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(String s)
|
int |
indexOf(String s,
int starting)
|
int |
indexOfIgnoreCase(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(Charset charset)
Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards. |
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 an long |
void |
setString(String s)
Set the content to be a string |
boolean |
startsWith(String s)
Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards. |
boolean |
startsWithIgnoreCase(String s,
int pos)
Returns true if the message bytes starts with the specified string. |
void |
toBytes()
Do a char->byte conversion. |
void |
toChars()
Convert to char[] and fill the CharChunk. |
String |
toString()
Compute the string value |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int T_NULL
public static final int T_STR
public static final int T_BYTES
public static final int T_CHARS
Method Detail |
---|
public static MessageBytes newInstance()
@Deprecated public MessageBytes getClone()
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 bytes@Deprecated public void setCharset(Charset charset)
public void setChars(char[] c, int off, int len)
c
- the bytesoff
- the start offset of the byteslen
- the length of the bytespublic void setString(String s)
public String toString()
toString
in class Object
public int getType()
public ByteChunk getByteChunk()
public CharChunk getCharChunk()
public String getString()
public void toBytes()
public void toChars()
public int getLength()
public boolean equals(String s)
s
- the String to compare
public boolean equalsIgnoreCase(String s)
s
- the String to compare
public boolean equals(Object obj)
equals
in class Object
public boolean equals(MessageBytes mb)
@Deprecated public boolean startsWith(String s)
s
- the stringpublic boolean startsWithIgnoreCase(String s, int pos)
s
- the stringpos
- The start positionpublic int hashCode()
hashCode
in class Object
@Deprecated public int indexOf(char c)
public int indexOf(String s, int starting)
public int indexOf(String s)
public int indexOfIgnoreCase(String s, int starting)
@Deprecated public int indexOf(char c, int starting)
c
- the characterstarting
- The start positionpublic void duplicate(MessageBytes src) throws IOException
IOException
@Deprecated public void setInt(int i)
public void setLong(long l)
@Deprecated public int getInt()
public long getLong()
@Deprecated public static void setFactory(MessageBytes.MessageBytesFactory mbf)
|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |