Example usage for io.netty.buffer ByteBuf writerIndex

List of usage examples for io.netty.buffer ByteBuf writerIndex

Introduction

In this page you can find the example usage for io.netty.buffer ByteBuf writerIndex.

Prototype

public abstract int writerIndex();

Source Link

Document

Returns the writerIndex of this buffer.

Usage

From source file:org.opendaylight.capwap.msgelements.ACDescriptor.java

License:Open Source License

@Override
public int encode(ByteBuf buf) {

    int start = buf.writerIndex();
    //encode stations
    buf.writeBytes(ByteManager.unsignedShortToArray(this.stations));
    //encode limit
    buf.writeBytes(ByteManager.unsignedShortToArray(this.limit));
    //encode activ WTP
    buf.writeBytes(ByteManager.unsignedShortToArray(this.activeWtps));
    //encode MAX wtp
    buf.writeBytes(ByteManager.unsignedShortToArray(this.maxWtps));
    //encode security
    buf.writeByte(this.security);
    //encode rmac
    buf.writeByte(this.rmac);
    //encode reserved
    buf.writeByte(this.reserved);
    //encode dtls
    buf.writeByte(this.dtlsPolicy);
    //encode acinformation sub element
    for (ACInformationSubElement e : this.acInfolist) {
        e.encode(buf);//from w  w w. j  a v a2s  .  c  o  m
    }
    return buf.writerIndex() - start;
}

From source file:org.opendaylight.capwap.msgelements.ACName.java

License:Open Source License

@Override
public int encode(ByteBuf buf) {
    int start = buf.writerIndex();
    buf.writeBytes(this.name);
    return buf.writerIndex() - start;
}

From source file:org.opendaylight.capwap.msgelements.CapwapControlIPV4Addr.java

License:Open Source License

@Override
public int encode(ByteBuf buf) {
    int start = buf.writerIndex();
    this.ipv4.encode(buf);
    buf.writeBytes(ByteManager.unsignedShortToArray(this.wtpCount));

    return buf.writerIndex() - start;
}

From source file:org.opendaylight.capwap.msgelements.CapwapTimers.java

License:Open Source License

@Override
public int encode(ByteBuf buf) {
    int start = buf.writerIndex();

    buf.writeByte(ByteManager.shortToUnsingedByte(this.discovery));
    buf.writeByte(ByteManager.shortToUnsingedByte(this.echoReq));
    return buf.writerIndex() - start;
}

From source file:org.opendaylight.capwap.msgelements.CapwapTransportProtocol.java

License:Open Source License

@Override
public int encode(ByteBuf buf) {
    int start = buf.writerIndex();
    buf.writeByte(this.protocol);
    return buf.writerIndex() - start;
}

From source file:org.opendaylight.capwap.msgelements.DataTransferData.java

License:Open Source License

@Override
public int encode(ByteBuf buf) {
    int start = buf.writerIndex();
    buf.writeByte(ByteManager.shortToUnsingedByte(this.dataType));
    buf.writeByte(ByteManager.shortToUnsingedByte(this.dataMode));
    buf.writeBytes(ByteManager.unsignedShortToArray(this.dataLength));
    buf.writeBytes(this.data);
    return buf.writerIndex() - start;
}

From source file:org.opendaylight.capwap.msgelements.DataTransferMode.java

License:Open Source License

@Override
public int encode(ByteBuf buf) {
    int start = buf.writerIndex();
    buf.writeByte(this.mode);
    return buf.writerIndex() - start;
}

From source file:org.opendaylight.capwap.msgelements.DecryptionErrorPeriod.java

License:Open Source License

@Override
public int encode(ByteBuf buf) {
    int start = buf.writerIndex();
    buf.writeByte(ByteManager.shortToUnsingedByte(this.radioId));
    buf.writeBytes(ByteManager.unsignedShortToArray(this.getReportInterval()));
    return buf.writerIndex() - start;
}

From source file:org.opendaylight.capwap.msgelements.DecryptionErrorReport.java

License:Open Source License

@Override
public int encode(ByteBuf buf) {
    int start = buf.writerIndex();

    buf.writeByte(ByteManager.shortToUnsingedByte(this.radioId));
    buf.writeByte(ByteManager.shortToUnsingedByte(this.numEntries));
    for (MacAddress e : this.macAddressList) {
        e.encode(buf);//from  ww  w . ja v a  2 s  .com
    }
    return buf.writerIndex() - start;
}

From source file:org.opendaylight.capwap.msgelements.DeleteMacAclEntry.java

License:Open Source License

@Override
public int encode(ByteBuf buf) {
    int start = buf.writerIndex();

    buf.writeByte(ByteManager.shortToUnsingedByte(this.numEntries));
    buf.writeBytes(ByteManager.unsignedShortToArray(this.macAddrLength));
    for (MacAddress e : this.macList) {
        e.encode(buf);/*from  w  ww  . j a va  2  s. c  om*/
    }
    return buf.writerIndex() - start;
}