[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: What is the most simple way to use svn_stream_t?

From: Greg Stein <gstein_at_gmail.com>
Date: Wed, 2 Mar 2011 06:53:51 -0500

Use svn_stream_from_stringbuf(). That will put the contents of the
file into the stringbuf, which you can access after the cat2() call is
done.

NOTE: be very careful of reading file contents into memory. You really
don't want to try and read a 16 gigabyte file this way.

Cheers,
-g

On Wed, Mar 2, 2011 at 03:29, Grigory Petrov <grigory.v.p_at_gmail.com> wrote:
> Hello.
>
> I need to programmatically get content of a specified revision of
> versioned file. I think svn_client_cat2() will do a good job, but the
> first parameter, "svn_stream_t* out" puzzles me a bit. I have read
> about "streams" in corresponding header file (not a very long reading)
> and it seems to be that using stream as output buffer for
> svn_client_cat2() is terribly complicated: i need to create stream,
> supply it to baton and read/write functions, write code for that
> functions that will queue and dequeue bindary data to and from buffer
> associated with baton... This seems to be a lot of code. Is it any way
> to create a simple svn_stream_t* that will act as a memory buffer so i
> can give it to svn_client_cat2() and on success just get all data
> received as a single memory buffer?
>
> Any comments and insights are welcome!
>
> Best,
> Grigory.
>
Received on 2011-03-02 12:54:32 CET

This is an archived mail posted to the Subversion Dev mailing list.