com.threerings.io
Interface Streamable

All Known Subinterfaces:
DSet.Entry, Streamable.Closure
All Known Implementing Classes:
AdminMarshaller, AdminMarshaller.ConfigInfoMarshaller, AESAuthRequest, AgentObject, AttributeChangedEvent, AuthRequest, AuthResponse, AuthResponseData, BlockingCommunicator.TerminationMessage, BodyLocal, BodyMarshaller, BodyObject, BootstrapData, BootstrapNotification, BureauAuthName, BureauClientObject, BureauCredentials, BureauMarshaller, ChannelSpeakMarshaller, ChatChannel, ChatChannelManager.ChannelAction, ChatHistory.Entry, ChatMarshaller, ChatMarshaller.TellMarshaller, ChatMessage, ClientInfo, ClientLocal, ClientObject, CompoundDownstreamMessage, CompoundEvent, CompoundUpstreamMessage, ConfigObject, Credentials, CrowdClientInfo, CrowdNodeObject, CrowdPeerMarshaller, DEvent, DObject, DObjectAddress, DownstreamMessage, DSet, ElementUpdatedEvent, EntryAddedEvent, EntryEvent, EntryRemovedEvent, EntryUpdatedEvent, EventNotification, FailureResponse, ForwardEventRequest, InvocationMarshaller, InvocationMarshaller.ConfirmMarshaller, InvocationMarshaller.ListenerMarshaller, InvocationMarshaller.ResultMarshaller, InvocationNotificationEvent, InvocationObject, InvocationReceiver.Registration, InvocationRequestEvent, InvocationResponseEvent, LocationMarshaller, LocationMarshaller.MoveMarshaller, LogoffRequest, Message, MessageEvent, Name, NamedEvent, NodeObject, NodeObject.CacheData, NodeObject.Lock, ObjectAddedEvent, ObjectDestroyedEvent, ObjectRemovedEvent, ObjectResponse, OccupantInfo, OidList, PeerAuthName, PeerBootstrapData, PeerCreds, PeerManager.NodeAction, PeerManager.NodeRequest, PeerMarshaller, PingRequest, Place, PlaceConfig, PlaceObject, PongResponse, PresentsConMgrStats, PresentsDObjectMgr.AccessObjectEvent, PublicKeyCredentials, RegistrationMarshaller, ReleaseLockEvent, SecureRequest, SecureResponse, ServerMessageEvent, ServiceCreds, SimpleEntry, SimpleStreamableObject, SpeakMarshaller, StreamableArrayIntSet, StreamableArrayList, StreamableEnumSet, StreamableHashIntMap, StreamableHashMap, StreamableHashSet, StreamableIntIntMap, StreamablePoint, StreamableRectangle, StreamableTuple, SubscribeRequest, SystemMessage, TellFeedbackMessage, ThrottleUpdatedMessage, TimeBaseMarshaller, TimeBaseMarshaller.GotTimeBaseMarshaller, TimeBaseObject, TokenRing, TransmitDatagramsRequest, UnsubscribeRequest, UnsubscribeResponse, UpdateThrottleMessage, UpstreamMessage, UserMessage, UsernamePasswordCreds, UserSystemMessage

public interface Streamable

Marks an object as streamable, meaning that it can be written to ObjectOutputStream instances and read from ObjectInputStream instances.

All non-transient, non-NotStreamable fields will be automatically written and restored for a Streamable instance. Classes that wish to stream transient fields or customize the streaming process should implement methods with the following signatures:

public void writeObject (ObjectOutputStream out); public void readObject (ObjectInputStream in);

They can then handle the entirety of the streaming process, or call ObjectOutputStream.defaultWriteObject() and ObjectInputStream.defaultReadObject() from within their writeObject and readObject methods to perform the standard streaming in addition to their customized behavior.

Streamable classes must either have a zero-argument constructor, in which case any number of other constructors are allowed, but the zero-argument constructor will be used when unserializing an instance; or they must have exactly one non-zero-argument constructor, and that constructor will be called when unserializing an instance with "zero/null" values (meaning all primitive types will be passed the appropriate zero value, and all reference types will be passed null. This latter approach can even be used by classes with final fields, as the zero/null values will be overwritten during unstreaming.


Nested Class Summary
static interface Streamable.Closure
          A marker interface for streamable classes that expect to be extended anonymously, but for which the implicit outer class reference can (and should) be ignored.