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_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_flush(avro_writer_t writer) { if (is_file_io(writer)) { fflush(avro_writer_to_file(writer)->fp); } }