public class DefaultChannelGroup extends java.util.AbstractSet<Channel> implements ChannelGroup
ChannelGroup implementation.| 构造器和说明 |
|---|
DefaultChannelGroup()
Creates a new group with a generated name.
|
DefaultChannelGroup(java.lang.String name)
Creates a new group with the specified
name. |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
add(Channel channel) |
void |
clear() |
ChannelGroupFuture |
close()
Closes all
Channels in this group. |
int |
compareTo(ChannelGroup o) |
boolean |
contains(java.lang.Object o) |
ChannelGroupFuture |
disconnect()
Disconnects all
Channels in this group from their remote peers. |
boolean |
equals(java.lang.Object o) |
Channel |
find(java.lang.Integer id)
Returns the
Channel whose ID matches the specified integer. |
java.lang.String |
getName()
Returns the name of this group.
|
int |
hashCode() |
boolean |
isEmpty() |
java.util.Iterator<Channel> |
iterator() |
boolean |
remove(java.lang.Object o) |
ChannelGroupFuture |
setInterestOps(int interestOps)
|
ChannelGroupFuture |
setReadable(boolean readable)
Calls
Channel.setReadable(boolean) for all Channels in
this group with the specified boolean flag. |
int |
size() |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
java.lang.String |
toString() |
ChannelGroupFuture |
unbind()
Unbinds all
Channels in this group from their local address. |
ChannelGroupFuture |
write(java.lang.Object message)
Writes the specified
message to all Channels in this
group. |
ChannelGroupFuture |
write(java.lang.Object message,
java.net.SocketAddress remoteAddress)
|
public DefaultChannelGroup()
public DefaultChannelGroup(java.lang.String name)
name. Please note that
different groups can have the same name, which means no duplicate check
is done against group names.public java.lang.String getName()
ChannelGroupgetName 在接口中 ChannelGrouppublic boolean isEmpty()
public int size()
public Channel find(java.lang.Integer id)
ChannelGroupChannel whose ID matches the specified integer.find 在接口中 ChannelGroupChannel if found. null otherwise.public boolean contains(java.lang.Object o)
public boolean add(Channel channel)
public boolean remove(java.lang.Object o)
public void clear()
public java.util.Iterator<Channel> iterator()
public java.lang.Object[] toArray()
public <T> T[] toArray(T[] a)
public ChannelGroupFuture close()
ChannelGroupChannels in this group. If the Channel is
connected to a remote peer or bound to a local address, it is
automatically disconnected and unbound.close 在接口中 ChannelGroupChannelGroupFuture instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture disconnect()
ChannelGroupChannels in this group from their remote peers.disconnect 在接口中 ChannelGroupChannelGroupFuture instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture setInterestOps(int interestOps)
ChannelGroupChannel.setInterestOps(int) for all Channels in
this group with the specified interestOps. Please note that
this operation is asynchronous as Channel.setInterestOps(int) is.setInterestOps 在接口中 ChannelGroupChannelGroupFuture instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture setReadable(boolean readable)
ChannelGroupChannel.setReadable(boolean) for all Channels in
this group with the specified boolean flag. Please note that this
operation is asynchronous as Channel.setReadable(boolean) is.setReadable 在接口中 ChannelGroupChannelGroupFuture instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture unbind()
ChannelGroupChannels in this group from their local address.unbind 在接口中 ChannelGroupChannelGroupFuture instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture write(java.lang.Object message)
ChannelGroupmessage to all Channels in this
group. If the specified message is an instance of
ChannelBuffer, it is automatically
duplicated to avoid a race
condition. Please note that this operation is asynchronous as
Channel.write(Object) is.write 在接口中 ChannelGroupChannelGroupFuture instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture write(java.lang.Object message, java.net.SocketAddress remoteAddress)
ChannelGroupmessage with the specified
remoteAddress to all Channels in this group. If the
specified message is an instance of ChannelBuffer, it is
automatically duplicated to avoid
a race condition. Please note that this operation is asynchronous as
Channel.write(Object, SocketAddress) is.write 在接口中 ChannelGroupChannelGroupFuture instance that notifies when
the operation is done for all channelspublic int hashCode()
public boolean equals(java.lang.Object o)
public int compareTo(ChannelGroup o)
compareTo 在接口中 java.lang.Comparable<ChannelGroup>public java.lang.String toString()
toString 在类中 java.util.AbstractCollection<Channel>