?? connectinfo.java
字號(hào):
/**
*
*/
package com.aceway.vas.commons.tcp.impl;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;
import java.util.ArrayList;
import java.util.List;
public class ConnectInfo {
private int connectId= -1;
private ByteBuffer recvBuff = null;
private List sendDataList = new ArrayList();
private Object attachObj = null;
private SelectionKey key = null;
public void setAttachObj(Object attachObj){
this.attachObj = attachObj;
}
public Object getAttachObj(){
return this.attachObj;
}
public void setKey(SelectionKey key){
this.key = key;
}
public SelectionKey getKey(){
return this.key;
}
public ConnectInfo(int connectId, int bufferCapacity){
this.connectId = connectId;
recvBuff = ByteBuffer.allocate(bufferCapacity);
}
public int getConnectId(){
return connectId;
}
public void addSendData(byte[] bytes){
this.sendDataList.add(ByteBuffer.wrap(bytes));
}
public List getSendData(){
return this.sendDataList;
}
public SocketAddress getRemoteAddress(){
SocketChannel sc = (SocketChannel)key.channel();
return sc.socket().getRemoteSocketAddress() ;
}
public ByteBuffer getRecvBuff(){
return this.recvBuff;
}
public void setRecvBuff(ByteBuffer buff){
this.recvBuff = buff;
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -