import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
import Name from "./Name.js";

export class NameSerializationAdapter extends BinaryClassSerializationAdapter {
    klass = Name;
    version = 0;

    /**
     *
     * @param {BinaryBuffer} buffer
     * @param {Name} value
     */
    serialize(buffer, value) {
        buffer.writeUTF8String(value.getValue());
    }


    /**
     *
     * @param {BinaryBuffer} buffer
     * @param {Name} value
     */
    deserialize(buffer, value) {
        const str = buffer.readUTF8String();

        value.set(str);
    }

}
