Method from org.apache.tomcat.util.MessageBytes Detail: |
public boolean equals(String s) {
byte[] b = bytes;
int len = length;
if (b == null || len != s.length()) {
return false;
}
int off = offset;
for (int i = 0; i < len; i++) {
if (b[off++] != s.charAt(i)) {
return false;
}
}
return true;
}
Compares the message bytes to the specified String object. |
public boolean equals(byte[] b,
int off,
int len) {
byte[] b1 = bytes;
if (b1 == null || len != length) {
return false;
}
int off1 = offset;
while (len-- > 0) {
if (b[off++] != b1[off1++]) {
return false;
}
}
return true;
}
Compares the message bytes to the specified subarray of bytes. |
public boolean equalsIgnoreCase(String s) {
byte[] b = bytes;
int len = length;
if (b == null || len != s.length()) {
return false;
}
int off = offset;
for (int i = 0; i < len; i++) {
if (toLower(b[off++]) != toLower((byte)s.charAt(i))) {
return false;
}
}
return true;
}
Compares the message bytes to the specified String object. Case is
ignored in the comparison. |
public boolean equalsIgnoreCase(byte[] b,
int off,
int len) {
byte[] b1 = bytes;
if (b1 == null || len != length) {
return false;
}
int off1 = offset;
while (len-- > 0) {
if (toLower(b[off++]) != toLower(b1[off1++])) {
return false;
}
}
return true;
}
Compares the message bytes to the specified subarray of bytes.
Case is ignored in the comparison. |
public byte[] getBytes() {
return bytes;
}
Returns the message bytes. |
public int getBytes(byte[] buf,
int buf_offset) {
if (bytes != null)
System.arraycopy(bytes, offset, buf, buf_offset, length);
return length;
}
Puts the message bytes in buf starting at buf_offset. |
public int getLength() {
return length;
}
Returns the length of the bytes. |
public int getOffset() {
return offset;
}
Returns the start offset of the bytes. |
public boolean isSet() {
return bytes != null;
}
Returns true if the message bytes have been set. |
public int length() {
return bytes != null ? length : 0;
}
Returns the length of the message bytes. |
public void reset() {
bytes = null;
}
Resets the message bytes to an uninitialized state. |
public void setBytes(byte[] b,
int off,
int len) {
bytes = b;
offset = off;
length = len;
}
Sets the message bytes to the specified subarray of bytes. |
public boolean startsWith(String s) {
byte[] b = bytes;
int len = s.length();
if (b == null || len > length) {
return false;
}
int off = offset;
for (int i = 0; i < len; i++) {
if (b[off++] != s.charAt(i)) {
return false;
}
}
return true;
}
Returns true if the message bytes starts with the specified string. |
public long toDate(HttpDate d) throws IllegalArgumentException {
if (bytes != null) {
d.parse(bytes, offset, length);
return d.getTime();
} else {
String msg = getSM().getString("messageBytes.iae", bytes);
throw new IllegalArgumentException(msg);
}
}
Returns the message bytes parsed as a date. |
public int toInteger() throws NumberFormatException {
return parseInt(bytes, offset, length);
}
Returns the message bytes parsed as an unsigned integer. |
public String toString() {
return bytes != null ? new String(bytes, offset, length) : null;
}
Returns the message bytes as a String object. |
public void write(OutputStream out) throws IOException {
if (bytes != null) {
out.write(bytes, offset, length);
}
}
Writes the message bytes to the specified output stream. |