StreamableInterfaceExtension Class Reference

Contains functions that provide "constructors" for objects that implement the IStreamable interface, given a provided Stream

Static Public Member Functions

static IStreamableImplmentingClass CreateFromStream< IStreamableImplmentingClass > (System.IO.BinaryReader readStream)
 Instantiates a new instance of the IStreamable type T, and fills it with data from the stream by invoking it's ReadFromStream member.
 
static IStreamableImplmentingClass CreateFromStream< IStreamableImplmentingClass > (System.IO.BinaryReader readStream, params object[] constructorParams)
 For classes that implement IStreamable but do not have a parameterless constructor, must use this version of the CreareFromStream function, and provide the parameters to be used by the constructor.
 
static int ReadFromStream (this IStreamable streamableObject, System.IO.Stream readStream)
 IStreamable extension function that reads the streamableObject from the specified stream. Simply invokes the streamableObject's ReadFromStream function, but performs required conversion from Stream to BbinaryStream automatically.
 
static int ReadIStreamable (this System.IO.BinaryReader readStream, IStreamable streamableObject)
 System.IO.BinaryReader extension function that reads the streamableObject from the specified binary writer. Simply invokes the streamableObject's ReadFromStream function.
 
static void SendToStream (this IStreamable streamableObject, System.IO.Stream writeStream)
 IStreamable extension function that sends the streamableObject to the specified Stream. Simply invokes the streamableObject's SendToStream function.
 
static void Write (this System.IO.BinaryWriter writeStream, IStreamable streamableObject)
 System.IO.BinaryWriter extension function that sends the streamableObject to the specified binary writer. Simply invokes the streamableObject's SendToStream function.