public static void WriteNetwork(this MemoryStream ms, int i)
        {
            var buffer = InitializeBuffer();

            BinaryBuffer.WriteIntNetwork(buffer, 0, i);
            ms.Write(buffer, 0, 4);
        }
        public static int WriteNetwork(
            this MemoryStream ms, int[] array, int length)
        {
            if (array == null)
            {
                return(0);
            }

            var buffer = InitializeBuffer();

            for (var i = 0; i < length; ++i)
            {
                BinaryBuffer.WriteIntNetwork(buffer, 0, (short)array[i]);
                ms.Write(buffer, 0, 2);
            }

            return(length * 4);
        }