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

com.threerings.nexus.distrib.Streamer_DSet 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 DSet} and/or nested classes.
 */
public class Streamer_DSet
{
    /**
     * Handles the streaming of {@link DSet.AddEvent} instances.
     */
    public static class AddEvent
        implements Streamer>
    {
        @Override
        public Class getObjectClass () {
            return DSet.AddEvent.class;
        }

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

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

        public static  void writeObjectImpl (Streamable.Output out, DSet.AddEvent obj) {
            Streamer_DAttribute.Event.writeObjectImpl(out, obj);
            out.writeValue(obj._elem);
        }
    }

    /**
     * Handles the streaming of {@link DSet.RemoveEvent} instances.
     */
    public static class RemoveEvent
        implements Streamer>
    {
        @Override
        public Class getObjectClass () {
            return DSet.RemoveEvent.class;
        }

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

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

        public static  void writeObjectImpl (Streamable.Output out, DSet.RemoveEvent obj) {
            Streamer_DAttribute.Event.writeObjectImpl(out, obj);
            out.writeValue(obj._elem);
        }
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy