Method from org.apache.tomcat.util.MessageString Detail: |
public boolean equals(String s) {
return str != null ? str.equals(s) : super.equals(s);
}
Compares this message string to the specified String object. |
public boolean equals(byte[] b,
int off,
int len) {
if (str != null) {
String s = str;
if (len != s.length()) {
return false;
}
for (int i = 0; i < len; i++) {
if (b[off++] != s.charAt(i)) {
return false;
}
}
return true;
}
return super.equals(b, off, len);
}
Compares this message string to the specified subarray of bytes. |
public boolean equalsIgnoreCase(String s) {
return str != null ? str.equalsIgnoreCase(s) : super.equalsIgnoreCase(s);
}
Compares this message string to the specified String object. Case is
ignored in the comparison. |
public boolean equalsIgnoreCase(byte[] b,
int off,
int len) {
if (str != null) {
String s = str;
if (len != s.length()) {
return false;
}
for (int i = 0; i < len; i++) {
if (toLower(b[off++]) != toLower(s.charAt(i))) {
return false;
}
}
return true;
}
return super.equalsIgnoreCase(b, off, len);
}
Compares this message string to the specified subarray of bytes.
Case is ignored in the comparison. |
public int getBytes(byte[] buf,
int buf_offset) {
if (str != null) {
int len = str.length();
// deprecated line (kept for reference)
//str.getBytes(0, len, buf, buf_offset);
byte[] strBytes = str.getBytes();
System.arraycopy(strBytes, 0, buf, buf_offset, len);
return len;
}
else {
return super.getBytes(buf, buf_offset);
}
}
Get the bytes of this message string in buf starting at buf_offset. |
public boolean isSet() {
return str != null || super.isSet();
}
Returns true if the message string is set. |
public int length() {
return str != null ? str.length() : super.length();
}
Returns the length of the message string. |
public void reset() {
super.reset();
str = null;
}
Resets the message string to an uninitialized state. |
public void setBytes(byte[] b,
int off,
int len) {
super.setBytes(b, off, len);
str = null;
}
Sets the message string to the specified bytes. |
public void setString(String s) {
super.reset();
str = s;
}
Sets the message string to the specified String. |
public boolean startsWith(String s) {
return str != null ? str.startsWith(s) : super.startsWith(s);
}
Returns true if the message string starts with the specified string. |
public long toDate(HttpDate d) throws IllegalArgumentException {
if (str != null) {
d.parse(str);
return d.getTime();
} else {
return super.toDate(d);
}
}
Returns the message string parsed as a date. |
public int toInteger() throws NumberFormatException {
return str != null ? Integer.parseInt(str) : super.toInteger();
}
Returns the message string parsed as an unsigned integer. |
public String toString() {
return str != null ? str : super.toString();
}
Returns the message string as a String object. |
public void write(ServletOutputStream out) throws IOException {
if (str != null) {
out.print(str);
} else {
super.write(out);
}
}
Writes the message string to the specified servlet output stream. |