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


Java ChannelBuffer.readLong方法代碼示例

本文整理匯總了Java中org.jboss.netty.buffer.ChannelBuffer.readLong方法的典型用法代碼示例。如果您正苦於以下問題:Java ChannelBuffer.readLong方法的具體用法?Java ChannelBuffer.readLong怎麽用?Java ChannelBuffer.readLong使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jboss.netty.buffer.ChannelBuffer的用法示例。


在下文中一共展示了ChannelBuffer.readLong方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readValue

import org.jboss.netty.buffer.ChannelBuffer; //導入方法依賴的package包/類
private long readValue(ChannelBuffer buf, int length, boolean signed) {
    switch (length) {
        case 1:
            return signed ? buf.readByte() : buf.readUnsignedByte();
        case 2:
            return signed ? buf.readShort() : buf.readUnsignedShort();
        case 4:
            return signed ? buf.readInt() : buf.readUnsignedInt();
        default:
            return buf.readLong();
    }
}
 
開發者ID:bamartinezd,項目名稱:traccar-service,代碼行數:13,代碼來源:RuptelaProtocolDecoder.java

示例2: read

import org.jboss.netty.buffer.ChannelBuffer; //導入方法依賴的package包/類
/**
 * Reads the Extended Tag.
 *
 * @param cb ChannelBuffer
 * @return object of BgpPrefixAttrExtRouteTag
 * @throws BgpParseException while parsing BgpPrefixAttrExtRouteTag
 */
public static BgpPrefixAttrExtRouteTag read(ChannelBuffer cb)
        throws BgpParseException {
    ArrayList<Long> pfxExtRouteTag = new ArrayList<Long>();
    long temp;

    short lsAttrLength = cb.readShort();
    int len = lsAttrLength / ATTR_PREFIX_EXT_LEN;

    if (cb.readableBytes() < lsAttrLength) {
        Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
                               BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
                               lsAttrLength);
    }

    for (int i = 0; i < len; i++) {
        temp = cb.readLong();
        pfxExtRouteTag.add(new Long(temp));
    }

    return new BgpPrefixAttrExtRouteTag(pfxExtRouteTag);
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:29,代碼來源:BgpPrefixAttrExtRouteTag.java

示例3: decodeEventData

import org.jboss.netty.buffer.ChannelBuffer; //導入方法依賴的package包/類
private void decodeEventData(Position position, ChannelBuffer buf, int event) {
    switch (event) {
        case 2:
        case 40:
            buf.readUnsignedByte();
            break;
        case 9:
            buf.readUnsignedMedium();
            break;
        case 31:
        case 32:
            buf.readUnsignedShort();
            break;
        case 38:
            buf.skipBytes(4 * 9);
            break;
        case 113:
            buf.readUnsignedInt();
            buf.readUnsignedByte();
            break;
        case 121:
        case 142:
            buf.readLong();
            break;
        case 130:
            buf.readUnsignedInt(); // incorrect
            break;
        case 188:
            decodeEB(position, buf);
            break;
        default:
            break;
    }
}
 
開發者ID:bamartinezd,項目名稱:traccar-service,代碼行數:35,代碼來源:AplicomProtocolDecoder.java

示例4: getOspfHeader

import org.jboss.netty.buffer.ChannelBuffer; //導入方法依賴的package包/類
/**
 * Gets the OSPF packet Header.
 *
 * @param channelBuffer channel buffer instance.
 * @return Ospf Header instance.
 */
private OspfPacketHeader getOspfHeader(ChannelBuffer channelBuffer) throws Exception {
    OspfPacketHeader ospfPacketHeader = new OspfPacketHeader();

    // Determine OSPF version & Packet Type
    int version = channelBuffer.readByte(); //byte 1 is ospf version
    int packetType = channelBuffer.readByte(); //byte 2 is ospf packet type

    // byte 3 & 4 combine is packet length.
    int packetLength = channelBuffer.readShort();

    byte[] tempByteArray = new byte[OspfUtil.FOUR_BYTES];
    channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES);
    Ip4Address routerId = Ip4Address.valueOf(tempByteArray);

    tempByteArray = new byte[OspfUtil.FOUR_BYTES];
    channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES);
    Ip4Address areaId = Ip4Address.valueOf(tempByteArray);

    int checkSum = channelBuffer.readUnsignedShort();
    int auType = channelBuffer.readUnsignedShort();
    int authentication = (int) channelBuffer.readLong();

    ospfPacketHeader.setOspfVer(version);
    ospfPacketHeader.setOspftype(packetType);
    ospfPacketHeader.setOspfPacLength(packetLength);
    ospfPacketHeader.setRouterId(routerId);
    ospfPacketHeader.setAreaId(areaId);
    ospfPacketHeader.setChecksum(checkSum);
    ospfPacketHeader.setAuthType(auType);
    ospfPacketHeader.setAuthentication(authentication);

    return ospfPacketHeader;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:40,代碼來源:OspfMessageReader.java

示例5: read

import org.jboss.netty.buffer.ChannelBuffer; //導入方法依賴的package包/類
/**
 * Reads from the channel buffer and returns Object of PcepLSObject.
 *
 * @param cb of type channel buffer
 * @return Object of PcepLSObject
 * @throws PcepParseException if mandatory fields are missing
 */
public static PcepLSObject read(ChannelBuffer cb) throws PcepParseException {
    log.debug("read");

    PcepObjectHeader lsObjHeader;
    byte protocolId;
    // 2-flags
    boolean removeFlag;
    boolean syncFlag;
    long lsId;
    List<PcepValueType> optionalTlvList;

    lsObjHeader = PcepObjectHeader.read(cb);

    //take only LSObject buffer.
    ChannelBuffer tempCb = cb.readBytes(lsObjHeader.getObjLen() - OBJECT_HEADER_LENGTH);

    protocolId = tempCb.readByte();
    //ignore first two bytes of Flags
    tempCb.readShort();

    Integer iTemp = (int) tempCb.readByte(); //read 3rd byte Flag
    syncFlag = (iTemp & FLAG_SET_S_FLAG) == FLAG_SET_S_FLAG;
    removeFlag = (iTemp & FLAG_SET_R_FLAG) == FLAG_SET_R_FLAG;

    lsId = tempCb.readLong();

    // parse optional TLV
    optionalTlvList = parseOptionalTlv(tempCb);

    return new PcepLSObjectVer1(lsObjHeader, protocolId, removeFlag, syncFlag, lsId, optionalTlvList);
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:39,代碼來源:PcepLSObjectVer1.java

示例6: read

import org.jboss.netty.buffer.ChannelBuffer; //導入方法依賴的package包/類
/**
 * Reads route distinguisher from channelBuffer.
 *
 * @param cb channelBuffer
 * @return object of RouteDistinguisher
 */
public static RouteDistinguisher read(ChannelBuffer cb) {
    return new RouteDistinguisher(cb.readLong());
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:10,代碼來源:RouteDistinguisher.java


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