All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.threerings.nexus.distrib.Streamer_DValue Maven / Gradle / Ivy

The newest version!
//
// Nexus Core - a framework for developing distributed applications
// http://github.com/threerings/nexus/blob/master/LICENSE

package com.threerings.nexus.distrib;

import com.threerings.nexus.io.Streamable;
import com.threerings.nexus.io.Streamer;

/**
 * Handles the streaming of {@link DValue} and/or nested classes.
 */
public class Streamer_DValue
{
    /**
     * Handles the streaming of {@link DValue.ChangeEvent} instances.
     */
    public static class ChangeEvent implements Streamer> {
        @Override
        public Class getObjectClass () {
            return DValue.ChangeEvent.class;
        }

        @Override
        public void writeObject (Streamable.Output out, DValue.ChangeEvent obj) {
            writeObjectImpl(out, obj);
        }

        @Override
        public DValue.ChangeEvent readObject (Streamable.Input in) {
            return new DValue.ChangeEvent(
                in.readInt(),
                in.readShort(),
                in.readValue()
            );
        }

        public static  void writeObjectImpl (Streamable.Output out, DValue.ChangeEvent obj) {
            Streamer_DAttribute.Event.writeObjectImpl(out, obj);
            out.writeValue(obj._value);
        }
    }

    // no streamer for non-Streamable enclosing class: DValue
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy