private byte[] packObject(ProtocolObject obj) { MemoryStream memStream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(memStream); PacketOutputStream pos = new PacketOutputStream(writer); obj.save(pos); byte[] outBuf = new byte[memStream.Length]; memStream.Position = 0; memStream.Read(outBuf, 0, (int)memStream.Length); return outBuf; }
private byte[] packObject(ProtocolObject obj) { MemoryStream memStream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(memStream); PacketOutputStream pos = new PacketOutputStream(writer); obj.save(pos); byte[] outBuf = new byte[memStream.Length]; memStream.Position = 0; memStream.Read(outBuf, 0, (int)memStream.Length); return(outBuf); }