* garrow_readable_read_bytes: * @readable: A #GArrowReadable. * @n_bytes: The number of bytes to be read. * @error: (nullable): Return location for a #GError or %NULL. * * Returns: (transfer full) (nullable): #GBytes that has read data on * success, %NULL if there was an error. * * Since: 0.17.0 */
| 77 | * Since: 0.17.0 |
| 78 | */ |
| 79 | GBytes * |
| 80 | garrow_readable_read_bytes(GArrowReadable *readable, gint64 n_bytes, GError **error) |
| 81 | { |
| 82 | const auto arrow_readable = garrow_readable_get_raw(readable); |
| 83 | |
| 84 | auto arrow_buffer_result = arrow_readable->Read(n_bytes); |
| 85 | if (!garrow::check(error, arrow_buffer_result, "[readable][read-bytes]")) { |
| 86 | return NULL; |
| 87 | } |
| 88 | auto arrow_cpu_buffer_result = |
| 89 | arrow::Buffer::ViewOrCopy(*arrow_buffer_result, arrow::default_cpu_memory_manager()); |
| 90 | if (!garrow::check(error, |
| 91 | arrow_cpu_buffer_result, |
| 92 | "[readable][read-bytes][view-or-copy]")) { |
| 93 | return NULL; |
| 94 | } |
| 95 | auto arrow_cpu_buffer = *arrow_cpu_buffer_result; |
| 96 | return g_bytes_new(arrow_cpu_buffer->data(), arrow_cpu_buffer->size()); |
| 97 | } |
| 98 | |
| 99 | G_END_DECLS |
| 100 |
nothing calls this directly
no test coverage detected