org.mortbay.http
Class HttpInputStream
FilterInputStream
org.mortbay.http.HttpInputStream
public class HttpInputStream
extends FilterInputStream
HTTP Chunking InputStream.
This FilterInputStream acts as a BufferedInputStream until
setChunking(true) is called. Once chunking is
enabled, the raw stream is chunk decoded as per RFC2616.
The "8859-1" encoding is used on underlying LineInput instance for
line based reads from the raw stream.
This class is not synchronized and should be synchronized
explicitly if an instance is used by multiple threads.
$Id: HttpInputStream.java,v 1.13 2005/08/23 20:02:26 gregwilkins Exp $
HttpInputStream
public HttpInputStream(InputStream in)
Constructor.
HttpInputStream
public HttpInputStream(InputStream in,
int bufferSize)
Constructor.
close
public void close()
throws IOException
destroy
public void destroy()
getContentLength
public int getContentLength()
Get the content length.
- Number of bytes until EOF is returned or -1 for no limit.
getExpectContinues
public OutputStream getExpectContinues()
getFilterStream
public InputStream getFilterStream()
Get Filter InputStream.
Get the current top of the InputStream filter stack
getInputStream
public InputStream getInputStream()
Get the raw stream.
A stream without filters or chunking is returned. This stream
may still be buffered and uprocessed bytes may be in the buffer.
isChunking
public boolean isChunking()
Get chunking mode
read
public int read()
throws IOException
read
public int read(byte[] b)
throws IOException
read
public int read(byte[] b,
int off,
int len)
throws IOException
resetStream
public void resetStream()
throws IllegalStateException
Reset the stream.
Turn chunking off and disable all filters.
setChunking
public void setChunking()
throws IllegalStateException
Set chunking mode.
Chunking can only be turned off with a call to resetStream().
setContentLength
public void setContentLength(int len)
Set the content length.
Only this number of bytes can be read before EOF is returned.
setExpectContinues
public void setExpectContinues(OutputStream expectContinues)
expectContinues
- The expectContinues to set.
setFilterStream
public void setFilterStream(InputStream filter)
Set Filter InputStream.
Set input filter stream, which should be constructed to wrap
the stream returned from get FilterStream.
skip
public long skip(long n)
throws IOException
Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.