org.apache.commons.httpclient
Class ChunkedInputStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--org.apache.commons.httpclient.ChunkedInputStream

public class ChunkedInputStream
extends java.io.InputStream

Transparently coalesces chunks of a HTTP stream that uses Transfer-Encoding chunked.

Since:
2.0
Author:
Ortwin Glück, Sean C. Sullivan
See Also:
ResponseInputStream

Constructor Summary
ChunkedInputStream(java.io.InputStream in, HttpMethod method)
           
 
Method Summary
 void close()
           
 int read()
          Returns all the data in a chunked stream in coalesced form.
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChunkedInputStream

public ChunkedInputStream(java.io.InputStream in,
                          HttpMethod method)
                   throws java.io.IOException
Parameters:
in - must be non-null
method - must be non-null
Throws:
java.io.IOException -  
java.lang.NullPointerException -  
Method Detail

read

public int read()
         throws java.io.IOException
Returns all the data in a chunked stream in coalesced form. A chunk is followed by a CRLF. The method returns -1 as soon as a chunksize of 0 is detected. Footers are read automcatically at the end of the stream and can be obtained with the getFooters() method.
Overrides:
read in class java.io.InputStream
Returns:
-1 of the end of the stream has been reached or the next data byte
Throws:
java.io.IOException -  

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream

read

public int read(byte[] b)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream

close

public void close()
           throws java.io.IOException
Overrides:
close in class java.io.InputStream


Copyright (c) 2001 - Apache Software Foundation