2 * This file is part of JSTUN.
4 * Copyright (c) 2005 Thomas King <king@t-king.de> - All rights
7 * This software is licensed under either the GNU Public License (GPL),
8 * or the Apache 2.0 license. Copies of both license agreements are
9 * included in this distribution.
12 package de.javawi.jstun.attribute;
14 import de.javawi.jstun.util.Utility;
15 import de.javawi.jstun.util.UtilityException;
17 public class Dummy extends MessageAttribute {
20 super(MessageAttributeType.Dummy);
23 public void setLengthValue(int length) {
24 this.lengthValue = length;
27 public byte[] getBytes() throws UtilityException {
28 byte[] result = new byte[lengthValue + 4];
29 // message attribute header
31 System.arraycopy(Utility.integerToTwoBytes(typeToInteger(type)), 0, result, 0, 2);
33 System.arraycopy(Utility.integerToTwoBytes(lengthValue), 0, result, 2, 2);
37 public static Dummy parse(byte[] data) {
38 Dummy dummy = new Dummy();
39 dummy.setLengthValue(data.length);