blob: b6f17680699ae39ee943893146ff0777dae014fd [file] [log] [blame]
tomf110fff2014-09-26 00:38:18 -07001package org.onlab.onos.foo;
2
3import org.onlab.nio.AbstractMessage;
4
5/**
6 * Fixed-length message.
7 */
8public class TestMessage extends AbstractMessage {
9
10 private final byte[] data;
11
12 /**
13 * Creates a new message with the specified length.
14 *
15 * @param length message length
16 */
17 public TestMessage(int length) {
18 this.length = length;
19 data = new byte[length];
20 }
21
22 /**
23 * Creates a new message with the specified data.
24 *
25 * @param data message data
26 */
27 TestMessage(byte[] data) {
28 this.length = data.length;
29 this.data = data;
30 }
31
32 /**
33 * Gets the backing byte array data.
34 *
35 * @return backing byte array
36 */
37 public byte[] data() {
38 return data;
39 }
40
41}