org.w3c.www.http
Class ChunkedInputStream
java.lang.Object
java.io.InputStream
org.w3c.www.http.ChunkedInputStream
- All Implemented Interfaces:
- java.io.Closeable
public class ChunkedInputStream
- extends java.io.InputStream
A Stream that parses and present chunk encoded data.
This stream should only be used on top of a buffered input stream, it might
be very inefficient otherwise.
Chunk encoding is defined in version 1.1 of the HTTP specification.
Method Summary |
int |
available()
|
void |
close()
|
void |
finalize()
Make sure the stream is ultimately closed ! |
protected int |
nextChunk(boolean skipCRLF)
Read in next chunk description. |
int |
read()
|
int |
read(byte[] b,
int off,
int len)
|
long |
skip(long n)
|
Methods inherited from class java.io.InputStream |
mark, markSupported, read, reset |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
in
protected java.io.InputStream in
buf
protected org.w3c.www.http.HttpBuffer buf
ps
protected org.w3c.www.http.ParseState ps
inited
protected boolean inited
clen
protected int clen
ahead
protected int ahead
isahead
protected boolean isahead
eof
protected boolean eof
observer
protected HttpStreamObserver observer
ChunkedInputStream
public ChunkedInputStream(java.io.InputStream in)
throws java.io.IOException
- Throws:
java.io.IOException
ChunkedInputStream
public ChunkedInputStream(HttpStreamObserver observer,
java.io.InputStream in)
throws java.io.IOException
- Throws:
java.io.IOException
nextChunk
protected int nextChunk(boolean skipCRLF)
throws java.io.IOException
- Read in next chunk description.
Sets the eof flag to true when reached.
- Returns:
- The length of next incomming chunk of data.
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close
in interface java.io.Closeable
- Overrides:
close
in class java.io.InputStream
- Throws:
java.io.IOException
read
public int read()
throws java.io.IOException
- Specified by:
read
in class java.io.InputStream
- 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
- Throws:
java.io.IOException
available
public int available()
throws java.io.IOException
- Overrides:
available
in class java.io.InputStream
- Throws:
java.io.IOException
skip
public long skip(long n)
throws java.io.IOException
- Overrides:
skip
in class java.io.InputStream
- Throws:
java.io.IOException
finalize
public void finalize()
- Make sure the stream is ultimately closed !
- Overrides:
finalize
in class java.lang.Object