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