Author: norman
Date: Mon May 10 19:57:50 2010
New Revision: 942879
URL: http://svn.apache.org/viewvc?rev=942879&view=rev
Log:
FixedLengthInputStream was not handling counting correctly in all cases
Modified:
james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/base/FixedLengthInputStream.java
Modified:
james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/base/FixedLengthInputStream.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/base/FixedLengthInputStream.java?rev=942879&r1=942878&r2=942879&view=diff
==============================================================================
---
james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/base/FixedLengthInputStream.java
(original)
+++
james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/base/FixedLengthInputStream.java
Mon May 10 19:57:50 2010
@@ -49,6 +49,12 @@ public class FixedLengthInputStream exte
}
public int read(byte b[]) throws IOException {
+
+ return read(b, 0, b.length);
+ }
+
+ public int read(byte b[], int off, int len) throws IOException {
+
if (pos >= length) {
return -1;
@@ -58,21 +64,13 @@ public class FixedLengthInputStream exte
int readLimit = (int) length - (int) pos;
pos = length;
- return super.read(b, 0, readLimit);
+ return super.read(b, off, readLimit);
}
pos += b.length;
- return super.read(b);
- }
-
- public int read(byte b[], int off, int len) throws IOException {
- byte[] tmpArray = new byte[len];
- int a = in.read(tmpArray);
- for (int i = 0; i < tmpArray.length; i++) {
- b[off + i] = tmpArray[i];
- }
- return a;
+ return super.read(b, off, len);
+
}
public long skip(long n) throws IOException {
@@ -88,7 +86,7 @@ public class FixedLengthInputStream exte
// Don't do anything to the underlying stream.
}
- public synchronized void mark(int readlimit) {
+ public void mark(int readlimit) {
// Don't do anything.
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]