當前位置: 首頁>>代碼示例>>Java>>正文


Java ChannelBuffer.writeLong方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:bamartinezd,項目名稱:traccar-service,代碼行數:10,代碼來源:AtrackProtocolDecoder.java

示例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;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:9,代碼來源:PcepLabelDbVerTlv.java

示例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();
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:8,代碼來源:StatefulLspDbVerTlv.java

示例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();
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:44,代碼來源:PcepLSObjectVer1.java

示例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;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:52,代碼來源:MpReachNlri.java

示例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;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:46,代碼來源:MpUnReachNlri.java


注:本文中的org.jboss.netty.buffer.ChannelBuffer.writeLong方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。