remm 2003/01/14 10:20:02
Modified: util/java/org/apache/tomcat/util/buf ByteChunk.java
CharChunk.java
Log:
- Add alternate substract methods.
Revision Changes Path
1.13 +22 -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.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ByteChunk.java 5 Jan 2003 11:22:16 -0000 1.12
+++ ByteChunk.java 14 Jan 2003 18:20:02 -0000 1.13
@@ -377,6 +377,8 @@
throws IOException {
if ((end - start) == 0) {
+ if (in == null)
+ return -1;
int n = in.realReadBytes( buff, 0, buff.length );
if (n < 0)
return -1;
@@ -386,10 +388,30 @@
}
+ public int substract(ByteChunk src)
+ throws IOException {
+
+ if ((end - start) == 0) {
+ if (in == null)
+ return -1;
+ int n = in.realReadBytes( buff, 0, buff.length );
+ if (n < 0)
+ return -1;
+ }
+
+ int len = getLength();
+ src.append(buff, start, len);
+ start = end;
+ return len;
+
+ }
+
public int substract( byte src[], int off, int len )
throws IOException {
if ((end - start) == 0) {
+ if (in == null)
+ return -1;
int n = in.realReadBytes( buff, 0, buff.length );
if (n < 0)
return -1;
1.6 +22 -0
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/CharChunk.java
Index: CharChunk.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/CharChunk.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- CharChunk.java 5 Jan 2003 11:22:16 -0000 1.5
+++ CharChunk.java 14 Jan 2003 18:20:02 -0000 1.6
@@ -403,6 +403,8 @@
throws IOException {
if ((end - start) == 0) {
+ if (in == null)
+ return -1;
int n = in.realReadChars(buff, 0, buff.length);
if (n < 0)
return -1;
@@ -412,10 +414,30 @@
}
+ public int substract(CharChunk src)
+ throws IOException {
+
+ if ((end - start) == 0) {
+ if (in == null)
+ return -1;
+ int n = in.realReadChars( buff, 0, buff.length );
+ if (n < 0)
+ return -1;
+ }
+
+ int len = getLength();
+ src.append(buff, start, len);
+ start = end;
+ return len;
+
+ }
+
public int substract( char src[], int off, int len )
throws IOException {
if ((end - start) == 0) {
+ if (in == null)
+ return -1;
int n = in.realReadChars( buff, 0, buff.length );
if (n < 0)
return -1;
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>