Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.enhydra.servlet.connectionMethods.EnhydraDirector
Class EnhydraDirectorInputStream  view EnhydraDirectorInputStream download EnhydraDirectorInputStream.java

java.lang.Object
  extended byjava.io.InputStream
      extended byjavax.servlet.ServletInputStream
          extended byorg.enhydra.servlet.connectionMethods.EnhydraDirector.EnhydraDirectorInputStream

class EnhydraDirectorInputStream
extends javax.servlet.ServletInputStream

InputStream interface for the Enhydra connection method.

Implemention of ServletInputStrem to be passed to servlets to allow them to receive the incoming HTTP request entity. This input stream and its underlying protocol receiver does not buffer input. Incoming entity bytes are read directly from the connected socket into the receiving buffer.

Version:
$Revision: 1.3.2.1.2.1 $

Field Summary
private  EnhydraDirectorConnection conn
          Enhydra protocol connection instance.
 
Constructor Summary
EnhydraDirectorInputStream(EnhydraDirectorConnection connection)
          Create a new instance with the given connection object.
 
Method Summary
 int available()
          Returns the number of bytes that can be read from this input stream without blocking.
 void close()
          Closes this input stream.
 int read()
          Reads the next byte of incoming entity data.
 int read(byte[] buf)
          Read incoming entity data into a byte array.
 int read(byte[] buf, int off, int len)
          Read incoming entity data into part or all of a byte array.
 void reset()
          Resets this input stream for another connection.
 long skip(long n)
          Skip incoming entity data.
 
Methods inherited from class javax.servlet.ServletInputStream
readLine
 
Methods inherited from class java.io.InputStream
mark, markSupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

conn

private EnhydraDirectorConnection conn
Enhydra protocol connection instance.

Handles the actual communication with the remote client module.

Constructor Detail

EnhydraDirectorInputStream

public EnhydraDirectorInputStream(EnhydraDirectorConnection connection)
Create a new instance with the given connection object.

Method Detail

read

public int read()
         throws java.io.IOException
Reads the next byte of incoming entity data.

Returns the byte as an int with a value between 0 and 255. Returns -1 on end-of-data.


read

public int read(byte[] buf,
                int off,
                int len)
         throws java.io.IOException
Read incoming entity data into part or all of a byte array.

This is a more efficient override of the standard InputStream method. It reads data directly from the socket into the buffer without repeated calls to the single-byte read().

Regardless of the value of off and len, this method will not go beyond the end of buf.


read

public int read(byte[] buf)
         throws java.io.IOException
Read incoming entity data into a byte array.

This is an efficient override of the standard InputStream method. It reads data directly from the socket into the buffer without repeated calls to the single-byte read().


skip

public long skip(long n)
          throws java.io.IOException
Skip incoming entity data.

Reads and discards n bytes of incoming entity data. If end-of-data is reached, may skip fewer than n bytes of data. If no bytes are skipped before end-of-data is reached, returns -1.


available

public int available()
              throws java.io.IOException
Returns the number of bytes that can be read from this input stream without blocking.


close

public void close()
           throws java.io.IOException
Closes this input stream.

Discards any remaining bytes in the incoming request entity and marks the connection's input stream as "closed" so that further read calls will fail.


reset

public void reset()
           throws java.io.IOException
Resets this input stream for another connection.

Does nothing right now, since this low level stream is unbuffered and all state is kept in the conn object, which is always reset for each new response.