keith 02/04/23 12:44:14
Modified: util/java/org/apache/tomcat/util/buf ByteChunk.java
Log:
Add startsWith(byte[]) for use by DecoderInterceptor
Revision Changes Path
1.10 +18 -0
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/ByteChunk.java
Index: ByteChunk.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/ByteChunk.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ByteChunk.java 16 Mar 2002 06:37:46 -0000 1.9
+++ ByteChunk.java 23 Apr 2002 19:44:14 -0000 1.10
@@ -549,6 +549,24 @@
return true;
}
+ /* Returns true if the message bytes start with the specified byte array */
+ public boolean startsWith(byte[] b2) {
+ byte[] b1 = buff;
+ if (b1 == null && b2 == null) {
+ return true;
+ }
+
+ int len = end - start;
+ if (b2.length > len || b1 == null || b2 == null) {
+ return false;
+ }
+ for (int i = start, j = 0; i < end && j < b2.length; ) {
+ if (b1[i++] != b2[j++])
+ return false;
+ }
+ return true;
+ }
+
/**
* Returns true if the message bytes starts with the specified string.
* @param s the string
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>