APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.nio.ch

pack-priv Class MembershipKeyImpl

extends MembershipKey
Class Inheritance
Known Direct Subclasses
sun.nio.ch.MembershipKeyImpl.Type4, sun.nio.ch.MembershipKeyImpl.Type6
Imports
java.net.InetAddress, .NetworkInterface, java.io.IOException, java.nio.channels.MembershipKey, .MulticastChannel, java.util.HashSet

MembershipKey implementation.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
MembershipKeyImpl.Type4

MembershipKey will additional context for IPv4 membership

pack-priv static class
MembershipKeyImpl.Type6

MembershipKey will additional context for IPv6 membership

Field Summary

Modifier and TypeField and Description
private HashSet<InetAddress>
private final MulticastChannel
private final InetAddress
private final NetworkInterface
private volatile boolean
private final InetAddress
private final Object

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public MembershipKey
block(InetAddress toBlock)

Implements abstract java.nio.channels.MembershipKey.block.

Block multicast datagrams from the given source address.

public MulticastChannel
channel()

Implements abstract java.nio.channels.MembershipKey.channel.

Returns the channel for which this membership key was created.

public void
drop()

Implements abstract java.nio.channels.MembershipKey.drop.

Drop membership.

public InetAddress
group()

Implements abstract java.nio.channels.MembershipKey.group.

Returns the multicast group for which this membership key was created.

pack-priv void
public boolean
isValid()

Implements abstract java.nio.channels.MembershipKey.isValid.

Tells whether or not this membership is valid.

public NetworkInterface
networkInterface()

Implements abstract java.nio.channels.MembershipKey.networkInterface.

Returns the network interface for which this membership key was created.

public InetAddress
sourceAddress()

Implements abstract java.nio.channels.MembershipKey.sourceAddress.

Returns the source address if this membership key is source-specific, or null if this membership is not source-specific.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public MembershipKey
unblock(InetAddress toUnblock)

Implements abstract java.nio.channels.MembershipKey.unblock.

Unblock multicast datagrams from the given source address that was previously blocked using the block method.

Field Detail

blockedSetback to summary
private HashSet<InetAddress> blockedSet
chback to summary
private final MulticastChannel ch
groupback to summary
private final InetAddress group
interfback to summary
private final NetworkInterface interf
invalidback to summary
private volatile boolean invalid
sourceback to summary
private final InetAddress source
stateLockback to summary
private final Object stateLock

Constructor Detail

MembershipKeyImplback to summary
private MembershipKeyImpl(MulticastChannel ch, InetAddress group, NetworkInterface interf, InetAddress source)

Method Detail

blockback to summary
public MembershipKey block(InetAddress toBlock) throws IOException

Implements abstract java.nio.channels.MembershipKey.block.

Doc from java.nio.channels.MembershipKey.block.

Block multicast datagrams from the given source address.

If this membership key is not source-specific, and the underlying operating system supports source filtering, then this method blocks multicast datagrams from the given source address. If the given source address is already blocked then this method has no effect. After a source address is blocked it may still be possible to receive datagrams from that source. This can arise when datagrams are waiting to be received in the socket's receive buffer.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
channelback to summary
public MulticastChannel channel()

Implements abstract java.nio.channels.MembershipKey.channel.

Doc from java.nio.channels.MembershipKey.channel.

Returns the channel for which this membership key was created. This method will continue to return the channel even after the membership becomes invalid.

Annotations
@Override
dropback to summary
public void drop()

Implements abstract java.nio.channels.MembershipKey.drop.

Doc from java.nio.channels.MembershipKey.drop.

Drop membership.

If the membership key represents a membership to receive all datagrams then the membership is dropped and the channel will no longer receive any datagrams sent to the group. If the membership key is source-specific then the channel will no longer receive datagrams sent to the group from that source address.

After membership is dropped it may still be possible to receive datagrams sent to the group. This can arise when datagrams are waiting to be received in the socket's receive buffer. After membership is dropped then the channel may join the group again in which case a new membership key is returned.

Upon return, this membership object will be invalid. If the multicast group membership is already invalid then invoking this method has no effect. Once a multicast group membership is invalid, it remains invalid forever.

groupback to summary
public InetAddress group()

Implements abstract java.nio.channels.MembershipKey.group.

Doc from java.nio.channels.MembershipKey.group.

Returns the multicast group for which this membership key was created. This method will continue to return the group even after the membership becomes invalid.

Annotations
@Override
invalidateback to summary
pack-priv void invalidate()
isValidback to summary
public boolean isValid()

Implements abstract java.nio.channels.MembershipKey.isValid.

Doc from java.nio.channels.MembershipKey.isValid.

Tells whether or not this membership is valid.

A multicast group membership is valid upon creation and remains valid until the membership is dropped by invoking the drop method, or the channel is closed.

networkInterfaceback to summary
public NetworkInterface networkInterface()

Implements abstract java.nio.channels.MembershipKey.networkInterface.

Doc from java.nio.channels.MembershipKey.networkInterface.

Returns the network interface for which this membership key was created. This method will continue to return the network interface even after the membership becomes invalid.

Annotations
@Override
sourceAddressback to summary
public InetAddress sourceAddress()

Implements abstract java.nio.channels.MembershipKey.sourceAddress.

Doc from java.nio.channels.MembershipKey.sourceAddress.

Returns the source address if this membership key is source-specific, or null if this membership is not source-specific.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
unblockback to summary
public MembershipKey unblock(InetAddress toUnblock)

Implements abstract java.nio.channels.MembershipKey.unblock.

Doc from java.nio.channels.MembershipKey.unblock.

Unblock multicast datagrams from the given source address that was previously blocked using the block method.

Annotations
@Override
sun.nio.ch back to summary

pack-priv Class MembershipKeyImpl.Type4

extends MembershipKeyImpl
Class Inheritance

MembershipKey will additional context for IPv4 membership

Field Summary

Modifier and TypeField and Description
private final int
private final int
private final int

Constructor Summary

AccessConstructor and Description
pack-priv
Type4(MulticastChannel ch, InetAddress group, NetworkInterface interf, InetAddress source, int groupAddress, int interfAddress, int sourceAddress)

Method Summary

Modifier and TypeMethod and Description
pack-priv int
pack-priv int
pack-priv int
Inherited from sun.nio.ch.MembershipKeyImpl:
blockchanneldropgroupinvalidateisValidnetworkInterfacesourceAddresstoStringunblock

Field Detail

groupAddressback to summary
private final int groupAddress
interfAddressback to summary
private final int interfAddress
sourceAddressback to summary
private final int sourceAddress

Constructor Detail

Type4back to summary
pack-priv Type4(MulticastChannel ch, InetAddress group, NetworkInterface interf, InetAddress source, int groupAddress, int interfAddress, int sourceAddress)

Method Detail

groupAddressback to summary
pack-priv int groupAddress()
interfaceAddressback to summary
pack-priv int interfaceAddress()
sourceback to summary
pack-priv int source()
sun.nio.ch back to summary

pack-priv Class MembershipKeyImpl.Type6

extends MembershipKeyImpl
Class Inheritance

MembershipKey will additional context for IPv6 membership

Field Summary

Modifier and TypeField and Description
private final byte[]
private final int
private final byte[]

Constructor Summary

AccessConstructor and Description
pack-priv
Type6(MulticastChannel ch, InetAddress group, NetworkInterface interf, InetAddress source, byte[] groupAddress, int index, byte[] sourceAddress)

Method Summary

Modifier and TypeMethod and Description
pack-priv byte[]
pack-priv int
pack-priv byte[]
Inherited from sun.nio.ch.MembershipKeyImpl:
blockchanneldropgroupinvalidateisValidnetworkInterfacesourceAddresstoStringunblock

Field Detail

groupAddressback to summary
private final byte[] groupAddress
indexback to summary
private final int index
sourceAddressback to summary
private final byte[] sourceAddress

Constructor Detail

Type6back to summary
pack-priv Type6(MulticastChannel ch, InetAddress group, NetworkInterface interf, InetAddress source, byte[] groupAddress, int index, byte[] sourceAddress)

Method Detail

groupAddressback to summary
pack-priv byte[] groupAddress()
indexback to summary
pack-priv int index()
sourceback to summary
pack-priv byte[] source()