package de.tudarmstadt.informatik.hostage.wrapper; /** * Wrapper class to use a byte array as an Object. * @author Mihai Plasoianu * */ public class ByteArray { private final byte[] array; /** * Constructor without parameters. Sets the internal array to null. */ public ByteArray() { this.array = null; } /** * Constructor with a byte arrays as parameter. Sets the internal array to the given. * @param array The byte array that should be wrapped. */ public ByteArray(byte[] array) { this.array = array; } /** * Constructor with a String as parameter. Sets the internal array to a byte array representation of the string. * @param string */ public ByteArray(String string) { this.array = string.getBytes(); } /** * Returns the byte array. * @return The byte array */ public byte[] get() { return array; } /** * Determines size of the array. * @return Size of the array */ public int size() { return array.length; } @Override public String toString() { return new String(array); } }