Top Description Constructors Methods
org.xnio.sasl

public abstract Class SaslWrapper

Additional top-level classes in compilation unit: SaslClientWrapper, SaslServerWrapper.

extends Object
Class Inheritance
Known Direct Subclasses
org.xnio.sasl.SaslClientWrapper, org.xnio.sasl.SaslServerWrapper
Imports
java.nio.ByteBuffer, javax.security.sasl.SaslClient, .SaslException, .SaslServer

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

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static SaslWrapper

Returns:

the wrapper
create
(SaslClient
the SASL client
saslClient
)

Create a SASL wrapper for a SASL client.

public static SaslWrapper

Returns:

the wrapper
create
(SaslServer
the SASL server
saslServer
)

Create a SASL wrapper for a SASL server.

public abstract byte[]

Returns:

the unwrap result
unwrap
(byte[]
the incoming message
bytes
,
int
the offset into the byte array
off
,
int
the length of the byte array to wrap
len
)

Unwrap a message.

public final byte[]

Returns:

the unwrap result
unwrap
(byte[]
the incoming message
bytes
)

Unwrap a message.

public abstract byte[]

Returns:

the unwrap result
unwrap
(ByteBuffer
the buffer from which bytes should be read
source
)

Unwrap a message.

public final void
unwrap(ByteBuffer
the buffer into which bytes should be written
destination
,
ByteBuffer
the buffers from which bytes should be read
source
)

Unwrap a message.

public abstract byte[]

Returns:

the wrap result
wrap
(byte[]
the incoming message
bytes
,
int
the offset into the byte array
off
,
int
the length of the byte array to wrap
len
)

Wrap a message.

public final byte[]

Returns:

the wrap result
wrap
(byte[]
the incoming message
bytes
)

Wrap a message.

public abstract byte[]

Returns:

the wrap result
wrap
(ByteBuffer
the buffer from which bytes should be read
source
)

Wrap a message.

public final void
wrap(ByteBuffer
the buffer into which bytes should be written
destination
,
ByteBuffer
the buffers from which bytes should be read
source
)

Wrap a message.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SaslWrapperback to summary
public SaslWrapper()

Method Detail

createback to summary
public static SaslWrapper create(SaslClient saslClient)

Create a SASL wrapper for a SASL client.

Parameters
saslClient:SaslClient

the SASL client

Returns:SaslWrapper

the wrapper

createback to summary
public static SaslWrapper create(SaslServer saslServer)

Create a SASL wrapper for a SASL server.

Parameters
saslServer:SaslServer

the SASL server

Returns:SaslWrapper

the wrapper

unwrapback to summary
public abstract byte[] unwrap(byte[] bytes, int off, int len) throws SaslException

Unwrap a message.

Parameters
bytes:byte[]

the incoming message

off:int

the offset into the byte array

len:int

the length of the byte array to wrap

Returns:byte[]

the unwrap result

Exceptions
SaslException:
if a problem occurs
unwrapback to summary
public final byte[] unwrap(byte[] bytes) throws SaslException

Unwrap a message.

Parameters
bytes:byte[]

the incoming message

Returns:byte[]

the unwrap result

Exceptions
SaslException:
if a problem occurs
unwrapback to summary
public abstract byte[] unwrap(ByteBuffer source) throws SaslException

Unwrap a message.

Parameters
source:ByteBuffer

the buffer from which bytes should be read

Returns:byte[]

the unwrap result

Exceptions
SaslException:
if a problem occurs
unwrapback to summary
public final 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:ByteBuffer

the buffer into which bytes should be written

source:ByteBuffer

the buffers from which bytes should be read

Exceptions
SaslException:
if a SASL error occurs
See Also
SaslClient#unwrap(byte[], int, int)
wrapback to summary
public abstract byte[] wrap(byte[] bytes, int off, int len) throws SaslException

Wrap a message.

Parameters
bytes:byte[]

the incoming message

off:int

the offset into the byte array

len:int

the length of the byte array to wrap

Returns:byte[]

the wrap result

Exceptions
SaslException:
if a problem occurs
wrapback to summary
public final byte[] wrap(byte[] bytes) throws SaslException

Wrap a message.

Parameters
bytes:byte[]

the incoming message

Returns:byte[]

the wrap result

Exceptions
SaslException:
if a problem occurs
wrapback to summary
public abstract byte[] wrap(ByteBuffer source) throws SaslException

Wrap a message.

Parameters
source:ByteBuffer

the buffer from which bytes should be read

Returns:byte[]

the wrap result

Exceptions
SaslException:
if a problem occurs
wrapback to summary
public final 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:ByteBuffer

the buffer into which bytes should be written

source:ByteBuffer

the buffers from which bytes should be read

Exceptions
SaslException:
if a SASL error occurs
See Also
SaslClient#wrap(byte[], int, int), SaslServer#wrap(byte[], int, int)