2 * Copyright (c) 2017 Inocybe Technologies and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.cluster.messaging;
10 import java.io.Serializable;
11 import java.util.Arrays;
14 * Serializable message that stores a byte[].
16 * @author Thomas Pantelis
18 public class BytesMessage implements Serializable {
19 private static final long serialVersionUID = 1L;
21 private final byte[] bytes;
23 public BytesMessage(byte[] bytes) {
24 this.bytes = Arrays.copyOf(bytes, bytes.length);
28 public int hashCode() {
29 return Arrays.hashCode(bytes);
33 public boolean equals(Object obj) {
40 if (getClass() != obj.getClass()) {
43 BytesMessage other = (BytesMessage) obj;
44 return Arrays.equals(bytes, other.bytes);
48 public String toString() {
49 return "BytesMessage [bytes=" + Arrays.toString(bytes) + "]";