Package org.apache.hadoop.security
Class SaslOutputStream
java.lang.Object
java.io.OutputStream
org.apache.hadoop.security.SaslOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
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
ConstructorsConstructorDescriptionSaslOutputStream(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
Modifier and TypeMethodDescriptionvoidclose()Closes this output stream and releases any system resources associated with this stream.voidflush()Flushes this output streamvoidwrite(byte[] b) Writesb.lengthbytes from the specified byte array to this output stream.voidwrite(byte[] inBuf, int off, int len) Writeslenbytes from the specified byte array starting at offsetoffto this output stream.voidwrite(int b) Writes the specified byte to this output stream.Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
SaslOutputStream
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 processedsaslServer- an initialized SaslServer object
-
SaslOutputStream
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 processedsaslClient- an initialized SaslClient object
-
-
Method Details
-
write
Writes the specified byte to this output stream.- Specified by:
writein classOutputStream- Parameters:
b- thebyte.- Throws:
IOException- if an I/O error occurs.
-
write
Writesb.lengthbytes from the specified byte array to this output stream.The
writemethod ofSASLOutputStreamcalls thewritemethod of three arguments with the three argumentsb,0, andb.length.- Overrides:
writein classOutputStream- Parameters:
b- the data.- Throws:
NullPointerException- ifbis null.IOException- if an I/O error occurs.
-
write
Writeslenbytes from the specified byte array starting at offsetoffto this output stream.- Overrides:
writein classOutputStream- 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
Flushes this output stream- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException- if an I/O error occurs.
-
close
Closes this output stream and releases any system resources associated with this stream.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException- if an I/O error occurs.
-