void avro_reader_dump(avro_reader_t reader, FILE * fp) { if (is_memory_io(reader)) { dump(fp, (char *)avro_reader_to_memory(reader)->buf, avro_reader_to_memory(reader)->read); } }
int64_t avro_writer_tell(avro_writer_t writer) { if (is_memory_io(writer)) { return avro_writer_to_memory(writer)->written; } return -1; }
void avro_writer_dump(avro_writer_t writer, FILE * fp) { if (is_memory_io(writer)) { dump(fp, (char *)avro_writer_to_memory(writer)->buf, avro_writer_to_memory(writer)->written); } }
void avro_reader_reset(avro_reader_t reader) { if (is_memory_io(reader)) { avro_reader_to_memory(reader)->read = 0; } }
void avro_writer_free(avro_writer_t writer) { if (is_memory_io(writer)) { free(avro_writer_to_memory(writer)); } else if (is_file_io(writer)) { fclose(avro_writer_to_file(writer)->fp); free(avro_writer_to_file(writer)); } }
void avro_reader_free(avro_reader_t reader) { if (is_memory_io(reader)) { free(avro_reader_to_memory(reader)); } else if (is_file_io(reader)) { fclose(avro_reader_to_file(reader)->fp); free(avro_reader_to_file(reader)); } }
void avro_writer_memory_set_dest(avro_writer_t writer, const char *buf, int64_t len) { if (is_memory_io(writer)) { struct _avro_writer_memory_t *mem_writer = avro_writer_to_memory(writer); mem_writer->buf = buf; mem_writer->len = len; mem_writer->written = 0; } }
void avro_reader_memory_set_source(avro_reader_t reader, const char *buf, int64_t len) { if (is_memory_io(reader)) { struct _avro_reader_memory_t *mem_reader = avro_reader_to_memory(reader); mem_reader->buf = buf; mem_reader->len = len; mem_reader->read = 0; } }
void avro_writer_free(avro_writer_t writer) { if (is_memory_io(writer)) { avro_freet(struct _avro_writer_memory_t, writer); } else if (is_file_io(writer)) { if (avro_writer_to_file(writer)->should_close) { fclose(avro_writer_to_file(writer)->fp); } avro_freet(struct _avro_writer_file_t, writer); } }
void avro_reader_free(avro_reader_t reader) { if (is_memory_io(reader)) { avro_freet(struct _avro_reader_memory_t, reader); } else if (is_file_io(reader)) { if (avro_reader_to_file(reader)->should_close) { fclose(avro_reader_to_file(reader)->fp); } avro_freet(struct _avro_reader_file_t, reader); } }
int avro_skip(avro_reader_t reader, int64_t len) { if (len >= 0) { if (is_memory_io(reader)) { return avro_skip_memory(avro_reader_to_memory(reader), len); } else if (is_file_io(reader)) { return avro_skip_file(avro_reader_to_file(reader), len); } } return 0; }
int avro_write(avro_writer_t writer, void *buf, int64_t len) { if (buf && len >= 0) { if (is_memory_io(writer)) { return avro_write_memory(avro_writer_to_memory(writer), buf, len); } else if (is_file_io(writer)) { return avro_write_file(avro_writer_to_file(writer), buf, len); } } return EINVAL; }
int avro_read(avro_reader_t reader, void *buf, int64_t len) { if (buf && len >= 0) { if (is_memory_io(reader)) { return avro_read_memory(avro_reader_to_memory(reader), buf, len); } else if (is_file_io(reader)) { return avro_read_file(avro_reader_to_file(reader), buf, len); } } return EINVAL; }
void avro_writer_reset(avro_writer_t writer) { if (is_memory_io(writer)) { avro_writer_to_memory(writer)->written = 0; } }