wttools.protocols.http
Class HTTPInputStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--java.io.FilterInputStream
              |
              +--wttools.protocols.http.HTTPInputStream

public class HTTPInputStream
extends java.io.FilterInputStream

HTTPInputStream.java Created: Mon Sep 17 16:37:47 2001

Version:
$Revision: 1.7 $
Author:
Artur Hefczyc

Field Summary
protected  int bytes_read
          variable bytes_read contains value of bytes already read for current chunk.
protected  int chunk_size
          variable chunk_size contains value of current chunk size in bytes.
protected  int dataEncodingType
          variable dataEncodingType contains value of
protected  boolean debug
          variable debug contains value of
protected static int ENC_BINARY
          Describe constant ENC_BINARY here.
protected static int ENC_CHUNKED
          Describe constant ENC_CHUNKED here.
protected static int ENC_UNKNOWN
          Describe constant ENC_UNKNOWN here.
protected  java.util.HashMap headers
          variable headers contains value of
protected  byte[] one_byte
          Variable one_byte is an array of one byte capasity.
protected  float readBytes
          variable readBytes contains value of
protected  float readMilis
          variable readMilis contains value of
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
HTTPInputStream(java.io.InputStream in)
          Creates a new HTTPInputStream instance.
 
Method Summary
protected  void deb(java.lang.String str)
          deb method performs
protected  java.util.HashMap getAllHeaders()
          getAllHeaders method performs
 boolean isDebug()
          Get the value of debug.
protected  void raw(java.lang.String str)
          raw method performs
 int read()
          read method performs
 int read(byte[] b)
          read method performs
 int read(byte[] b, int off, int len)
          read method performs
protected  int readBinary(byte[] b, int off, int len)
          readBinary method performs
protected  int readChunked(byte[] b, int off, int len)
          readChunked method streams chunked data from http server.
protected  int readNextChunkSize()
          readNextChunkSize method performs
 void setDebug(boolean v)
          Set the value of debug.
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENC_UNKNOWN

protected static final int ENC_UNKNOWN
Describe constant ENC_UNKNOWN here.

ENC_BINARY

protected static final int ENC_BINARY
Describe constant ENC_BINARY here.

ENC_CHUNKED

protected static final int ENC_CHUNKED
Describe constant ENC_CHUNKED here.

debug

protected boolean debug
variable debug contains value of

dataEncodingType

protected int dataEncodingType
variable dataEncodingType contains value of

headers

protected java.util.HashMap headers
variable headers contains value of

readMilis

protected float readMilis
variable readMilis contains value of

readBytes

protected float readBytes
variable readBytes contains value of

one_byte

protected byte[] one_byte
Variable one_byte is an array of one byte capasity. All reading should be performed with one method becouse of problems with different encodings during http transmision. So it is easier to do all necessary calculations in one place.
The use of this variable is not essential, however may significantly improve work of read() method.

chunk_size

protected int chunk_size
variable chunk_size contains value of current chunk size in bytes.

bytes_read

protected int bytes_read
variable bytes_read contains value of bytes already read for current chunk.
Constructor Detail

HTTPInputStream

public HTTPInputStream(java.io.InputStream in)
Creates a new HTTPInputStream instance.
Parameters:
in - an InputStream value
Method Detail

read

public int read()
         throws java.io.IOException
read method performs
Overrides:
read in class java.io.FilterInputStream
Returns:
an int value
Throws:
java.io.IOException - if an error occurs

read

public int read(byte[] b)
         throws java.io.IOException
read method performs
Overrides:
read in class java.io.FilterInputStream
Parameters:
b - a byte[] value
Returns:
an int value
Throws:
java.io.IOException - if an error occurs

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
read method performs
Overrides:
read in class java.io.FilterInputStream
Parameters:
b - a byte[] value
off - an int value
len - an int value
Returns:
an int value
Throws:
java.io.IOException - if an error occurs

readBinary

protected int readBinary(byte[] b,
                         int off,
                         int len)
                  throws java.io.IOException
readBinary method performs
Parameters:
b - a byte[] value
off - an int value
len - an int value
Returns:
an int value
Throws:
java.io.IOException - if an error occurs

readChunked

protected int readChunked(byte[] b,
                          int off,
                          int len)
                   throws java.io.IOException
readChunked method streams chunked data from http server.
Parameters:
b - a byte[] is buffer for storing received data.
off - an int is offset in buffer where to start storing received data.
len - an int is expected data size which should be stored in given buffer.
Returns:
an int returns bytes count stored in given buffer.
Throws:
java.io.IOException - if an error occurs during reading data from stream.

readNextChunkSize

protected int readNextChunkSize()
                         throws java.io.IOException
readNextChunkSize method performs
Returns:
an int value
Throws:
java.io.IOException - if an error occurs

getAllHeaders

protected java.util.HashMap getAllHeaders()
                                   throws java.io.IOException
getAllHeaders method performs
Returns:
a HashMap value
Throws:
java.io.IOException - if an error occurs

deb

protected void deb(java.lang.String str)
deb method performs
Parameters:
str - a String value

raw

protected void raw(java.lang.String str)
raw method performs
Parameters:
str - a String value

isDebug

public boolean isDebug()
Get the value of debug.
Returns:
value of debug.

setDebug

public void setDebug(boolean v)
Set the value of debug.
Parameters:
v - Value to assign to debug.


Copyright © GNU, wttools developers Team.