--- xwt-0706.orig/src/org/xwt/HTTP.java 2003-04-09 19:47:28.000000000 -0400 +++ xwt-0706/src/org/xwt/HTTP.java 2003-05-23 10:44:55.000000000 -0400 @@ -521,6 +521,58 @@ } } + // This could be optimized, but it probably isn't called much + public int read() throws IOException { + byte[] b = new byte[1]; + int ret = read(b,0,1); + return ret == -1 ? -1 : b[0]&0xff; + } + + public int read(byte[] b) throws IOException { + return read(b,0,b.length); + } + + public long skip(long n) throws IOException { + boolean good = false; + if(length == 0 && contentLength == -1) { + readChunk(); + if(chunkedDone) return 0; + } else if(length == 0) { + return 0; + } + if(n > length) n = length; + try { + long ret = in.skip(n); + length -= (int)ret; + good = true; + return ret; + } finally { + if(!good) invalid = true; + } + } + + public int available() throws IOException { + boolean good = false; + if(length == 0 && contentLength == -1) { + readChunk(); + if(chunkedDone) return 0; + } else if(length == 0) { + return 0; + } + try { + int ret = in.available(); + good = true; + if(ret > length) ret = length; + return ret; + } finally { + if(!good) invalid = true; + } + } + + public boolean markSupported() { + return false; + } + public void close() throws IOException { if (contentLength == -1) { while(!chunkedDone) {