org.w3c.www.http
Class ContentLengthInputStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--org.w3c.www.http.ContentLengthInputStream

public class ContentLengthInputStream
extends java.io.InputStream

The content length input stream is used internally to return entity bodies.


Field Summary
protected  java.io.InputStream in
          The original input stream.
protected  int length
          The number of bytes readable from the above stream.
protected  int marklength
          The place of a single pending mark.
protected  HttpStreamObserver observer
          The stream observer, if any.
 
Constructor Summary
ContentLengthInputStream(HttpStreamObserver observer, java.io.InputStream in, int length)
           
ContentLengthInputStream(java.io.InputStream in, int length)
          Builds a new content-length input stream.
 
Method Summary
 int available()
           
 void close()
           
 void finalize()
          Make sure the stream is ultimately closed !
 void mark(int readlimit)
           
 int read()
           
 int read(byte[] b, int off, int len)
           
 void reset()
           
 long skip(long n)
           
 
Methods inherited from class java.io.InputStream
markSupported, read
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in

protected java.io.InputStream in
The original input stream.

observer

protected HttpStreamObserver observer
The stream observer, if any.

length

protected int length
The number of bytes readable from the above stream.

marklength

protected int marklength
The place of a single pending mark.
Constructor Detail

ContentLengthInputStream

public ContentLengthInputStream(java.io.InputStream in,
                                int length)
Builds a new content-length input stream. This stream acts as a normal stream except that it will return an end of file, after count bytes have been delivered.

ContentLengthInputStream

public ContentLengthInputStream(HttpStreamObserver observer,
                                java.io.InputStream in,
                                int length)
Method Detail

mark

public void mark(int readlimit)
Overrides:
mark in class java.io.InputStream

reset

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

close

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

read

public int read()
         throws java.io.IOException
Overrides:
read in class java.io.InputStream

read

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

skip

public long skip(long n)
          throws java.io.IOException
Overrides:
skip in class java.io.InputStream

available

public int available()
              throws java.io.IOException
Overrides:
available in class java.io.InputStream

finalize

public void finalize()
Make sure the stream is ultimately closed !
Overrides:
finalize in class java.lang.Object