MCPcopy Create free account
hub / github.com/apache/arrow / garrow_readable_read_bytes

Function garrow_readable_read_bytes

c_glib/arrow-glib/readable.cpp:79–97  ·  view source on GitHub ↗

* 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 */

Source from the content-addressed store, hash-verified

77 * Since: 0.17.0
78 */
79GBytes *
80garrow_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
99G_END_DECLS
100

Callers

nothing calls this directly

Calls 5

checkFunction · 0.70
ReadMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected