[Vala] Help with Soup: get_chunk () vs. flatten ().data



Hello,


I'm following some c code as an example that uses MesageBody.get_chunk 
in a while loop.  

I am curious if/why this would be better than using  
Soup.MessageBody.flatten. 

the c code:
        while ((buffer = soup_message_body_get_chunk (http_message->response_body, offset))) {
                if (!str)
                        str = g_string_new ("");
                g_string_append_len (str, buffer->data, buffer->length);

                offset += buffer->length;
                soup_buffer_free (buffer);
        }

the proposed vala:
        string str = (string) message.response_body.flatten ().data;

-- 
Regards,
Brian Winfrey




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]