Author: costin
Date: Wed Apr 23 07:26:35 2008
New Revision: 650886
URL: http://svn.apache.org/viewvc?rev=650886&view=rev
Log:
Add appendable
Modified:
tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/MessageBytes.java
(contents, props changed)
Modified:
tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/MessageBytes.java
URL:
http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/MessageBytes.java?rev=650886&r1=650885&r2=650886&view=diff
==============================================================================
---
tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/MessageBytes.java
(original)
+++
tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/MessageBytes.java
Wed Apr 23 07:26:35 2008
@@ -514,6 +514,33 @@
return upper.indexOf( sU, starting );
}
+ public int indexOfIgnoreCase(CharSequence src, int myOff ) {
+ // Adapted from nio connector
+ CharSequence my = getCharSequence();
+ int myLen = my.length();
+
+ char first = Character.toLowerCase(src.charAt(0));
+ int srcLen = src.length();
+
+ for (int i = myOff; i <= (myLen - srcLen); i++ ) {
+ char c = Character.toLowerCase(my.charAt(i));
+ if (c != first ) continue;
+ // found first char, now look for a match
+ int myPos = i + 1;
+ for (int srcPos = 1; srcPos < srcLen; ) {
+ c = Character.toLowerCase(src.charAt(i));
+ char d = Character.toLowerCase(my.charAt(myPos++));
+ if (c != d) {
+ break;
+ }
+ if( srcPos == srcLen ) {
+ return i; // found it
+ }
+ }
+ }
+ return -1;
+ }
+
/**
* Returns true if the message bytes starts with the specified string.
* @param c the character
@@ -757,20 +784,11 @@
}
public char charAt(int index) {
- switch (type) {
- case T_STR:
- return strValue.charAt(index);
- case T_CHARS:
- return charC.charAt(index);
- case T_BYTES:
- return byteC.charAt(index);
- default:
- throw new ArrayIndexOutOfBoundsException();
- }
+ return getCharSequence().charAt(index);
}
public int length() {
- return getLength();
+ return getLength();
}
public CharSequence subSequence(int start, int end) {
@@ -790,5 +808,18 @@
throw new ArrayIndexOutOfBoundsException();
}
return result;
+ }
+
+ public CharSequence getCharSequence() {
+ switch (type) {
+ case T_STR:
+ return strValue;
+ case T_CHARS:
+ return charC;
+ case T_BYTES:
+ return byteC;
+ default:
+ return null;
+ }
}
}
Propchange:
tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/MessageBytes.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]