More information: http://www.cs.berkeley.edu/~mdw/proj/seda/

seda.nbio
Class NonblockingSocketInputStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--seda.nbio.NonblockingInputStream
              |
              +--seda.nbio.NonblockingSocketInputStream

class NonblockingSocketInputStream
extends NonblockingInputStream

Package-internal class implementing NonblockingInputStream for nonblocking sockets.


Constructor Summary
(package private) NonblockingSocketInputStream(NonblockingSocketImpl impl)
           
 
Method Summary
 int available()
           
 void close()
           
 int nbRead()
          Perform a non-blocking read of one byte from this input stream.
 int read()
          Perform a blocking read of one byte from this input stream.
 int read(byte[] b)
          Perform a non-blocking read of up to b.length bytes from the underlying stream.
 int read(byte[] b, int off, int len)
          Perform a non-blocking read of up to len bytes from the underlying stream into the byte array b starting at offset off.
 long skip(long n)
          Skip n bytes of input.
 
Methods inherited from class java.io.InputStream
mark, markSupported, reset
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NonblockingSocketInputStream

NonblockingSocketInputStream(NonblockingSocketImpl impl)
Method Detail

read

public int read()
         throws java.io.IOException
Perform a blocking read of one byte from this input stream. Returns -1 if the end of the stream has been reached. Use nbRead() to perform a non-blocking read of one byte.
Overrides:
read in class NonblockingInputStream

nbRead

public int nbRead()
           throws java.io.IOException
Perform a non-blocking read of one byte from this input stream. Returns -1 if no data is available, or throws an EOFException if the end of the stream has been reached. Use read() to perform a blocking read of one byte.
Overrides:
nbRead in class NonblockingInputStream

read

public int read(byte[] b)
         throws java.io.IOException
Perform a non-blocking read of up to b.length bytes from the underlying stream.
Overrides:
read in class NonblockingInputStream
Returns:
The total number of bytes read into the buffer, 0 if no data was available, or -1 if the end of the stream has been reached.

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Perform a non-blocking read of up to len bytes from the underlying stream into the byte array b starting at offset off.
Overrides:
read in class NonblockingInputStream
Returns:
The total number of bytes read into the buffer, 0 if no data was available, or -1 if the end of the stream has been reached.

skip

public long skip(long n)
          throws java.io.IOException
Skip n bytes of input. This is a blocking operation.
Overrides:
skip in class NonblockingInputStream

available

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

close

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

More information: http://www.cs.berkeley.edu/~mdw/proj/seda/