Esempio n. 1
0
 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;
 }
Esempio n. 2
0
        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);
        }