JXTA

net.jxta.socket
Class JxtaSocketAddress

java.lang.Object
  extended by java.net.SocketAddress
      extended by net.jxta.socket.JxtaSocketAddress
All Implemented Interfaces:
Serializable

public class JxtaSocketAddress
extends SocketAddress

This class implements a JxtaSocket address (PeerGroup ID + Pipe Advertisement + (optional) Peer ID).

It provides an immutable object used by sockets for binding, connecting, or as returned values.

Author:
vwilliams
See Also:
JxtaSocket, JxtaServerSocket, SocketAddress, Socket, ServerSocket, Serialized Form

Constructor Summary
JxtaSocketAddress(PeerGroupID peerGroupId, PipeAdvertisement pipeAdv)
          Deprecated. use the PeerAdvertisement variant instead
JxtaSocketAddress(PeerGroupID peerGroupId, PipeAdvertisement pipeAdv, PeerID peerId)
          Deprecated. use the PeerAdvertisement variant instead
JxtaSocketAddress(PeerGroup peerGroup, PipeAdvertisement pipeAdv)
          Creates a new instance of JxtaSocketAddress.
JxtaSocketAddress(PeerGroup peerGroup, PipeAdvertisement pipeAdv, PeerAdvertisement peerAdv)
          Creates a new instance of JxtaSocketAddress.
JxtaSocketAddress(PeerGroup peerGroup, PipeAdvertisement pipeAdv, PeerID peerId)
          Deprecated. use the PeerAdvertisement variant instead
 
Method Summary
 boolean equals(Object obj)
           
 PeerAdvertisement getPeerAdvertisement()
          Returns the PeerID element of the address.
 PeerGroupID getPeerGroupId()
          Returns the PeerGroupID element of the address
 PeerID getPeerId()
          Returns the PeerID element of the address.
 PipeAdvertisement getPipeAdv()
          Returns the PipeAdvertisement element of the address
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JxtaSocketAddress

public JxtaSocketAddress(PeerGroup peerGroup,
                         PipeAdvertisement pipeAdv)
Creates a new instance of JxtaSocketAddress.

Parameters:
peerGroup - peer group within which this socket exists
pipeAdv - the advertisement of a pipe for the socket to listen on

JxtaSocketAddress

@Deprecated
public JxtaSocketAddress(PeerGroup peerGroup,
                                    PipeAdvertisement pipeAdv,
                                    PeerID peerId)
Deprecated. use the PeerAdvertisement variant instead

Creates a new instance of JxtaSocketAddress.

Parameters:
peerGroup - peer group within which this socket exists
pipeAdv - the advertisement of a pipe for the socket to listen on
peerId - the ID of a specific peer to be contacted over this socket (may be null)

JxtaSocketAddress

public JxtaSocketAddress(PeerGroup peerGroup,
                         PipeAdvertisement pipeAdv,
                         PeerAdvertisement peerAdv)
Creates a new instance of JxtaSocketAddress.

Parameters:
peerGroup - peer group within which this socket exists
pipeAdv - the advertisement of a pipe for the socket to listen on
peerAdv - the PeerAdvertisement (may not be null)

JxtaSocketAddress

@Deprecated
public JxtaSocketAddress(PeerGroupID peerGroupId,
                                    PipeAdvertisement pipeAdv)
Deprecated. use the PeerAdvertisement variant instead

Creates a new instance of JxtaSocketAddress.

Parameters:
peerGroupId - ID of peer group within which this socket exists
pipeAdv - the advertisement of a pipe for the socket to listen on

JxtaSocketAddress

@Deprecated
public JxtaSocketAddress(PeerGroupID peerGroupId,
                                    PipeAdvertisement pipeAdv,
                                    PeerID peerId)
Deprecated. use the PeerAdvertisement variant instead

Creates a new instance of JxtaSocketAddress.

Parameters:
peerGroupId - ID of peer group within which this socket exists
pipeAdv - the advertisement of a pipe for the socket to listen on
peerId - the ID of a specific peer to be contacted over this socket (may be null)
Throws:
IllegalArgumentException - if peerGroupId or pipeAdv are null
Method Detail

getPeerGroupId

public PeerGroupID getPeerGroupId()
Returns the PeerGroupID element of the address

Returns:
the PeerGroupID

getPipeAdv

public PipeAdvertisement getPipeAdv()
Returns the PipeAdvertisement element of the address

Returns:
the PipeAdvertisement

getPeerId

public PeerID getPeerId()
Returns the PeerID element of the address. May be null.

Returns:
the PeerID, if there is one, null otherwise

getPeerAdvertisement

public PeerAdvertisement getPeerAdvertisement()
Returns the PeerID element of the address. May be null.

Returns:
the PeerAdvertisement, if there is one, null otherwise

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

JXSE