Java tutorial
/* * Copyright (c) 2015 Mahesh Govind and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.capwap.msgelements; import io.netty.buffer.ByteBuf; import org.opendaylight.capwap.ODLCapwapConsts; import org.opendaylight.capwap.ODLCapwapMessageElement; import org.opendaylight.capwap.utils.ByteManager; /** * Created by flat on 17/04/16. */ public class ImageIdentifier implements ODLCapwapMessageElement { int msgElm = 0; long vendorID = 0; byte[] data = null; int length = 0; public ImageIdentifier() { this.msgElm = ODLCapwapConsts.CAPWAP_ELMT_TYPE_IMAGE_IDENTIFIER; } @Override public int encode(ByteBuf buf) { int start = buf.writerIndex(); buf.writeBytes(ByteManager.unsignedIntToArray(this.vendorID)); buf.writeBytes(this.data); return buf.writerIndex() - start; } public int getLength() { return length; } public int getMsgElm() { return msgElm; } public void setMsgElm(int msgElm) { this.msgElm = msgElm; } public long getVendorID() { return vendorID; } public void setVendorID(long vendorID) { this.vendorID = vendorID; } public byte[] getData() { return data; } public void setData(byte[] data) { this.data = data; this.length = data.length; } @Override public ODLCapwapMessageElement decode(ByteBuf buf) { return null; } @Override public int getType() { return this.msgElm; } }