aicas logo Jamaica 3.4 release 8

com.sun.jndi.ldap.sasl
Class SaslInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.sun.jndi.ldap.sasl.SaslInputStream
All Implemented Interfaces:
Closeable

public class SaslInputStream
extends InputStream

This class is used by clients of Java SASL that need to create an input stream that uses SaslClient's unwrap() method to decode the SASL buffers sent by the SASL server. Extend from InputStream instead of FilterInputStream because we need to override less methods in InputStream. That is, the behavior of the default implementations in InputStream matches more closely with the behavior we want in SaslInputStream.


Method Summary
 int available()
          This method returns the number of bytes that can be read from this stream before a read can block.
 void close()
          This method closes the stream.
 int read()
          This method reads an unsigned byte from the input stream and returns it as an int in the range of 0-255.
 int read(byte[] inBuf, int start, int count)
          This method read bytes from a stream and stores them into a caller supplied buffer.
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

read

public int read()
         throws IOException
Description copied from class: InputStream
This method reads an unsigned byte from the input stream and returns it as an int in the range of 0-255. This method also will return -1 if the end of the stream has been reached.

This method will block until the byte can be read.

Specified by:
read in class InputStream
Returns:
The byte read or -1 if end of stream
Throws:
IOException - If an error occurs

read

public int read(byte[] inBuf,
                int start,
                int count)
         throws IOException
Description copied from class: InputStream
This method read bytes from a stream and stores them into a caller supplied buffer. It starts storing the data at index off into the buffer and attempts to read len bytes. This method can return before reading the number of bytes requested. The actual number of bytes read is returned as an int. A -1 is returned to indicate the end of the stream.

This method will block until some data can be read.

This method operates by calling the single byte read() method in a loop until the desired number of bytes are read. The read loop stops short if the end of the stream is encountered or if an IOException is encountered on any read operation except the first. If the first attempt to read a bytes fails, the IOException is allowed to propagate upward. And subsequent IOException is caught and treated identically to an end of stream condition. Subclasses can (and should if possible) override this method to provide a more efficient implementation.

Overrides:
read in class InputStream
Parameters:
inBuf - The array into which the bytes read should be stored
start - The offset into the array to start storing bytes
count - The requested number of bytes to read
Returns:
The actual number of bytes read, or -1 if end of stream.
Throws:
IOException - If an error occurs.

available

public int available()
              throws IOException
Description copied from class: InputStream
This method returns the number of bytes that can be read from this stream before a read can block. A return of 0 indicates that blocking might (or might not) occur on the very next read attempt.

This method always returns 0 in this class

Overrides:
available in class InputStream
Returns:
The number of bytes that can be read before blocking could occur
Throws:
IOException - If an error occurs

close

public void close()
           throws IOException
Description copied from class: InputStream
This method closes the stream. Any futher attempts to read from the stream may generate an IOException

This method does nothing in this class, but subclasses may override this method in order to provide additional functionality.

Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException - If an error occurs, which can only happen in a subclass

aicas logo Jamaica 3.4 release 8

aicas GmbH, Karlsruhe - Germany    www.aicas.com
Copyright 2001-2009 aicas GmbH. All Rights Reserved.