本文整理匯總了Java中org.jboss.netty.buffer.ChannelBuffer.writeLong方法的典型用法代碼示例。如果您正苦於以下問題:Java ChannelBuffer.writeLong方法的具體用法?Java ChannelBuffer.writeLong怎麽用?Java ChannelBuffer.writeLong使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jboss.netty.buffer.ChannelBuffer
的用法示例。
在下文中一共展示了ChannelBuffer.writeLong方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: sendResponse
import org.jboss.netty.buffer.ChannelBuffer; //導入方法依賴的package包/類
private static void sendResponse(Channel channel, SocketAddress remoteAddress, long rawId, int index) {
if (channel != null) {
ChannelBuffer response = ChannelBuffers.directBuffer(12);
response.writeShort(0xfe02);
response.writeLong(rawId);
response.writeShort(index);
channel.write(response, remoteAddress);
}
}
示例2: write
import org.jboss.netty.buffer.ChannelBuffer; //導入方法依賴的package包/類
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeLong(rawValue);
return c.writerIndex() - iLenStartIndex;
}
示例3: write
import org.jboss.netty.buffer.ChannelBuffer; //導入方法依賴的package包/類
@Override
public int write(ChannelBuffer c) {
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeLong(rawValue);
return c.writerIndex();
}
示例4: write
import org.jboss.netty.buffer.ChannelBuffer; //導入方法依賴的package包/類
@Override
public int write(ChannelBuffer cb) throws PcepParseException {
//write Object header
int objStartIndex = cb.writerIndex();
int objLenIndex = lsObjHeader.write(cb);
if (objLenIndex <= 0) {
throw new PcepParseException("ObjectLength Index is " + objLenIndex);
}
//write Protocol ID
cb.writeByte(this.protocolId);
//write Flag
cb.writeShort(0);
byte bTemp = 0;
if (syncFlag) {
bTemp = FLAG_SET_S_FLAG;
}
if (removeFlag) {
bTemp = (byte) (bTemp | FLAG_SET_R_FLAG);
}
cb.writeByte(bTemp);
//write LSId
cb.writeLong(lsId);
// Add optional TLV
packOptionalTlv(cb);
//Update object length now
int length = cb.writerIndex() - objStartIndex;
//will be helpful during print().
lsObjHeader.setObjLen((short) length);
cb.setShort(objLenIndex, (short) length);
return cb.writerIndex();
}
示例5: write
import org.jboss.netty.buffer.ChannelBuffer; //導入方法依賴的package包/類
@Override
public int write(ChannelBuffer cb) {
int iLenStartIndex = cb.writerIndex();
if ((afi == Constants.AFI_FLOWSPEC_VALUE) && ((safi == Constants.SAFI_FLOWSPEC_VALUE)
|| (safi == Constants.VPN_SAFI_FLOWSPEC_VALUE))) {
List<BgpValueType> flowSpec = bgpFlowSpecNlri.flowSpecComponents();
ListIterator<BgpValueType> listIterator = flowSpec.listIterator();
boolean isAllFlowTypesIdentical = true;
cb.writeByte(FLAGS);
cb.writeByte(MPREACHNLRI_TYPE);
int mpReachDataIndx = cb.writerIndex();
cb.writeShort(0);
cb.writeShort(afi);
cb.writeByte(safi);
//next hop address
cb.writeByte(0);
//sub network points of attachment
cb.writeByte(0);
if (bgpFlowSpecNlri.routeDistinguisher() != null) {
cb.writeLong(bgpFlowSpecNlri.routeDistinguisher().getRouteDistinguisher());
}
BgpValueType tlv1 = null;
if (listIterator.hasNext()) {
tlv1 = listIterator.next();
}
while (listIterator.hasNext()) {
BgpValueType tlv = listIterator.next();
if (tlv.getType() != tlv1.getType()) {
isAllFlowTypesIdentical = false;
break;
}
}
if (isAllFlowTypesIdentical) {
BgpFlowSpecNlri.updateBufferIdenticalFlowTypes(cb, bgpFlowSpecNlri());
} else {
BgpFlowSpecNlri.updateBufferNonIdenticalFlowTypes(cb, bgpFlowSpecNlri());
}
int fsNlriLen = cb.writerIndex() - mpReachDataIndx;
cb.setShort(mpReachDataIndx, (short) (fsNlriLen - 2));
}
return cb.writerIndex() - iLenStartIndex;
}
示例6: write
import org.jboss.netty.buffer.ChannelBuffer; //導入方法依賴的package包/類
@Override
public int write(ChannelBuffer cb) {
int iLenStartIndex = cb.writerIndex();
if ((afi == Constants.AFI_FLOWSPEC_VALUE) && ((safi == Constants.SAFI_FLOWSPEC_VALUE) ||
(safi == Constants.VPN_SAFI_FLOWSPEC_VALUE))) {
List<BgpValueType> flowSpec = bgpFlowSpecNlri.flowSpecComponents();
ListIterator<BgpValueType> listIterator = flowSpec.listIterator();
boolean isAllFlowTypesIdentical = true;
cb.writeByte(FLAGS);
cb.writeByte(MPUNREACHNLRI_TYPE);
int mpUnReachIndx = cb.writerIndex();
cb.writeShort(0);
cb.writeShort(afi);
cb.writeByte(safi);
if (bgpFlowSpecNlri.routeDistinguisher() != null) {
cb.writeLong(bgpFlowSpecNlri.routeDistinguisher().getRouteDistinguisher());
}
BgpValueType tlv1 = null;
if (listIterator.hasNext()) {
tlv1 = listIterator.next();
}
while (listIterator.hasNext()) {
BgpValueType tlv = listIterator.next();
if (tlv.getType() != tlv1.getType()) {
isAllFlowTypesIdentical = false;
break;
}
}
if (isAllFlowTypesIdentical) {
BgpFlowSpecNlri.updateBufferIdenticalFlowTypes(cb, bgpFlowSpecNlri());
} else {
BgpFlowSpecNlri.updateBufferNonIdenticalFlowTypes(cb, bgpFlowSpecNlri());
}
int fsNlriLen = cb.writerIndex() - mpUnReachIndx;
cb.setShort(mpUnReachIndx, (short) (fsNlriLen - 2));
}
return cb.writerIndex() - iLenStartIndex;
}