// HTTPInputStream ///////////////////////////////////////////////////////////////////////////////////
/** An input stream that represents a subset of a longer input stream. Supports HTTP chunking as well */
- public class HTTPInputStream extends FilterInputStream {
+ public class HTTPInputStream extends FilterInputStream implements KnownLength {
/** if chunking, the number of bytes remaining in this subset; otherwise the remainder of the chunk */
private int length = 0;
this.length = length == -1 ? 0 : length;
}
+ public int getLength() { return contentLength; }
public boolean markSupported() { return false; }
public int read(byte[] b) throws IOException { return read(b, 0, b.length); }
public long skip(long n) throws IOException { return read(null, -1, (int)n); }