XNIO API 3.0.4.GA

org.xnio.sasl
Class SaslWrapper

java.lang.Object
  extended by org.xnio.sasl.SaslWrapper

public abstract class SaslWrapper
extends Object

A wrapper delegation class for SASL that presents the same wrap/unwrap API regardless of whether it is dealing with a SASL client or server.

Author:
David M. Lloyd

Constructor Summary
SaslWrapper()
           
 
Method Summary
static SaslWrapper create(SaslClient saslClient)
          Create a SASL wrapper for a SASL client.
static SaslWrapper create(SaslServer saslServer)
          Create a SASL wrapper for a SASL server.
 byte[] unwrap(byte[] bytes)
          Unwrap a message.
abstract  byte[] unwrap(byte[] bytes, int off, int len)
          Unwrap a message.
abstract  void unwrap(ByteBuffer destination, ByteBuffer source)
          Unwrap a message.
 byte[] wrap(byte[] bytes)
          Wrap a message.
abstract  byte[] wrap(byte[] bytes, int off, int len)
          Wrap a message.
abstract  void wrap(ByteBuffer destination, ByteBuffer source)
          Wrap a message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SaslWrapper

public SaslWrapper()
Method Detail

wrap

public abstract byte[] wrap(byte[] bytes,
                            int off,
                            int len)
                     throws SaslException
Wrap a message.

Parameters:
bytes - the incoming message
off - the offset into the byte array
len - the length of the byte array to wrap
Returns:
the wrap result
Throws:
SaslException - if a problem occurs

wrap

public final byte[] wrap(byte[] bytes)
                  throws SaslException
Wrap a message.

Parameters:
bytes - the incoming message
Returns:
the wrap result
Throws:
SaslException - if a problem occurs

unwrap

public abstract byte[] unwrap(byte[] bytes,
                              int off,
                              int len)
                       throws SaslException
Unwrap a message.

Parameters:
bytes - the incoming message
off - the offset into the byte array
len - the length of the byte array to wrap
Returns:
the unwrap result
Throws:
SaslException - if a problem occurs

unwrap

public final byte[] unwrap(byte[] bytes)
                    throws SaslException
Unwrap a message.

Parameters:
bytes - the incoming message
Returns:
the unwrap result
Throws:
SaslException - if a problem occurs

wrap

public abstract void wrap(ByteBuffer destination,
                          ByteBuffer source)
                   throws SaslException
Wrap a message. Wrapping occurs from the source buffer to the destination idea.

The source buffer should have its position and remaining length set to encompass exactly one SASL message (without the length field). The SASL message itself does not encode any length information so it is up to the protocol implementer to ensure that the message is properly framed.

Parameters:
destination - the buffer into which bytes should be written
source - the buffers from which bytes should be read
Throws:
SaslException - if a SASL error occurs
See Also:
SaslClient.wrap(byte[], int, int), SaslServer.wrap(byte[], int, int)

unwrap

public abstract void unwrap(ByteBuffer destination,
                            ByteBuffer source)
                     throws SaslException
Unwrap a message. Unwrapping occurs from the source buffer to the destination idea.

The source buffer should have its position and remaining length set to encompass exactly one SASL message (without the length field). The SASL message itself does not encode any length information so it is up to the protocol implementer to ensure that the message is properly framed.

Parameters:
destination - the buffer into which bytes should be written
source - the buffers from which bytes should be read
Throws:
SaslException - if a SASL error occurs
See Also:
SaslClient.unwrap(byte[], int, int)

create

public static SaslWrapper create(SaslClient saslClient)
Create a SASL wrapper for a SASL client.

Parameters:
saslClient - the SASL client
Returns:
the wrapper

create

public static SaslWrapper create(SaslServer saslServer)
Create a SASL wrapper for a SASL server.

Parameters:
saslServer - the SASL server
Returns:
the wrapper

XNIO API 3.0.4.GA

Copyright © 2010 JBoss, a division of Red Hat, Inc.