org.apache.hadoop.security
Class SaslOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.apache.hadoop.security.SaslOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class SaslOutputStream
extends OutputStream

A SaslOutputStream is composed of an OutputStream and a SaslServer (or SaslClient) so that write() methods first process the data before writing them out to the underlying OutputStream. The SaslServer (or SaslClient) object must be fully initialized before being used by a SaslOutputStream.


Constructor Summary
SaslOutputStream(OutputStream outStream, SaslClient saslClient)
          Constructs a SASLOutputStream from an OutputStream and a SaslClient
Note: if the specified OutputStream or SaslClient is null, a NullPointerException may be thrown later when they are used.
SaslOutputStream(OutputStream outStream, SaslServer saslServer)
          Constructs a SASLOutputStream from an OutputStream and a SaslServer
Note: if the specified OutputStream or SaslServer is null, a NullPointerException may be thrown later when they are used.
 
Method Summary
 void close()
          Closes this output stream and releases any system resources associated with this stream.
 void flush()
          Flushes this output stream
 void write(byte[] b)
          Writes b.length bytes from the specified byte array to this output stream.
 void write(byte[] inBuf, int off, int len)
          Writes len bytes from the specified byte array starting at offset off to this output stream.
 void write(int b)
          Writes the specified byte to this output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SaslOutputStream

public SaslOutputStream(OutputStream outStream,
                        SaslServer saslServer)
Constructs a SASLOutputStream from an OutputStream and a SaslServer
Note: if the specified OutputStream or SaslServer is null, a NullPointerException may be thrown later when they are used.

Parameters:
outStream - the OutputStream to be processed
saslServer - an initialized SaslServer object

SaslOutputStream

public SaslOutputStream(OutputStream outStream,
                        SaslClient saslClient)
Constructs a SASLOutputStream from an OutputStream and a SaslClient
Note: if the specified OutputStream or SaslClient is null, a NullPointerException may be thrown later when they are used.

Parameters:
outStream - the OutputStream to be processed
saslClient - an initialized SaslClient object
Method Detail

write

public void write(int b)
           throws IOException
Writes the specified byte to this output stream.

Specified by:
write in class OutputStream
Parameters:
b - the byte.
Throws:
IOException - if an I/O error occurs.

write

public void write(byte[] b)
           throws IOException
Writes b.length bytes from the specified byte array to this output stream.

The write method of SASLOutputStream calls the write method of three arguments with the three arguments b, 0, and b.length.

Overrides:
write in class OutputStream
Parameters:
b - the data.
Throws:
NullPointerException - if b is null.
IOException - if an I/O error occurs.

write

public void write(byte[] inBuf,
                  int off,
                  int len)
           throws IOException
Writes len bytes from the specified byte array starting at offset off to this output stream.

Overrides:
write in class OutputStream
Parameters:
inBuf - the data.
off - the start offset in the data.
len - the number of bytes to write.
Throws:
IOException - if an I/O error occurs.

flush

public void flush()
           throws IOException
Flushes this output stream

Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException - if an I/O error occurs.

close

public void close()
           throws IOException
Closes this output stream and releases any system resources associated with this stream.

Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException - if an I/O error occurs.


Copyright © 2009 The Apache Software Foundation