2003/10/16 05:46:24
authorbrian <brian@xwt.org>
Fri, 30 Jan 2004 07:39:24 +0000 (07:39 +0000)
committerbrian <brian@xwt.org>
Fri, 30 Jan 2004 07:39:24 +0000 (07:39 +0000)
darcs-hash:20040130073924-aa32f-7eb779c2b50870239dd1caeaaa2da46dcd0e3f4f.gz

src/org/xwt/util/CachedInputStream.java

index 1c2cffd..fdf8a78 100644 (file)
@@ -41,7 +41,7 @@ public class CachedInputStream {
         public int read() throws IOException {                                       // FEATURE: be smarter here
             byte[] b = new byte[1];
             int ret = read(b, 0, 1);
-            return ret == -1 ? -1 : b[0];
+            return ret == -1 ? -1 : b[0]&0xff;
         }
         public int read(byte[] b, int off, int len) throws IOException {
             synchronized(CachedInputStream.this) {
@@ -49,6 +49,7 @@ public class CachedInputStream {
                 if (eof && pos == size) return -1;
                 int count = Math.min(size - pos, len);
                 System.arraycopy(cache, pos, b, off, count);
+                pos += count;
                 return count;
             }
         }