com.infoengine.object
Class IeInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended bycom.infoengine.object.IeInputStream
Direct Known Subclasses:
IeMultipartInputStream

public class IeInputStream
extends InputStream

This class implements a buffered input stream class for Info*Engine.


Field Summary
(package private)  byte[] inputBuffer
           
(package private)  int inputBufferCursor
           
(package private)  int inputBufferLimit
           
(package private)  InputStream inputStream
           
 
Fields inherited from class java.io.InputStream
 
Constructor Summary
IeInputStream()
          Constructs an instance that is not initially associated with an input stream.
IeInputStream(InputStream is)
          Constructs an instance that reads from a specific input stream.
 
Method Summary
 int available()
          Returns the number of bytes that can be read without blocking.
 void close()
          Closes the input stream and releases all resources allocated to it.
 InputStream getInputStream()
          Returns the input stream currently associated with this object.
 void mark(int readLimit)
          Marks the current position in the input stream.
 boolean markSupported()
          Returns an indication of support for input stream marking.
 int read()
          Returns a byte from the input stream.
 int read(byte[] b)
          Reads 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()
          Reads a line of text from the input stream using the default character encoding for the platform.
 String readLine(String encoding)
          Read a line of text from the input stream using a specified character encoding.
 void reset()
          Resets the input stream to the position of the last mark set.
 void setInputStream(InputStream is)
          Sets the input stream associated with this object.
 long skip(long n)
          Reads and discards bytes from the input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputBuffer

byte[] inputBuffer

inputBufferCursor

int inputBufferCursor

inputBufferLimit

int inputBufferLimit

inputStream

InputStream inputStream
Constructor Detail

IeInputStream

public IeInputStream()
Constructs an instance that is not initially associated with an input stream. Use setInputStream to associate the instance with an input stream.


IeInputStream

public IeInputStream(InputStream is)
Constructs an instance that reads from a specific input stream.

Parameters:
is - The input stream to read.
Method Detail

available

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

Returns:
The number of bytes that can be read without blocking.
Throws:
IOException - if the number of available bytes can not be determined.

close

public void close()
           throws IOException
Closes the input stream and releases all resources allocated to it.

Throws:
IOException - if the output stream can not be closed.

mark

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

Parameters:
readLimit - The position to be marked.

markSupported

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

Returns:
true if marking is supported.

read

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

Returns:
The next byte from input stream, or -1 if the stream is positioned at end of file.
Throws:
IOException - if the input stream can not be read.

read

public int read(byte[] b)
         throws IOException
Reads bytes from the input stream into an array. This method blocks until the array can be filled, or the end of the stream is reached.

Parameters:
b - The array in which to store the bytes read.
Returns:
The number of bytes stored in the array, or -1 if the input stream is positioned at end of file.
Throws:
IOException - if the input stream can not be read.

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Read bytes from the input stream into an array or subarray. This method blocks until the maximum specified number of bytes are read, or the end of the stream is reached.

Parameters:
b - The array in which to store the bytes read.
off - The offset in the array at which to begin storing bytes.
len - The maximum number of bytes to read.
Returns:
The number of bytes read, or -1 if the input stream is positioned at end of file.
Throws:
IOException - if the input stream can not be read.

readLine

public String readLine()
                throws IOException
Reads a line of text from the input stream using the default character encoding for the platform.

Returns:
The line of text read, with end of line sequence removed, or null if the stream is positioned at end of file.
Throws:
IOException - if the input stream can not be read.

readLine

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

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

reset

public void reset()
           throws IOException
Resets the input stream to the position of the last mark set.

Throws:
IOException - if the input stream can not be reset.

skip

public long skip(long n)
          throws IOException
Reads and discards bytes from the input stream.

Parameters:
n - The number of bytes to read and discard.
Returns:
The actual number of bytes read and discarded.
Throws:
IOException - if the input stream can not be read.

setInputStream

public void setInputStream(InputStream is)
Sets the input stream associated with this object.

Parameters:
is - The input stream to associate with this object.

getInputStream

public InputStream getInputStream()
Returns the input stream currently associated with this object.

Returns:
The input stream currently associated with this object.