下面列出了java.nio.channels.DatagramChannel#equals() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public ArrayList<Channel> getAll(String itemName, Direction direction, DatagramChannel theDatagramChannel) {
synchronized (this) {
ArrayList<Channel> selectedChannels = new ArrayList<Channel>();
Iterator<C> it = iterator();
while (it.hasNext()) {
C aChannel = it.next();
if (itemName.equals(aChannel.item) && theDatagramChannel.equals(aChannel.channel)
&& direction.equals(aChannel.direction)) {
selectedChannels.add(aChannel);
}
}
return selectedChannels;
}
}
public ArrayList<Channel> getAll(Direction direction, DatagramChannel theDatagramChannel,
InetSocketAddress clientAddress) {
synchronized (this) {
ArrayList<Channel> selectedChannels = new ArrayList<Channel>();
Iterator<C> it = iterator();
while (it.hasNext()) {
C aChannel = it.next();
if (clientAddress.equals(aChannel.remote) && theDatagramChannel.equals(aChannel.channel)
&& direction.equals(aChannel.direction)) {
selectedChannels.add(aChannel);
}
}
return selectedChannels;
}
}
public Channel get(DatagramChannel theDatagramChannel) {
synchronized (this) {
Iterator<C> it = iterator();
while (it.hasNext()) {
C aChannel = it.next();
if (theDatagramChannel.equals(aChannel.channel)) {
return aChannel;
}
}
return null;
}
}
public void replace(String itemName, Direction direction, DatagramChannel theDatagramChannel,
DatagramChannel channel) {
synchronized (this) {
Iterator<C> it = iterator();
while (it.hasNext()) {
C aChannel = it.next();
if (itemName.equals(aChannel.item) && theDatagramChannel.equals(aChannel.channel)
&& direction.equals(aChannel.direction)) {
aChannel.channel = channel;
}
}
}
}
public void replace(String itemName, Direction direction, InetSocketAddress remoteAddress,
DatagramChannel channel) {
synchronized (this) {
Iterator<C> it = iterator();
while (it.hasNext()) {
C aChannel = it.next();
if (itemName.equals(aChannel.item) && remoteAddress.equals(aChannel.remote)
&& direction.equals(aChannel.direction) && !channel.equals(aChannel.channel)) {
aChannel.channel = channel;
}
}
}
}
public void setAll(String itemName, Direction direction, DatagramChannel theDatagramChannel, boolean b) {
synchronized (this) {
Iterator<C> it = iterator();
while (it.hasNext()) {
C aChannel = it.next();
if (itemName.equals(aChannel.item) && theDatagramChannel.equals(aChannel.channel)
&& direction.equals(aChannel.direction)) {
aChannel.isBlocking = b;
}
}
}
}
public void replace(Direction direction, InetSocketAddress remoteAddress, DatagramChannel channel) {
synchronized (this) {
Iterator<C> it = iterator();
while (it.hasNext()) {
C aChannel = it.next();
if (remoteAddress.equals(aChannel.remote) && direction.equals(aChannel.direction)
&& !channel.equals(aChannel.channel)) {
aChannel.channel = channel;
}
}
}
}
public ArrayList<Channel> getAll(Direction direction, DatagramChannel theDatagramChannel) {
synchronized (this) {
ArrayList<Channel> selectedChannels = new ArrayList<Channel>();
Iterator<C> it = iterator();
while (it.hasNext()) {
C aChannel = it.next();
if (theDatagramChannel.equals(aChannel.channel) && direction.equals(aChannel.direction)) {
selectedChannels.add(aChannel);
}
}
return selectedChannels;
}
}
public void setAllBlocking(Direction direction, DatagramChannel theDatagramChannel, boolean b) {
synchronized (this) {
Iterator<C> it = iterator();
while (it.hasNext()) {
C aChannel = it.next();
if (theDatagramChannel.equals(aChannel.channel) && direction.equals(aChannel.direction)) {
aChannel.isBlocking = true;
}
}
}
}
public void replace(DatagramChannel oldDatagramChannel, DatagramChannel channel) {
synchronized (this) {
Iterator<C> it = iterator();
while (it.hasNext()) {
C aChannel = it.next();
if (oldDatagramChannel.equals(aChannel.channel)) {
aChannel.channel = channel;
}
}
}
}
public void replace(InetSocketAddress remoteAddress, DatagramChannel channel) {
synchronized (this) {
Iterator<C> it = iterator();
while (it.hasNext()) {
C aChannel = it.next();
if (remoteAddress.equals(aChannel.remote) && !channel.equals(aChannel.channel)) {
aChannel.channel = channel;
}
}
}
}
public ArrayList<Channel> getAll(DatagramChannel theDatagramChannel) {
synchronized (this) {
ArrayList<Channel> selectedChannels = new ArrayList<Channel>();
Iterator<C> it = iterator();
while (it.hasNext()) {
C aChannel = it.next();
if (theDatagramChannel.equals(aChannel.channel)) {
selectedChannels.add(aChannel);
}
}
return selectedChannels;
}
}
public void setAllBlocking(DatagramChannel theDatagramChannel, boolean b) {
synchronized (this) {
Iterator<C> it = iterator();
while (it.hasNext()) {
C aChannel = it.next();
if (theDatagramChannel.equals(aChannel.channel)) {
aChannel.isBlocking = b;
}
}
}
}
public void setAllReconnecting(DatagramChannel theDatagramChannel, boolean b) {
synchronized (this) {
Iterator<C> it = iterator();
while (it.hasNext()) {
C aChannel = it.next();
if (theDatagramChannel.equals(aChannel.channel)) {
aChannel.isReconnecting = b;
}
}
}
}
public boolean isBlocking(DatagramChannel theDatagramChannel) {
synchronized (this) {
Iterator<C> it = iterator();
while (it.hasNext()) {
C aChannel = it.next();
if (theDatagramChannel.equals(aChannel.channel) && aChannel.isBlocking) {
return true;
}
}
return false;
}
}
public Channel getBlocking(DatagramChannel theDatagramChannel) {
synchronized (this) {
Iterator<C> it = iterator();
while (it.hasNext()) {
C aChannel = it.next();
if (theDatagramChannel.equals(aChannel.channel) && aChannel.isBlocking) {
return aChannel;
}
}
return null;
}
}