@Override
    public Raw clone() {
        Raw raw = (Raw) super.clone();
        if (value.hasArray()) {
            raw.value = ByteBuffer.wrap(Arrays.copyOf(value.array(), value.array().length));
            raw.value.position(value.position());
        } else {
            byte[] copyBuf = new byte[value.capacity()];
            int origPos = value.position();
            value.position(0);
            value.get(copyBuf);
            value.position(origPos);
            raw.value = ByteBuffer.wrap(copyBuf);
            raw.value.position(value.position());
        }
        return raw;
    }
A field value which is an array of byte data

@author Einar M R Rosenvinge
document/src/main/java/com/yahoo/document/datatypes/Raw.java