// Path: core/src/main/java/com/threerings/nexus/distrib/DService.java
// public abstract class DService<T extends NexusService> implements DAttribute
// {
//     /** Used to create service attributes. */
//     public interface Factory<T extends NexusService>
//     {
//         /** Creates a service attribute with the supplied owner. */
//         DService<T> createService (NexusObject owner);
//     }
// 
//     /** An implementation detail used by service dispatchers. */
//     public static abstract class Dispatcher<T extends NexusService> extends DService<T> {
//         /** Dispatches a service call that came in over the network. */
//         public RFuture<?> dispatchCall (short methodId, Object[] args) {
//             throw new IllegalArgumentException("Unknown service method [id=" + methodId +
//                                                ", obj=" + _owner.getClass().getName() +
//                                                ", attrIdx=" + _index + "]");
//         }
// 
//         protected Dispatcher (NexusObject owner) {
//             super(owner);
//         }
// 
//         /** Used to concisely, and without warning, cast arguments of generic type. */
//         @SuppressWarnings("unchecked")
//         protected final <C> C cast (Object obj) {
//             return (C)obj;
//         }
//     }
// 
//     /** Returns the service encapsulated by this attribute. */
//     public abstract T get ();
// 
//     /** Returns the class for the service encapsulated by this attribute. */
//     public abstract Class<T> getServiceClass ();
// 
//     @Override public void readContents (Streamable.Input in) {
//         // NOOP
//     }
// 
//     @Override public void writeContents (Streamable.Output out) {
//         // NOOP
//     }
// 
//     protected DService (NexusObject owner) {
//         _owner = owner;
//         _index = owner.registerAttr(this);
//     }
// 
//     /** Used by marshallers to dispatch calls over the network. */
//     protected <R> RFuture<R> postCall (short methodId, Object... args) {
//         RPromise<R> result = RPromise.create();
//         _owner.postCall(_index, methodId, args, result);
//         return result;
//     }
// 
//     /** Used by marshallers to dispatch calls over the network. */
//     protected void postVoidCall (short methodId, Object... args) {
//         _owner.postCall(_index, methodId, args, null);
//     }
// 
//     /** The object that owns this attribute. */
//     protected final NexusObject _owner;
// 
//     /** The index of this attribute in its containing object. */
//     protected final short _index;
// }
// 
// Path: core/src/main/java/com/threerings/nexus/distrib/NexusService.java
// public interface NexusService
// {
// }


import com.threerings.nexus.distrib.DService;
import com.threerings.nexus.distrib.NexusService;
import java.util.Collection;
import java.util.Iterator;
            }
            return data;
        }

        /**
         * Reads a single value from the input (which must have been written via a call to {@link
         * Output#writeValue}).
         */
        public <T> T readValue () {
            return this.<T>readStreamer().readObject(this);
        }

        /**
         * Reads a series of same-typed values from the input, storing them into {@code into} using
         * the {@link Collection#add} method. The values must have been written via a call to
         * {@link Output#writeValues}.
         */
        public <T> void readValues (Collection<T> into) {
            int count = readShort();
            if (count > 0) {
                Streamer<T> s = this.<T>readStreamer();
                for (; count > 0; --count) {
                    into.add(s.readObject(this));
                }
            }
        }

        /**
         * Reads a service factory, which can be used to create Nexus service attributes.
         */
// Path: core/src/main/java/com/threerings/nexus/distrib/DService.java
// public abstract class DService<T extends NexusService> implements DAttribute
// {
//     /** Used to create service attributes. */
//     public interface Factory<T extends NexusService>
//     {
//         /** Creates a service attribute with the supplied owner. */
//         DService<T> createService (NexusObject owner);
//     }
// 
//     /** An implementation detail used by service dispatchers. */
//     public static abstract class Dispatcher<T extends NexusService> extends DService<T> {
//         /** Dispatches a service call that came in over the network. */
//         public RFuture<?> dispatchCall (short methodId, Object[] args) {
//             throw new IllegalArgumentException("Unknown service method [id=" + methodId +
//                                                ", obj=" + _owner.getClass().getName() +
//                                                ", attrIdx=" + _index + "]");
//         }
// 
//         protected Dispatcher (NexusObject owner) {
//             super(owner);
//         }
// 
//         /** Used to concisely, and without warning, cast arguments of generic type. */
//         @SuppressWarnings("unchecked")
//         protected final <C> C cast (Object obj) {
//             return (C)obj;
//         }
//     }
// 
//     /** Returns the service encapsulated by this attribute. */
//     public abstract T get ();
// 
//     /** Returns the class for the service encapsulated by this attribute. */
//     public abstract Class<T> getServiceClass ();
// 
//     @Override public void readContents (Streamable.Input in) {
//         // NOOP
//     }
// 
//     @Override public void writeContents (Streamable.Output out) {
//         // NOOP
//     }
// 
//     protected DService (NexusObject owner) {
//         _owner = owner;
//         _index = owner.registerAttr(this);
//     }
// 
//     /** Used by marshallers to dispatch calls over the network. */
//     protected <R> RFuture<R> postCall (short methodId, Object... args) {
//         RPromise<R> result = RPromise.create();
//         _owner.postCall(_index, methodId, args, result);
//         return result;
//     }
// 
//     /** Used by marshallers to dispatch calls over the network. */
//     protected void postVoidCall (short methodId, Object... args) {
//         _owner.postCall(_index, methodId, args, null);
//     }
// 
//     /** The object that owns this attribute. */
//     protected final NexusObject _owner;
// 
//     /** The index of this attribute in its containing object. */
//     protected final short _index;
// }
// 
// Path: core/src/main/java/com/threerings/nexus/distrib/NexusService.java
// public interface NexusService
// {
// }


// Path: core/src/main/java/com/threerings/nexus/io/Streamable.java
import com.threerings.nexus.distrib.DService;
import com.threerings.nexus.distrib.NexusService;
import java.util.Collection;
import java.util.Iterator;

            }
            return data;
        }

        /**
         * Reads a single value from the input (which must have been written via a call to {@link
         * Output#writeValue}).
         */
        public <T> T readValue () {
            return this.<T>readStreamer().readObject(this);
        }

        /**
         * Reads a series of same-typed values from the input, storing them into {@code into} using
         * the {@link Collection#add} method. The values must have been written via a call to
         * {@link Output#writeValues}.
         */
        public <T> void readValues (Collection<T> into) {
            int count = readShort();
            if (count > 0) {
                Streamer<T> s = this.<T>readStreamer();
                for (; count > 0; --count) {
                    into.add(s.readObject(this));
                }
            }
        }

        /**
         * Reads a service factory, which can be used to create Nexus service attributes.
         */
        public abstract <T extends NexusService> DService.Factory<T> readService ();