@Override
    public void write(ByteBuffer value, String name, ByteBuffer defVal) throws IOException {
        if (value == null || value.equals(defVal)) {
            return;
        }
        
        int position = value.position();
        value.rewind();
        byte[] array = new byte[value.remaining()];
        value.get(array);
        value.position(position);

        writePrimitiveArrayHelper(array, name);
    }
appends a new Element with the given name to currentElement, sets
currentElement to be new Element, and returns the new Element as well
jme3-plugins/src/xml/java/com/jme3/export/xml/DOMOutputCapsule.java