From 30bafaaa4699c0dfdc88f0e5e5e0baebb0164cdd Mon Sep 17 00:00:00 2001 From: megacz Date: Fri, 30 Jan 2004 07:01:04 +0000 Subject: [PATCH] 2003/06/12 18:06:59 darcs-hash:20040130070104-2ba56-14a05cd9ca14488b0bfcffe117f1b1ea919b6c91.gz --- src/org/xwt/HTTP.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/org/xwt/HTTP.java b/src/org/xwt/HTTP.java index e401f86..94ad19a 100644 --- a/src/org/xwt/HTTP.java +++ b/src/org/xwt/HTTP.java @@ -484,6 +484,20 @@ public class HTTP { this.length = length == -1 ? 0 : length; } + public void markSupported() { return false; } + public int read(byte[] b) throws IOException { return read(b, 0, b.length); } + public long skip(long n) { return read(null, -1, (int)n); } + public int available() { + if (contentLength == -1) return Math.min(super.available(), length); + return super.available(); + } + + public int read() throws IOException { + byte[] b = new byte[1]; + int ret = read(b, 0, 1); + return ret == -1 ? -1 : b[0] & 0xff; + } + private void readChunk() throws IOException { if (chunkedDone) return; if (!firstChunk) super.skip(2); // CRLF @@ -515,7 +529,7 @@ public class HTTP { if (length == 0) { good = true; return -1; } } if (len > length) len = length; - int ret = super.read(b, off, len); + int ret = b == null ? super.skip(len) : super.read(b, off, len); if (ret >= 0) { length -= ret; good = true; -- 1.7.10.4