Package org.xnio.channels

# Class SocketAddressBuffer

java.lang.Object
org.xnio.channels.SocketAddressBuffer

public final class SocketAddressBuffer extends Object
A buffer for source and destination addresses.

Author:
  David M. Lloyd

## Constructor Summary

Constructors
Constructor
Description
`SocketAddressBuffer()`
Construct a new instance.

## Method Summary

Modifier and Type
Method
Description
`void`
`clear()`
Clear both addresses in the buffer.
`SocketAddress`
`getDestinationAddress()`
Get the destination address.
`<A extends SocketAddress>
A`
`getDestinationAddress(Class<A> type)`
Get the destination address.
`SocketAddress`
`getSourceAddress()`
Get the source address.
`<A extends SocketAddress>
A`
`getSourceAddress(Class<A> type)`
Get the source address.
`void`
`setDestinationAddress(SocketAddress destinationAddress)`
Set the destination address.
`void`
`setSourceAddress(SocketAddress sourceAddress)`
Set the source address.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SocketAddressBuffer

public SocketAddressBuffer()
Construct a new instance.

## Method Details

### getSourceAddress

public SocketAddress getSourceAddress()
Get the source address.

Returns:
  the source address, or `null` if not set

### getSourceAddress

public <A extends SocketAddress> A getSourceAddress(Class<A> type)
Get the source address.

Parameters:
  `type` - the address type to get
Returns:
  the source address, or `null` if not set

### setSourceAddress

public void setSourceAddress(SocketAddress sourceAddress)
Set the source address.

Parameters:
  `sourceAddress` - the source address, or `null` to clear

### getDestinationAddress

public SocketAddress getDestinationAddress()
Get the destination address.

Returns:
  the destination address, or `null` if not set

### getDestinationAddress

public <A extends SocketAddress> A getDestinationAddress(Class<A> type)
Get the destination address.

Parameters:
  `type` - the address type to get
Returns:
  the destination address, or `null` if not set

### setDestinationAddress

public void setDestinationAddress(SocketAddress destinationAddress)
Set the destination address.

Parameters:
  `destinationAddress` - the destination address, or `null` to clear

### clear

public void clear()
Clear both addresses in the buffer.