com.infoengine.SAK
Class HttpInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended bycom.infoengine.SAK.HttpInputStream

public class HttpInputStream
extends InputStream

This class implements an HTTP input stream class for Info*Engine.


Field Summary
private  int contentLength
           
private  byte[] inputBuffer
           
private  int inputBufferCursor
           
private  int inputBufferLimit
           
private  InputStream inputStream
           
 
Fields inherited from class java.io.InputStream
 
Constructor Summary
HttpInputStream()
           
HttpInputStream(URLConnection connection)
          Constructor that initializes the instance to read from a URL connection.
 
Method Summary
 int available()
          Return the number of bytes that can be read without blocking.
 void close()
          Close the input stream.
 InputStream getInputStream()
           
 void mark(int readLimit)
          Mark the current position in the input stream.
 boolean markSupported()
          Return an indication of support for input stream marking.
 int read()
          Return a byte from the input stream.
 int read(byte[] b)
          Read bytes from the input stream into an array.
 int read(byte[] b, int off, int len)
          Read bytes from the input stream into an array or subarray.
 String readLine()
          Read a line of text from the client connection using the default character encoding for the platform.
 String readLine(String encoding)
          Read a line of text from the client connection using a specified character encoding.
 void reset()
          Reset input stream position to last mark.
 void setContentLength(int contentLength)
           
 void setInputStream(InputStream in)
           
 long skip(long n)
          Read and discard bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contentLength

private int contentLength

inputBuffer

private byte[] inputBuffer

inputBufferCursor

private int inputBufferCursor

inputBufferLimit

private int inputBufferLimit

inputStream

private InputStream inputStream
Constructor Detail

HttpInputStream

public HttpInputStream()

HttpInputStream

public HttpInputStream(URLConnection connection)
                throws IOException
Constructor that initializes the instance to read from a URL connection.

Method Detail

available

public int available()
              throws IOException
Return the number of bytes that can be read without blocking.

Returns:
int number of bytes that can be read
Throws:
IOException

close

public void close()
           throws IOException
Close the input stream.

Throws:
IOException

mark

public void mark(int readLimit)
Mark the current position in the input stream.

Parameters:
readLimit - position to mark

markSupported

public boolean markSupported()
Return an indication of support for input stream marking.

Returns:
boolean mark support indication

read

public int read()
         throws IOException
Return a byte from the input stream.

Returns:
int next byte from input stream
Throws:
IOException

read

public int read(byte[] b)
         throws IOException
Read bytes from the input stream into an array.

Parameters:
b - array
Returns:
int number of bytes read
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Read bytes from the input stream into an array or subarray.

Parameters:
b - array
off - offset of array at which to read bytes
len - maximum number of bytes to read
Returns:
int number of bytes read
Throws:
IOException

readLine

public String readLine()
                throws IOException
Read a line of text from the client connection using the default character encoding for the platform.

Returns:
String line of text, with end of line sequence removed
Throws:
IOException

readLine

public String readLine(String encoding)
                throws IOException
Read a line of text from the client connection using a specified character encoding.

Parameters:
encoding - the character encoding to apply to the connection
Returns:
String line of text, with end of line sequence removed
Throws:
IOException

reset

public void reset()
           throws IOException
Reset input stream position to last mark.

Throws:
IOException

skip

public long skip(long n)
          throws IOException
Read and discard bytes.

Parameters:
n - number of bytes to read and discard
Returns:
long actual number of bytes read and discarded
Throws:
IOException

setInputStream

public void setInputStream(InputStream in)

setContentLength

public void setContentLength(int contentLength)

getInputStream

public InputStream getInputStream()