avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Massie <m...@cloudera.com>
Subject Re: C impl, getting a schema back as json C string
Date Tue, 16 Mar 2010 21:35:21 GMT
Jeff-

If you look in avro.h, you'll see the following function...

int avro_schema_to_json(avro_schema_t schema, avro_writer_t out);

.... which write a schema to an avro_writer_t.  This allows you to write the
schema to memory or a file... create the writer using...

avro_writer_t avro_writer_file(FILE * fp);
avro_writer_t avro_writer_memory(const char *buf, int64_t len);

I just realized that

int64_t avro_writer_tell(avro_writer_t writer)

is not in avro.h and it should be.  It will tell you the size of the data
written to the writer.

Hope this help.  Keep the questions coming.

-Matt







On Sun, Mar 14, 2010 at 10:14 PM, Jeff Hodges <jhodges@twitter.com> wrote:
> (Note, that I've passed this in memory avro_writer_t to
> avro_schema_to_json and I'm just trying to get the string inside of it
> out.)
> --
> Jeff
>
> On Sun, Mar 14, 2010 at 12:39 AM, Jeff Hodges <jhodges@twitter.com> wrote:
>> I can't figure out the API for turning an avro_schema_t back into an
>> in-memory string of json data.
>>
>> It seems I'm supposed to get it out of an avro_writer_t that I've
>> created with avro_writer_memory() but I'm a little lost once we start
>> having to use avro_writer_to_memory() to get back the original
>> avro_memory_writer_t.
>>
>> Sample code?
>> --
>> Jeff
>>
>

Mime
View raw message