class ByteArray implements Serializable, Cloneable {

    public Object clone() throws CloneNotSupportedException {
        if (value.isDirect()) {
            throw new CloneNotSupportedException("Can't clone a direct buffer");
        }
        ByteArray object = (ByteArray) super.clone();

        value.clear();
        byte[] bytes = new byte[value.remaining()];
        value.get(bytes);

        object.value = ByteBuffer.wrap(bytes);
        object.value.order(value.order());

        return object;
    }

    public  ByteArray(int size);
    public  ByteArray(int size, String encoding);
    public  ByteArray(int size, ByteOrder order);
    public  ByteArray(int size, String encoding, ByteOrder order);
    public  ByteArray(byte[] array);
    public  ByteArray(byte[] array, ByteOrder order);
    public  ByteArray(byte[] array, String encoding);
    public  ByteArray(byte[] array, String encoding, ByteOrder order);
    public  ByteArray(ByteArray byteArray);
    public  ByteArray(ByteBuffer buffer);
    public  ByteArray(ByteBuffer buffer, String encoding);

}