arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject [6/9] arrow git commit: ARROW-631: [GLib] Import
Date Fri, 17 Mar 2017 01:09:53 GMT
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int8-array-builder.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int8-array-builder.h b/c_glib/arrow-glib/int8-array-builder.h
new file mode 100644
index 0000000..321e931
--- /dev/null
+++ b/c_glib/arrow-glib/int8-array-builder.h
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <arrow-glib/array-builder.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_INT8_ARRAY_BUILDER          \
+  (garrow_int8_array_builder_get_type())
+#define GARROW_INT8_ARRAY_BUILDER(obj)                          \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),                            \
+                              GARROW_TYPE_INT8_ARRAY_BUILDER,   \
+                              GArrowInt8ArrayBuilder))
+#define GARROW_INT8_ARRAY_BUILDER_CLASS(klass)                  \
+  (G_TYPE_CHECK_CLASS_CAST((klass),                             \
+                           GARROW_TYPE_INT8_ARRAY_BUILDER,      \
+                           GArrowInt8ArrayBuilderClass))
+#define GARROW_IS_INT8_ARRAY_BUILDER(obj)                       \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),                            \
+                              GARROW_TYPE_INT8_ARRAY_BUILDER))
+#define GARROW_IS_INT8_ARRAY_BUILDER_CLASS(klass)               \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),                             \
+                           GARROW_TYPE_INT8_ARRAY_BUILDER))
+#define GARROW_INT8_ARRAY_BUILDER_GET_CLASS(obj)                \
+  (G_TYPE_INSTANCE_GET_CLASS((obj),                             \
+                             GARROW_TYPE_INT8_ARRAY_BUILDER,    \
+                             GArrowInt8ArrayBuilderClass))
+
+typedef struct _GArrowInt8ArrayBuilder         GArrowInt8ArrayBuilder;
+typedef struct _GArrowInt8ArrayBuilderClass    GArrowInt8ArrayBuilderClass;
+
+/**
+ * GArrowInt8ArrayBuilder:
+ *
+ * It wraps `arrow::Int8Builder`.
+ */
+struct _GArrowInt8ArrayBuilder
+{
+  /*< private >*/
+  GArrowArrayBuilder parent_instance;
+};
+
+struct _GArrowInt8ArrayBuilderClass
+{
+  GArrowArrayBuilderClass parent_class;
+};
+
+GType garrow_int8_array_builder_get_type(void) G_GNUC_CONST;
+
+GArrowInt8ArrayBuilder *garrow_int8_array_builder_new(void);
+
+gboolean garrow_int8_array_builder_append(GArrowInt8ArrayBuilder *builder,
+                                          gint8 value,
+                                          GError **error);
+gboolean garrow_int8_array_builder_append_null(GArrowInt8ArrayBuilder *builder,
+                                               GError **error);
+
+G_END_DECLS

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int8-array.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int8-array.cpp b/c_glib/arrow-glib/int8-array.cpp
new file mode 100644
index 0000000..d3f12ec
--- /dev/null
+++ b/c_glib/arrow-glib/int8-array.cpp
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <arrow-glib/array.hpp>
+#include <arrow-glib/int8-array.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: int8-array
+ * @short_description: 8-bit integer array class
+ *
+ * #GArrowInt8Array is a class for 8-bit integer array. It can store
+ * zero or more 8-bit integer data.
+ *
+ * #GArrowInt8Array is immutable. You need to use
+ * #GArrowInt8ArrayBuilder to create a new array.
+ */
+
+G_DEFINE_TYPE(GArrowInt8Array,               \
+              garrow_int8_array,             \
+              GARROW_TYPE_ARRAY)
+
+static void
+garrow_int8_array_init(GArrowInt8Array *object)
+{
+}
+
+static void
+garrow_int8_array_class_init(GArrowInt8ArrayClass *klass)
+{
+}
+
+/**
+ * garrow_int8_array_get_value:
+ * @array: A #GArrowInt8Array.
+ * @i: The index of the target value.
+ *
+ * Returns: The i-th value.
+ */
+gint8
+garrow_int8_array_get_value(GArrowInt8Array *array,
+                            gint64 i)
+{
+  auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array));
+  return static_cast<arrow::Int8Array *>(arrow_array.get())->Value(i);
+}
+
+G_END_DECLS

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int8-array.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int8-array.h b/c_glib/arrow-glib/int8-array.h
new file mode 100644
index 0000000..0e1e901
--- /dev/null
+++ b/c_glib/arrow-glib/int8-array.h
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <arrow-glib/array.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_INT8_ARRAY                  \
+  (garrow_int8_array_get_type())
+#define GARROW_INT8_ARRAY(obj)                          \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),                    \
+                              GARROW_TYPE_INT8_ARRAY,   \
+                              GArrowInt8Array))
+#define GARROW_INT8_ARRAY_CLASS(klass)                  \
+  (G_TYPE_CHECK_CLASS_CAST((klass),                     \
+                           GARROW_TYPE_INT8_ARRAY,      \
+                           GArrowInt8ArrayClass))
+#define GARROW_IS_INT8_ARRAY(obj)                       \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),                    \
+                              GARROW_TYPE_INT8_ARRAY))
+#define GARROW_IS_INT8_ARRAY_CLASS(klass)               \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),                     \
+                           GARROW_TYPE_INT8_ARRAY))
+#define GARROW_INT8_ARRAY_GET_CLASS(obj)                \
+  (G_TYPE_INSTANCE_GET_CLASS((obj),                     \
+                             GARROW_TYPE_INT8_ARRAY,    \
+                             GArrowInt8ArrayClass))
+
+typedef struct _GArrowInt8Array         GArrowInt8Array;
+typedef struct _GArrowInt8ArrayClass    GArrowInt8ArrayClass;
+
+/**
+ * GArrowInt8Array:
+ *
+ * It wraps `arrow::Int8Array`.
+ */
+struct _GArrowInt8Array
+{
+  /*< private >*/
+  GArrowArray parent_instance;
+};
+
+struct _GArrowInt8ArrayClass
+{
+  GArrowArrayClass parent_class;
+};
+
+GType garrow_int8_array_get_type(void) G_GNUC_CONST;
+
+gint8 garrow_int8_array_get_value(GArrowInt8Array *array,
+                                  gint64 i);
+
+G_END_DECLS

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int8-data-type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int8-data-type.cpp b/c_glib/arrow-glib/int8-data-type.cpp
new file mode 100644
index 0000000..55b1ebc
--- /dev/null
+++ b/c_glib/arrow-glib/int8-data-type.cpp
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <arrow-glib/data-type.hpp>
+#include <arrow-glib/int8-data-type.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: int8-data-type
+ * @short_description: 8-bit integer data type
+ *
+ * #GArrowInt8DataType is a class for 8-bit integer data type.
+ */
+
+G_DEFINE_TYPE(GArrowInt8DataType,                \
+              garrow_int8_data_type,             \
+              GARROW_TYPE_DATA_TYPE)
+
+static void
+garrow_int8_data_type_init(GArrowInt8DataType *object)
+{
+}
+
+static void
+garrow_int8_data_type_class_init(GArrowInt8DataTypeClass *klass)
+{
+}
+
+/**
+ * garrow_int8_data_type_new:
+ *
+ * Returns: The newly created 8-bit integer data type.
+ */
+GArrowInt8DataType *
+garrow_int8_data_type_new(void)
+{
+  auto arrow_data_type = arrow::int8();
+
+  GArrowInt8DataType *data_type =
+    GARROW_INT8_DATA_TYPE(g_object_new(GARROW_TYPE_INT8_DATA_TYPE,
+                                         "data-type", &arrow_data_type,
+                                         NULL));
+  return data_type;
+}
+
+G_END_DECLS

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int8-data-type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int8-data-type.h b/c_glib/arrow-glib/int8-data-type.h
new file mode 100644
index 0000000..4343bd1
--- /dev/null
+++ b/c_glib/arrow-glib/int8-data-type.h
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <arrow-glib/data-type.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_INT8_DATA_TYPE            \
+  (garrow_int8_data_type_get_type())
+#define GARROW_INT8_DATA_TYPE(obj)                            \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),                            \
+                              GARROW_TYPE_INT8_DATA_TYPE,     \
+                              GArrowInt8DataType))
+#define GARROW_INT8_DATA_TYPE_CLASS(klass)                    \
+  (G_TYPE_CHECK_CLASS_CAST((klass),                             \
+                           GARROW_TYPE_INT8_DATA_TYPE,        \
+                           GArrowInt8DataTypeClass))
+#define GARROW_IS_INT8_DATA_TYPE(obj)                         \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),                            \
+                              GARROW_TYPE_INT8_DATA_TYPE))
+#define GARROW_IS_INT8_DATA_TYPE_CLASS(klass)                 \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),                             \
+                           GARROW_TYPE_INT8_DATA_TYPE))
+#define GARROW_INT8_DATA_TYPE_GET_CLASS(obj)                  \
+  (G_TYPE_INSTANCE_GET_CLASS((obj),                             \
+                             GARROW_TYPE_INT8_DATA_TYPE,      \
+                             GArrowInt8DataTypeClass))
+
+typedef struct _GArrowInt8DataType         GArrowInt8DataType;
+typedef struct _GArrowInt8DataTypeClass    GArrowInt8DataTypeClass;
+
+/**
+ * GArrowInt8DataType:
+ *
+ * It wraps `arrow::Int8Type`.
+ */
+struct _GArrowInt8DataType
+{
+  /*< private >*/
+  GArrowDataType parent_instance;
+};
+
+struct _GArrowInt8DataTypeClass
+{
+  GArrowDataTypeClass parent_class;
+};
+
+GType                 garrow_int8_data_type_get_type (void) G_GNUC_CONST;
+GArrowInt8DataType *garrow_int8_data_type_new      (void);
+
+G_END_DECLS

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-enums.c.template
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-enums.c.template b/c_glib/arrow-glib/io-enums.c.template
new file mode 100644
index 0000000..10ee775
--- /dev/null
+++ b/c_glib/arrow-glib/io-enums.c.template
@@ -0,0 +1,56 @@
+/*** BEGIN file-header ***/
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <arrow-glib/arrow-io-glib.h>
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+@enum_name@_get_type(void)
+{
+  static GType etype = 0;
+  if (G_UNLIKELY(etype == 0)) {
+    static const G@Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+      {@VALUENAME@, "@VALUENAME@", "@valuenick@"},
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+      {0, NULL, NULL}
+    };
+    etype = g_@type@_register_static(g_intern_static_string("@EnumName@"), values);
+  }
+  return etype;
+}
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+/*** END file-tail ***/

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-enums.h.template
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-enums.h.template b/c_glib/arrow-glib/io-enums.h.template
new file mode 100644
index 0000000..429141d
--- /dev/null
+++ b/c_glib/arrow-glib/io-enums.h.template
@@ -0,0 +1,41 @@
+/*** BEGIN file-header ***/
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <arrow-glib/io-file-mode.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name@_get_type(void) G_GNUC_CONST;
+#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+
+G_END_DECLS
+/*** END file-tail ***/

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-file-mode.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-file-mode.cpp b/c_glib/arrow-glib/io-file-mode.cpp
new file mode 100644
index 0000000..7998d3f
--- /dev/null
+++ b/c_glib/arrow-glib/io-file-mode.cpp
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <arrow-glib/io-file-mode.hpp>
+
+/**
+ * SECTION: io-file-mode
+ * @title: GArrowIOFileMode
+ * @short_description: File mode mapping between Arrow and arrow-glib
+ *
+ * #GArrowIOFileMode provides file modes corresponding to
+ * `arrow::io::FileMode::type` values.
+ */
+
+GArrowIOFileMode
+garrow_io_file_mode_from_raw(arrow::io::FileMode::type mode)
+{
+  switch (mode) {
+  case arrow::io::FileMode::type::READ:
+    return GARROW_IO_FILE_MODE_READ;
+  case arrow::io::FileMode::type::WRITE:
+    return GARROW_IO_FILE_MODE_WRITE;
+  case arrow::io::FileMode::type::READWRITE:
+    return GARROW_IO_FILE_MODE_READWRITE;
+  default:
+    return GARROW_IO_FILE_MODE_READ;
+  }
+}
+
+arrow::io::FileMode::type
+garrow_io_file_mode_to_raw(GArrowIOFileMode mode)
+{
+  switch (mode) {
+  case GARROW_IO_FILE_MODE_READ:
+    return arrow::io::FileMode::type::READ;
+  case GARROW_IO_FILE_MODE_WRITE:
+    return arrow::io::FileMode::type::WRITE;
+  case GARROW_IO_FILE_MODE_READWRITE:
+    return arrow::io::FileMode::type::READWRITE;
+  default:
+    return arrow::io::FileMode::type::READ;
+  }
+}

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-file-mode.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-file-mode.h b/c_glib/arrow-glib/io-file-mode.h
new file mode 100644
index 0000000..03eca35
--- /dev/null
+++ b/c_glib/arrow-glib/io-file-mode.h
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GArrowIOFileMode:
+ * @GARROW_IO_FILE_MODE_READ: For read.
+ * @GARROW_IO_FILE_MODE_WRITE: For write.
+ * @GARROW_IO_FILE_MODE_READWRITE: For read-write.
+ *
+ * They are corresponding to `arrow::io::FileMode::type` values.
+ */
+typedef enum {
+  GARROW_IO_FILE_MODE_READ,
+  GARROW_IO_FILE_MODE_WRITE,
+  GARROW_IO_FILE_MODE_READWRITE
+} GArrowIOFileMode;
+
+G_END_DECLS

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-file-mode.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-file-mode.hpp b/c_glib/arrow-glib/io-file-mode.hpp
new file mode 100644
index 0000000..b3d8ac6
--- /dev/null
+++ b/c_glib/arrow-glib/io-file-mode.hpp
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <arrow/io/interfaces.h>
+
+#include <arrow-glib/io-file-mode.h>
+
+GArrowIOFileMode garrow_io_file_mode_from_raw(arrow::io::FileMode::type mode);
+arrow::io::FileMode::type garrow_io_file_mode_to_raw(GArrowIOFileMode mode);

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-file-output-stream.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-file-output-stream.cpp b/c_glib/arrow-glib/io-file-output-stream.cpp
new file mode 100644
index 0000000..673e8cd
--- /dev/null
+++ b/c_glib/arrow-glib/io-file-output-stream.cpp
@@ -0,0 +1,231 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <arrow/io/file.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/io-file.hpp>
+#include <arrow-glib/io-file-output-stream.hpp>
+#include <arrow-glib/io-output-stream.hpp>
+#include <arrow-glib/io-writeable.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: io-file-output-stream
+ * @short_description: A file output stream.
+ *
+ * The #GArrowIOFileOutputStream is a class for file output stream.
+ */
+
+typedef struct GArrowIOFileOutputStreamPrivate_ {
+  std::shared_ptr<arrow::io::FileOutputStream> file_output_stream;
+} GArrowIOFileOutputStreamPrivate;
+
+enum {
+  PROP_0,
+  PROP_FILE_OUTPUT_STREAM
+};
+
+static std::shared_ptr<arrow::io::FileInterface>
+garrow_io_file_output_stream_get_raw_file_interface(GArrowIOFile *file)
+{
+  auto file_output_stream = GARROW_IO_FILE_OUTPUT_STREAM(file);
+  auto arrow_file_output_stream =
+    garrow_io_file_output_stream_get_raw(file_output_stream);
+  return arrow_file_output_stream;
+}
+
+static void
+garrow_io_file_interface_init(GArrowIOFileInterface *iface)
+{
+  iface->get_raw = garrow_io_file_output_stream_get_raw_file_interface;
+}
+
+static std::shared_ptr<arrow::io::Writeable>
+garrow_io_file_output_stream_get_raw_writeable_interface(GArrowIOWriteable *writeable)
+{
+  auto file_output_stream = GARROW_IO_FILE_OUTPUT_STREAM(writeable);
+  auto arrow_file_output_stream =
+    garrow_io_file_output_stream_get_raw(file_output_stream);
+  return arrow_file_output_stream;
+}
+
+static void
+garrow_io_writeable_interface_init(GArrowIOWriteableInterface *iface)
+{
+  iface->get_raw = garrow_io_file_output_stream_get_raw_writeable_interface;
+}
+
+static std::shared_ptr<arrow::io::OutputStream>
+garrow_io_file_output_stream_get_raw_output_stream_interface(GArrowIOOutputStream *output_stream)
+{
+  auto file_output_stream = GARROW_IO_FILE_OUTPUT_STREAM(output_stream);
+  auto arrow_file_output_stream =
+    garrow_io_file_output_stream_get_raw(file_output_stream);
+  return arrow_file_output_stream;
+}
+
+static void
+garrow_io_output_stream_interface_init(GArrowIOOutputStreamInterface *iface)
+{
+  iface->get_raw = garrow_io_file_output_stream_get_raw_output_stream_interface;
+}
+
+G_DEFINE_TYPE_WITH_CODE(GArrowIOFileOutputStream,
+                        garrow_io_file_output_stream,
+                        G_TYPE_OBJECT,
+                        G_ADD_PRIVATE(GArrowIOFileOutputStream)
+                        G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_FILE,
+                                              garrow_io_file_interface_init)
+                        G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_WRITEABLE,
+                                              garrow_io_writeable_interface_init)
+                        G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_OUTPUT_STREAM,
+                                              garrow_io_output_stream_interface_init));
+
+#define GARROW_IO_FILE_OUTPUT_STREAM_GET_PRIVATE(obj)                   \
+  (G_TYPE_INSTANCE_GET_PRIVATE((obj),                                   \
+                               GARROW_IO_TYPE_FILE_OUTPUT_STREAM,       \
+                               GArrowIOFileOutputStreamPrivate))
+
+static void
+garrow_io_file_output_stream_finalize(GObject *object)
+{
+  GArrowIOFileOutputStreamPrivate *priv;
+
+  priv = GARROW_IO_FILE_OUTPUT_STREAM_GET_PRIVATE(object);
+
+  priv->file_output_stream = nullptr;
+
+  G_OBJECT_CLASS(garrow_io_file_output_stream_parent_class)->finalize(object);
+}
+
+static void
+garrow_io_file_output_stream_set_property(GObject *object,
+                                          guint prop_id,
+                                          const GValue *value,
+                                          GParamSpec *pspec)
+{
+  GArrowIOFileOutputStreamPrivate *priv;
+
+  priv = GARROW_IO_FILE_OUTPUT_STREAM_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_FILE_OUTPUT_STREAM:
+    priv->file_output_stream =
+      *static_cast<std::shared_ptr<arrow::io::FileOutputStream> *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_io_file_output_stream_get_property(GObject *object,
+                                          guint prop_id,
+                                          GValue *value,
+                                          GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_io_file_output_stream_init(GArrowIOFileOutputStream *object)
+{
+}
+
+static void
+garrow_io_file_output_stream_class_init(GArrowIOFileOutputStreamClass *klass)
+{
+  GObjectClass *gobject_class;
+  GParamSpec *spec;
+
+  gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->finalize     = garrow_io_file_output_stream_finalize;
+  gobject_class->set_property = garrow_io_file_output_stream_set_property;
+  gobject_class->get_property = garrow_io_file_output_stream_get_property;
+
+  spec = g_param_spec_pointer("file-output-stream",
+                              "io::FileOutputStream",
+                              "The raw std::shared<arrow::io::FileOutputStream> *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_FILE_OUTPUT_STREAM, spec);
+}
+
+/**
+ * garrow_io_file_output_stream_open:
+ * @path: The path of the file output stream.
+ * @append: Whether the path is opened as append mode or recreate mode.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: (nullable) (transfer full): A newly opened
+ *   #GArrowIOFileOutputStream or %NULL on error.
+ */
+GArrowIOFileOutputStream *
+garrow_io_file_output_stream_open(const gchar *path,
+                                  gboolean append,
+                                  GError **error)
+{
+  std::shared_ptr<arrow::io::FileOutputStream> arrow_file_output_stream;
+  auto status =
+    arrow::io::FileOutputStream::Open(std::string(path),
+                                      append,
+                                      &arrow_file_output_stream);
+  if (status.ok()) {
+    return garrow_io_file_output_stream_new_raw(&arrow_file_output_stream);
+  } else {
+    std::string context("[io][file-output-stream][open]: <");
+    context += path;
+    context += ">";
+    garrow_error_set(error, status, context.c_str());
+    return NULL;
+  }
+}
+
+G_END_DECLS
+
+GArrowIOFileOutputStream *
+garrow_io_file_output_stream_new_raw(std::shared_ptr<arrow::io::FileOutputStream> *arrow_file_output_stream)
+{
+  auto file_output_stream =
+    GARROW_IO_FILE_OUTPUT_STREAM(g_object_new(GARROW_IO_TYPE_FILE_OUTPUT_STREAM,
+                                              "file-output-stream", arrow_file_output_stream,
+                                              NULL));
+  return file_output_stream;
+}
+
+std::shared_ptr<arrow::io::FileOutputStream>
+garrow_io_file_output_stream_get_raw(GArrowIOFileOutputStream *file_output_stream)
+{
+  GArrowIOFileOutputStreamPrivate *priv;
+
+  priv = GARROW_IO_FILE_OUTPUT_STREAM_GET_PRIVATE(file_output_stream);
+  return priv->file_output_stream;
+}

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-file-output-stream.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-file-output-stream.h b/c_glib/arrow-glib/io-file-output-stream.h
new file mode 100644
index 0000000..032b125
--- /dev/null
+++ b/c_glib/arrow-glib/io-file-output-stream.h
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IO_TYPE_FILE_OUTPUT_STREAM       \
+  (garrow_io_file_output_stream_get_type())
+#define GARROW_IO_FILE_OUTPUT_STREAM(obj)                               \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),                                    \
+                              GARROW_IO_TYPE_FILE_OUTPUT_STREAM,        \
+                              GArrowIOFileOutputStream))
+#define GARROW_IO_FILE_OUTPUT_STREAM_CLASS(klass)               \
+  (G_TYPE_CHECK_CLASS_CAST((klass),                             \
+                           GARROW_IO_TYPE_FILE_OUTPUT_STREAM,   \
+                           GArrowIOFileOutputStreamClass))
+#define GARROW_IO_IS_FILE_OUTPUT_STREAM(obj)                            \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),                                    \
+                              GARROW_IO_TYPE_FILE_OUTPUT_STREAM))
+#define GARROW_IO_IS_FILE_OUTPUT_STREAM_CLASS(klass)            \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),                             \
+                           GARROW_IO_TYPE_FILE_OUTPUT_STREAM))
+#define GARROW_IO_FILE_OUTPUT_STREAM_GET_CLASS(obj)             \
+  (G_TYPE_INSTANCE_GET_CLASS((obj),                             \
+                             GARROW_IO_TYPE_FILE_OUTPUT_STREAM, \
+                             GArrowIOFileOutputStreamClass))
+
+typedef struct _GArrowIOFileOutputStream         GArrowIOFileOutputStream;
+typedef struct _GArrowIOFileOutputStreamClass    GArrowIOFileOutputStreamClass;
+
+/**
+ * GArrowIOFileOutputStream:
+ *
+ * It wraps `arrow::io::FileOutputStream`.
+ */
+struct _GArrowIOFileOutputStream
+{
+  /*< private >*/
+  GObject parent_instance;
+};
+
+struct _GArrowIOFileOutputStreamClass
+{
+  GObjectClass parent_class;
+};
+
+GType garrow_io_file_output_stream_get_type(void) G_GNUC_CONST;
+
+GArrowIOFileOutputStream *garrow_io_file_output_stream_open(const gchar *path,
+                                                            gboolean append,
+                                                            GError **error);
+
+G_END_DECLS

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-file-output-stream.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-file-output-stream.hpp b/c_glib/arrow-glib/io-file-output-stream.hpp
new file mode 100644
index 0000000..76b8e91
--- /dev/null
+++ b/c_glib/arrow-glib/io-file-output-stream.hpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <arrow/api.h>
+#include <arrow/io/file.h>
+
+#include <arrow-glib/io-file-output-stream.h>
+
+GArrowIOFileOutputStream *garrow_io_file_output_stream_new_raw(std::shared_ptr<arrow::io::FileOutputStream> *arrow_file_output_stream);
+std::shared_ptr<arrow::io::FileOutputStream> garrow_io_file_output_stream_get_raw(GArrowIOFileOutputStream *file_output_stream);

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-file.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-file.cpp b/c_glib/arrow-glib/io-file.cpp
new file mode 100644
index 0000000..536ae3e
--- /dev/null
+++ b/c_glib/arrow-glib/io-file.cpp
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <arrow/api.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/io-file.hpp>
+#include <arrow-glib/io-file-mode.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: io-file
+ * @title: GArrowIOFile
+ * @short_description: File interface
+ *
+ * #GArrowIOFile is an interface for file.
+ */
+
+G_DEFINE_INTERFACE(GArrowIOFile,
+                   garrow_io_file,
+                   G_TYPE_OBJECT)
+
+static void
+garrow_io_file_default_init (GArrowIOFileInterface *iface)
+{
+}
+
+/**
+ * garrow_io_file_close:
+ * @file: A #GArrowIOFile.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_io_file_close(GArrowIOFile *file,
+                     GError **error)
+{
+  auto arrow_file = garrow_io_file_get_raw(file);
+
+  auto status = arrow_file->Close();
+  if (status.ok()) {
+    return TRUE;
+  } else {
+    garrow_error_set(error, status, "[io][file][close]");
+    return FALSE;
+  }
+}
+
+/**
+ * garrow_io_file_tell:
+ * @file: A #GArrowIOFile.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: The current offset on success, -1 if there was an error.
+ */
+gint64
+garrow_io_file_tell(GArrowIOFile *file,
+                    GError **error)
+{
+  auto arrow_file = garrow_io_file_get_raw(file);
+
+  gint64 position;
+  auto status = arrow_file->Tell(&position);
+  if (status.ok()) {
+    return position;
+  } else {
+    garrow_error_set(error, status, "[io][file][tell]");
+    return -1;
+  }
+}
+
+/**
+ * garrow_io_file_get_mode:
+ * @file: A #GArrowIOFile.
+ *
+ * Returns: The mode of the file.
+ */
+GArrowIOFileMode
+garrow_io_file_get_mode(GArrowIOFile *file)
+{
+  auto arrow_file = garrow_io_file_get_raw(file);
+
+  auto arrow_mode = arrow_file->mode();
+  return garrow_io_file_mode_from_raw(arrow_mode);
+}
+
+G_END_DECLS
+
+std::shared_ptr<arrow::io::FileInterface>
+garrow_io_file_get_raw(GArrowIOFile *file)
+{
+  auto *iface = GARROW_IO_FILE_GET_IFACE(file);
+  return iface->get_raw(file);
+}

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-file.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-file.h b/c_glib/arrow-glib/io-file.h
new file mode 100644
index 0000000..9fa0ec1
--- /dev/null
+++ b/c_glib/arrow-glib/io-file.h
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <arrow-glib/io-file-mode.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IO_TYPE_FILE                     \
+  (garrow_io_file_get_type())
+#define GARROW_IO_FILE(obj)                             \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),                    \
+                              GARROW_IO_TYPE_FILE,      \
+                              GArrowIOFileInterface))
+#define GARROW_IO_IS_FILE(obj)                          \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),                    \
+                              GARROW_IO_TYPE_FILE))
+#define GARROW_IO_FILE_GET_IFACE(obj)                           \
+  (G_TYPE_INSTANCE_GET_INTERFACE((obj),                         \
+                                 GARROW_IO_TYPE_FILE,           \
+                                 GArrowIOFileInterface))
+
+typedef struct _GArrowIOFile          GArrowIOFile;
+typedef struct _GArrowIOFileInterface GArrowIOFileInterface;
+
+GType garrow_io_file_get_type(void) G_GNUC_CONST;
+
+gboolean garrow_io_file_close(GArrowIOFile *file,
+                              GError **error);
+gint64 garrow_io_file_tell(GArrowIOFile *file,
+                           GError **error);
+GArrowIOFileMode garrow_io_file_get_mode(GArrowIOFile *file);
+
+G_END_DECLS

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-file.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-file.hpp b/c_glib/arrow-glib/io-file.hpp
new file mode 100644
index 0000000..afaca90
--- /dev/null
+++ b/c_glib/arrow-glib/io-file.hpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <arrow/io/interfaces.h>
+
+#include <arrow-glib/io-file.h>
+
+/**
+ * GArrowIOFileInterface:
+ *
+ * It wraps `arrow::io::FileInterface`.
+ */
+struct _GArrowIOFileInterface
+{
+  GTypeInterface parent_iface;
+
+  std::shared_ptr<arrow::io::FileInterface> (*get_raw)(GArrowIOFile *file);
+};
+
+std::shared_ptr<arrow::io::FileInterface> garrow_io_file_get_raw(GArrowIOFile *file);

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-input-stream.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-input-stream.cpp b/c_glib/arrow-glib/io-input-stream.cpp
new file mode 100644
index 0000000..a28b9c6
--- /dev/null
+++ b/c_glib/arrow-glib/io-input-stream.cpp
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <arrow/api.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/io-input-stream.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: io-input-stream
+ * @title: GArrowIOInputStream
+ * @short_description: Stream input interface
+ *
+ * #GArrowIOInputStream is an interface for stream input. Stream input
+ * is file based and readable.
+ */
+
+G_DEFINE_INTERFACE(GArrowIOInputStream,
+                   garrow_io_input_stream,
+                   G_TYPE_OBJECT)
+
+static void
+garrow_io_input_stream_default_init (GArrowIOInputStreamInterface *iface)
+{
+}
+
+G_END_DECLS
+
+std::shared_ptr<arrow::io::InputStream>
+garrow_io_input_stream_get_raw(GArrowIOInputStream *input_stream)
+{
+  auto *iface = GARROW_IO_INPUT_STREAM_GET_IFACE(input_stream);
+  return iface->get_raw(input_stream);
+}

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-input-stream.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-input-stream.h b/c_glib/arrow-glib/io-input-stream.h
new file mode 100644
index 0000000..a7f0681
--- /dev/null
+++ b/c_glib/arrow-glib/io-input-stream.h
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IO_TYPE_INPUT_STREAM             \
+  (garrow_io_input_stream_get_type())
+#define GARROW_IO_INPUT_STREAM(obj)                             \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),                            \
+                              GARROW_IO_TYPE_INPUT_STREAM,      \
+                              GArrowIOInputStreamInterface))
+#define GARROW_IO_IS_INPUT_STREAM(obj)                          \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),                            \
+                              GARROW_IO_TYPE_INPUT_STREAM))
+#define GARROW_IO_INPUT_STREAM_GET_IFACE(obj)                   \
+  (G_TYPE_INSTANCE_GET_INTERFACE((obj),                         \
+                                 GARROW_IO_TYPE_INPUT_STREAM,   \
+                                 GArrowIOInputStreamInterface))
+
+typedef struct _GArrowIOInputStream          GArrowIOInputStream;
+typedef struct _GArrowIOInputStreamInterface GArrowIOInputStreamInterface;
+
+GType garrow_io_input_stream_get_type(void) G_GNUC_CONST;
+
+G_END_DECLS

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-input-stream.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-input-stream.hpp b/c_glib/arrow-glib/io-input-stream.hpp
new file mode 100644
index 0000000..3b1de5d
--- /dev/null
+++ b/c_glib/arrow-glib/io-input-stream.hpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <arrow/io/interfaces.h>
+
+#include <arrow-glib/io-input-stream.h>
+
+/**
+ * GArrowIOInputStreamInterface:
+ *
+ * It wraps `arrow::io::InputStream`.
+ */
+struct _GArrowIOInputStreamInterface
+{
+  GTypeInterface parent_iface;
+
+  std::shared_ptr<arrow::io::InputStream> (*get_raw)(GArrowIOInputStream *file);
+};
+
+std::shared_ptr<arrow::io::InputStream> garrow_io_input_stream_get_raw(GArrowIOInputStream *input_stream);

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-memory-mapped-file.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-memory-mapped-file.cpp b/c_glib/arrow-glib/io-memory-mapped-file.cpp
new file mode 100644
index 0000000..aa6ae2a
--- /dev/null
+++ b/c_glib/arrow-glib/io-memory-mapped-file.cpp
@@ -0,0 +1,287 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <arrow/io/file.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/io-file.hpp>
+#include <arrow-glib/io-file-mode.hpp>
+#include <arrow-glib/io-input-stream.hpp>
+#include <arrow-glib/io-memory-mapped-file.hpp>
+#include <arrow-glib/io-readable.hpp>
+#include <arrow-glib/io-readable-file.hpp>
+#include <arrow-glib/io-writeable.hpp>
+#include <arrow-glib/io-writeable-file.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: io-memory-mapped-file
+ * @short_description: Memory mapped file class
+ *
+ * #GArrowIOMemoryMappedFile is a class for memory mapped file. It's
+ * readable and writeable. It supports zero copy.
+ */
+
+typedef struct GArrowIOMemoryMappedFilePrivate_ {
+  std::shared_ptr<arrow::io::MemoryMappedFile> memory_mapped_file;
+} GArrowIOMemoryMappedFilePrivate;
+
+enum {
+  PROP_0,
+  PROP_MEMORY_MAPPED_FILE
+};
+
+static std::shared_ptr<arrow::io::FileInterface>
+garrow_io_memory_mapped_file_get_raw_file_interface(GArrowIOFile *file)
+{
+  auto memory_mapped_file = GARROW_IO_MEMORY_MAPPED_FILE(file);
+  auto arrow_memory_mapped_file =
+    garrow_io_memory_mapped_file_get_raw(memory_mapped_file);
+  return arrow_memory_mapped_file;
+}
+
+static void
+garrow_io_file_interface_init(GArrowIOFileInterface *iface)
+{
+  iface->get_raw = garrow_io_memory_mapped_file_get_raw_file_interface;
+}
+
+static std::shared_ptr<arrow::io::Readable>
+garrow_io_memory_mapped_file_get_raw_readable_interface(GArrowIOReadable *readable)
+{
+  auto memory_mapped_file = GARROW_IO_MEMORY_MAPPED_FILE(readable);
+  auto arrow_memory_mapped_file =
+    garrow_io_memory_mapped_file_get_raw(memory_mapped_file);
+  return arrow_memory_mapped_file;
+}
+
+static void
+garrow_io_readable_interface_init(GArrowIOReadableInterface *iface)
+{
+  iface->get_raw = garrow_io_memory_mapped_file_get_raw_readable_interface;
+}
+
+static std::shared_ptr<arrow::io::InputStream>
+garrow_io_memory_mapped_file_get_raw_input_stream_interface(GArrowIOInputStream *input_stream)
+{
+  auto memory_mapped_file = GARROW_IO_MEMORY_MAPPED_FILE(input_stream);
+  auto arrow_memory_mapped_file =
+    garrow_io_memory_mapped_file_get_raw(memory_mapped_file);
+  return arrow_memory_mapped_file;
+}
+
+static void
+garrow_io_input_stream_interface_init(GArrowIOInputStreamInterface *iface)
+{
+  iface->get_raw = garrow_io_memory_mapped_file_get_raw_input_stream_interface;
+}
+
+static std::shared_ptr<arrow::io::ReadableFileInterface>
+garrow_io_memory_mapped_file_get_raw_readable_file_interface(GArrowIOReadableFile *file)
+{
+  auto memory_mapped_file = GARROW_IO_MEMORY_MAPPED_FILE(file);
+  auto arrow_memory_mapped_file =
+    garrow_io_memory_mapped_file_get_raw(memory_mapped_file);
+  return arrow_memory_mapped_file;
+}
+
+static void
+garrow_io_readable_file_interface_init(GArrowIOReadableFileInterface *iface)
+{
+  iface->get_raw = garrow_io_memory_mapped_file_get_raw_readable_file_interface;
+}
+
+static std::shared_ptr<arrow::io::Writeable>
+garrow_io_memory_mapped_file_get_raw_writeable_interface(GArrowIOWriteable *writeable)
+{
+  auto memory_mapped_file = GARROW_IO_MEMORY_MAPPED_FILE(writeable);
+  auto arrow_memory_mapped_file =
+    garrow_io_memory_mapped_file_get_raw(memory_mapped_file);
+  return arrow_memory_mapped_file;
+}
+
+static void
+garrow_io_writeable_interface_init(GArrowIOWriteableInterface *iface)
+{
+  iface->get_raw = garrow_io_memory_mapped_file_get_raw_writeable_interface;
+}
+
+static std::shared_ptr<arrow::io::WriteableFileInterface>
+garrow_io_memory_mapped_file_get_raw_writeable_file_interface(GArrowIOWriteableFile *file)
+{
+  auto memory_mapped_file = GARROW_IO_MEMORY_MAPPED_FILE(file);
+  auto arrow_memory_mapped_file =
+    garrow_io_memory_mapped_file_get_raw(memory_mapped_file);
+  return arrow_memory_mapped_file;
+}
+
+static void
+garrow_io_writeable_file_interface_init(GArrowIOWriteableFileInterface *iface)
+{
+  iface->get_raw = garrow_io_memory_mapped_file_get_raw_writeable_file_interface;
+}
+
+G_DEFINE_TYPE_WITH_CODE(GArrowIOMemoryMappedFile,
+                        garrow_io_memory_mapped_file,
+                        G_TYPE_OBJECT,
+                        G_ADD_PRIVATE(GArrowIOMemoryMappedFile)
+                        G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_FILE,
+                                              garrow_io_file_interface_init)
+                        G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_READABLE,
+                                              garrow_io_readable_interface_init)
+                        G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_INPUT_STREAM,
+                                              garrow_io_input_stream_interface_init)
+                        G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_READABLE_FILE,
+                                              garrow_io_readable_file_interface_init)
+                        G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_WRITEABLE,
+                                              garrow_io_writeable_interface_init)
+                        G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_WRITEABLE_FILE,
+                                              garrow_io_writeable_file_interface_init));
+
+#define GARROW_IO_MEMORY_MAPPED_FILE_GET_PRIVATE(obj)                   \
+  (G_TYPE_INSTANCE_GET_PRIVATE((obj),                                   \
+                               GARROW_IO_TYPE_MEMORY_MAPPED_FILE,       \
+                               GArrowIOMemoryMappedFilePrivate))
+
+static void
+garrow_io_memory_mapped_file_finalize(GObject *object)
+{
+  GArrowIOMemoryMappedFilePrivate *priv;
+
+  priv = GARROW_IO_MEMORY_MAPPED_FILE_GET_PRIVATE(object);
+
+  priv->memory_mapped_file = nullptr;
+
+  G_OBJECT_CLASS(garrow_io_memory_mapped_file_parent_class)->finalize(object);
+}
+
+static void
+garrow_io_memory_mapped_file_set_property(GObject *object,
+                                          guint prop_id,
+                                          const GValue *value,
+                                          GParamSpec *pspec)
+{
+  GArrowIOMemoryMappedFilePrivate *priv;
+
+  priv = GARROW_IO_MEMORY_MAPPED_FILE_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_MAPPED_FILE:
+    priv->memory_mapped_file =
+      *static_cast<std::shared_ptr<arrow::io::MemoryMappedFile> *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_io_memory_mapped_file_get_property(GObject *object,
+                                          guint prop_id,
+                                          GValue *value,
+                                          GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_io_memory_mapped_file_init(GArrowIOMemoryMappedFile *object)
+{
+}
+
+static void
+garrow_io_memory_mapped_file_class_init(GArrowIOMemoryMappedFileClass *klass)
+{
+  GObjectClass *gobject_class;
+  GParamSpec *spec;
+
+  gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->finalize     = garrow_io_memory_mapped_file_finalize;
+  gobject_class->set_property = garrow_io_memory_mapped_file_set_property;
+  gobject_class->get_property = garrow_io_memory_mapped_file_get_property;
+
+  spec = g_param_spec_pointer("memory-mapped-file",
+                              "io::MemoryMappedFile",
+                              "The raw std::shared<arrow::io::MemoryMappedFile> *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_MEMORY_MAPPED_FILE, spec);
+}
+
+/**
+ * garrow_io_memory_mapped_file_open:
+ * @path: The path of the memory mapped file.
+ * @mode: The mode of the memory mapped file.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: (nullable) (transfer full): A newly opened
+ *   #GArrowIOMemoryMappedFile or %NULL on error.
+ */
+GArrowIOMemoryMappedFile *
+garrow_io_memory_mapped_file_open(const gchar *path,
+                                  GArrowIOFileMode mode,
+                                  GError **error)
+{
+  std::shared_ptr<arrow::io::MemoryMappedFile> arrow_memory_mapped_file;
+  auto status =
+    arrow::io::MemoryMappedFile::Open(std::string(path),
+                                      garrow_io_file_mode_to_raw(mode),
+                                      &arrow_memory_mapped_file);
+  if (status.ok()) {
+    return garrow_io_memory_mapped_file_new_raw(&arrow_memory_mapped_file);
+  } else {
+    std::string context("[io][memory-mapped-file][open]: <");
+    context += path;
+    context += ">";
+    garrow_error_set(error, status, context.c_str());
+    return NULL;
+  }
+}
+
+G_END_DECLS
+
+GArrowIOMemoryMappedFile *
+garrow_io_memory_mapped_file_new_raw(std::shared_ptr<arrow::io::MemoryMappedFile> *arrow_memory_mapped_file)
+{
+  auto memory_mapped_file =
+    GARROW_IO_MEMORY_MAPPED_FILE(g_object_new(GARROW_IO_TYPE_MEMORY_MAPPED_FILE,
+                                              "memory-mapped-file", arrow_memory_mapped_file,
+                                              NULL));
+  return memory_mapped_file;
+}
+
+std::shared_ptr<arrow::io::MemoryMappedFile>
+garrow_io_memory_mapped_file_get_raw(GArrowIOMemoryMappedFile *memory_mapped_file)
+{
+  GArrowIOMemoryMappedFilePrivate *priv;
+
+  priv = GARROW_IO_MEMORY_MAPPED_FILE_GET_PRIVATE(memory_mapped_file);
+  return priv->memory_mapped_file;
+}

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-memory-mapped-file.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-memory-mapped-file.h b/c_glib/arrow-glib/io-memory-mapped-file.h
new file mode 100644
index 0000000..0d2d6c2
--- /dev/null
+++ b/c_glib/arrow-glib/io-memory-mapped-file.h
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <arrow-glib/io-file-mode.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IO_TYPE_MEMORY_MAPPED_FILE       \
+  (garrow_io_memory_mapped_file_get_type())
+#define GARROW_IO_MEMORY_MAPPED_FILE(obj)                               \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),                                    \
+                              GARROW_IO_TYPE_MEMORY_MAPPED_FILE,        \
+                              GArrowIOMemoryMappedFile))
+#define GARROW_IO_MEMORY_MAPPED_FILE_CLASS(klass)               \
+  (G_TYPE_CHECK_CLASS_CAST((klass),                             \
+                           GARROW_IO_TYPE_MEMORY_MAPPED_FILE,   \
+                           GArrowIOMemoryMappedFileClass))
+#define GARROW_IO_IS_MEMORY_MAPPED_FILE(obj)                            \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),                                    \
+                              GARROW_IO_TYPE_MEMORY_MAPPED_FILE))
+#define GARROW_IO_IS_MEMORY_MAPPED_FILE_CLASS(klass)            \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),                             \
+                           GARROW_IO_TYPE_MEMORY_MAPPED_FILE))
+#define GARROW_IO_MEMORY_MAPPED_FILE_GET_CLASS(obj)             \
+  (G_TYPE_INSTANCE_GET_CLASS((obj),                             \
+                             GARROW_IO_TYPE_MEMORY_MAPPED_FILE, \
+                             GArrowIOMemoryMappedFileClass))
+
+typedef struct _GArrowIOMemoryMappedFile         GArrowIOMemoryMappedFile;
+typedef struct _GArrowIOMemoryMappedFileClass    GArrowIOMemoryMappedFileClass;
+
+/**
+ * GArrowIOMemoryMappedFile:
+ *
+ * It wraps `arrow::io::MemoryMappedFile`.
+ */
+struct _GArrowIOMemoryMappedFile
+{
+  /*< private >*/
+  GObject parent_instance;
+};
+
+struct _GArrowIOMemoryMappedFileClass
+{
+  GObjectClass parent_class;
+};
+
+GType garrow_io_memory_mapped_file_get_type(void) G_GNUC_CONST;
+
+GArrowIOMemoryMappedFile *garrow_io_memory_mapped_file_open(const gchar *path,
+                                                            GArrowIOFileMode mode,
+                                                            GError **error);
+
+G_END_DECLS

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-memory-mapped-file.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-memory-mapped-file.hpp b/c_glib/arrow-glib/io-memory-mapped-file.hpp
new file mode 100644
index 0000000..b48e05f
--- /dev/null
+++ b/c_glib/arrow-glib/io-memory-mapped-file.hpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <arrow/api.h>
+#include <arrow/io/file.h>
+
+#include <arrow-glib/io-memory-mapped-file.h>
+
+GArrowIOMemoryMappedFile *garrow_io_memory_mapped_file_new_raw(std::shared_ptr<arrow::io::MemoryMappedFile> *arrow_memory_mapped_file);
+std::shared_ptr<arrow::io::MemoryMappedFile> garrow_io_memory_mapped_file_get_raw(GArrowIOMemoryMappedFile *memory_mapped_file);

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-output-stream.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-output-stream.cpp b/c_glib/arrow-glib/io-output-stream.cpp
new file mode 100644
index 0000000..bdf5587
--- /dev/null
+++ b/c_glib/arrow-glib/io-output-stream.cpp
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <arrow/api.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/io-output-stream.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: io-output-stream
+ * @title: GArrowIOOutputStream
+ * @short_description: Stream output interface
+ *
+ * #GArrowIOOutputStream is an interface for stream output. Stream
+ * output is file based and writeable
+ */
+
+G_DEFINE_INTERFACE(GArrowIOOutputStream,
+                   garrow_io_output_stream,
+                   G_TYPE_OBJECT)
+
+static void
+garrow_io_output_stream_default_init (GArrowIOOutputStreamInterface *iface)
+{
+}
+
+G_END_DECLS
+
+std::shared_ptr<arrow::io::OutputStream>
+garrow_io_output_stream_get_raw(GArrowIOOutputStream *output_stream)
+{
+  auto *iface = GARROW_IO_OUTPUT_STREAM_GET_IFACE(output_stream);
+  return iface->get_raw(output_stream);
+}

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-output-stream.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-output-stream.h b/c_glib/arrow-glib/io-output-stream.h
new file mode 100644
index 0000000..c4079d5
--- /dev/null
+++ b/c_glib/arrow-glib/io-output-stream.h
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IO_TYPE_OUTPUT_STREAM            \
+  (garrow_io_output_stream_get_type())
+#define GARROW_IO_OUTPUT_STREAM(obj)                            \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),                            \
+                              GARROW_IO_TYPE_OUTPUT_STREAM,     \
+                              GArrowIOOutputStreamInterface))
+#define GARROW_IO_IS_OUTPUT_STREAM(obj)                         \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),                            \
+                              GARROW_IO_TYPE_OUTPUT_STREAM))
+#define GARROW_IO_OUTPUT_STREAM_GET_IFACE(obj)                          \
+  (G_TYPE_INSTANCE_GET_INTERFACE((obj),                                 \
+                                 GARROW_IO_TYPE_OUTPUT_STREAM,          \
+                                 GArrowIOOutputStreamInterface))
+
+typedef struct _GArrowIOOutputStream          GArrowIOOutputStream;
+typedef struct _GArrowIOOutputStreamInterface GArrowIOOutputStreamInterface;
+
+GType garrow_io_output_stream_get_type(void) G_GNUC_CONST;
+
+G_END_DECLS

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-output-stream.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-output-stream.hpp b/c_glib/arrow-glib/io-output-stream.hpp
new file mode 100644
index 0000000..f144130
--- /dev/null
+++ b/c_glib/arrow-glib/io-output-stream.hpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <arrow/io/interfaces.h>
+
+#include <arrow-glib/io-output-stream.h>
+
+/**
+ * GArrowIOOutputStreamInterface:
+ *
+ * It wraps `arrow::io::OutputStream`.
+ */
+struct _GArrowIOOutputStreamInterface
+{
+  GTypeInterface parent_iface;
+
+  std::shared_ptr<arrow::io::OutputStream> (*get_raw)(GArrowIOOutputStream *file);
+};
+
+std::shared_ptr<arrow::io::OutputStream> garrow_io_output_stream_get_raw(GArrowIOOutputStream *output_stream);

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-readable-file.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-readable-file.cpp b/c_glib/arrow-glib/io-readable-file.cpp
new file mode 100644
index 0000000..014fd7a
--- /dev/null
+++ b/c_glib/arrow-glib/io-readable-file.cpp
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <arrow/api.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/io-readable-file.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: io-readable-file
+ * @title: GArrowIOReadableFile
+ * @short_description: File input interface
+ *
+ * #GArrowIOReadableFile is an interface for file input.
+ */
+
+G_DEFINE_INTERFACE(GArrowIOReadableFile,
+                   garrow_io_readable_file,
+                   G_TYPE_OBJECT)
+
+static void
+garrow_io_readable_file_default_init (GArrowIOReadableFileInterface *iface)
+{
+}
+
+/**
+ * garrow_io_readable_file_get_size:
+ * @file: A #GArrowIOReadableFile.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: The size of the file.
+ */
+guint64
+garrow_io_readable_file_get_size(GArrowIOReadableFile *file,
+                                 GError **error)
+{
+  auto *iface = GARROW_IO_READABLE_FILE_GET_IFACE(file);
+  auto arrow_readable_file = iface->get_raw(file);
+  int64_t size;
+
+  auto status = arrow_readable_file->GetSize(&size);
+  if (status.ok()) {
+    return size;
+  } else {
+    garrow_error_set(error, status, "[io][readable-file][get-size]");
+    return 0;
+  }
+}
+
+/**
+ * garrow_io_readable_file_get_support_zero_copy:
+ * @file: A #GArrowIOReadableFile.
+ *
+ * Returns: Whether zero copy read is supported or not.
+ */
+gboolean
+garrow_io_readable_file_get_support_zero_copy(GArrowIOReadableFile *file)
+{
+  auto *iface = GARROW_IO_READABLE_FILE_GET_IFACE(file);
+  auto arrow_readable_file = iface->get_raw(file);
+
+  return arrow_readable_file->supports_zero_copy();
+}
+
+/**
+ * garrow_io_readable_file_read_at:
+ * @file: A #GArrowIOReadableFile.
+ * @position: The read start position.
+ * @n_bytes: The number of bytes to be read.
+ * @n_read_bytes: (out): The read number of bytes.
+ * @buffer: (array length=n_bytes): The buffer to be read data.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_io_readable_file_read_at(GArrowIOReadableFile *file,
+                                gint64 position,
+                                gint64 n_bytes,
+                                gint64 *n_read_bytes,
+                                guint8 *buffer,
+                                GError **error)
+{
+  const auto arrow_readable_file = garrow_io_readable_file_get_raw(file);
+
+  auto status = arrow_readable_file->ReadAt(position,
+                                            n_bytes,
+                                            n_read_bytes,
+                                            buffer);
+  if (status.ok()) {
+    return TRUE;
+  } else {
+    garrow_error_set(error, status, "[io][readable-file][read-at]");
+    return FALSE;
+  }
+}
+
+G_END_DECLS
+
+std::shared_ptr<arrow::io::ReadableFileInterface>
+garrow_io_readable_file_get_raw(GArrowIOReadableFile *readable_file)
+{
+  auto *iface = GARROW_IO_READABLE_FILE_GET_IFACE(readable_file);
+  return iface->get_raw(readable_file);
+}

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-readable-file.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-readable-file.h b/c_glib/arrow-glib/io-readable-file.h
new file mode 100644
index 0000000..1dcb13e
--- /dev/null
+++ b/c_glib/arrow-glib/io-readable-file.h
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IO_TYPE_READABLE_FILE                     \
+  (garrow_io_readable_file_get_type())
+#define GARROW_IO_READABLE_FILE(obj)                            \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),                            \
+                              GARROW_IO_TYPE_READABLE_FILE,     \
+                              GArrowIOReadableFileInterface))
+#define GARROW_IO_IS_READABLE_FILE(obj)                         \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),                            \
+                              GARROW_IO_TYPE_READABLE_FILE))
+#define GARROW_IO_READABLE_FILE_GET_IFACE(obj)                          \
+  (G_TYPE_INSTANCE_GET_INTERFACE((obj),                                 \
+                                 GARROW_IO_TYPE_READABLE_FILE,          \
+                                 GArrowIOReadableFileInterface))
+
+typedef struct _GArrowIOReadableFile          GArrowIOReadableFile;
+typedef struct _GArrowIOReadableFileInterface GArrowIOReadableFileInterface;
+
+GType garrow_io_readable_file_get_type(void) G_GNUC_CONST;
+
+guint64 garrow_io_readable_file_get_size(GArrowIOReadableFile *file,
+                                         GError **error);
+gboolean garrow_io_readable_file_get_support_zero_copy(GArrowIOReadableFile *file);
+gboolean garrow_io_readable_file_read_at(GArrowIOReadableFile *file,
+                                         gint64 position,
+                                         gint64 n_bytes,
+                                         gint64 *n_read_bytes,
+                                         guint8 *buffer,
+                                         GError **error);
+
+G_END_DECLS

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-readable-file.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-readable-file.hpp b/c_glib/arrow-glib/io-readable-file.hpp
new file mode 100644
index 0000000..83d8628
--- /dev/null
+++ b/c_glib/arrow-glib/io-readable-file.hpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <arrow/io/interfaces.h>
+
+#include <arrow-glib/io-readable-file.h>
+
+/**
+ * GArrowIOReadableFileInterface:
+ *
+ * It wraps `arrow::io::ReadableFileInterface`.
+ */
+struct _GArrowIOReadableFileInterface
+{
+  GTypeInterface parent_iface;
+
+  std::shared_ptr<arrow::io::ReadableFileInterface> (*get_raw)(GArrowIOReadableFile *file);
+};
+
+std::shared_ptr<arrow::io::ReadableFileInterface> garrow_io_readable_file_get_raw(GArrowIOReadableFile *readable_file);

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-readable.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-readable.cpp b/c_glib/arrow-glib/io-readable.cpp
new file mode 100644
index 0000000..b372a66
--- /dev/null
+++ b/c_glib/arrow-glib/io-readable.cpp
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <arrow/api.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/io-readable.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: io-readable
+ * @title: GArrowIOReadable
+ * @short_description: Input interface
+ *
+ * #GArrowIOReadable is an interface for input. Input must be
+ * readable.
+ */
+
+G_DEFINE_INTERFACE(GArrowIOReadable,
+                   garrow_io_readable,
+                   G_TYPE_OBJECT)
+
+static void
+garrow_io_readable_default_init (GArrowIOReadableInterface *iface)
+{
+}
+
+/**
+ * garrow_io_readable_read:
+ * @readable: A #GArrowIOReadable.
+ * @n_bytes: The number of bytes to be read.
+ * @n_read_bytes: (out): The read number of bytes.
+ * @buffer: (array length=n_bytes): The buffer to be read data.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_io_readable_read(GArrowIOReadable *readable,
+                        gint64 n_bytes,
+                        gint64 *n_read_bytes,
+                        guint8 *buffer,
+                        GError **error)
+{
+  const auto arrow_readable = garrow_io_readable_get_raw(readable);
+
+  auto status = arrow_readable->Read(n_bytes, n_read_bytes, buffer);
+  if (status.ok()) {
+    return TRUE;
+  } else {
+    garrow_error_set(error, status, "[io][readable][read]");
+    return FALSE;
+  }
+}
+
+G_END_DECLS
+
+std::shared_ptr<arrow::io::Readable>
+garrow_io_readable_get_raw(GArrowIOReadable *readable)
+{
+  auto *iface = GARROW_IO_READABLE_GET_IFACE(readable);
+  return iface->get_raw(readable);
+}

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-readable.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-readable.h b/c_glib/arrow-glib/io-readable.h
new file mode 100644
index 0000000..d24b46c
--- /dev/null
+++ b/c_glib/arrow-glib/io-readable.h
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IO_TYPE_READABLE                 \
+  (garrow_io_readable_get_type())
+#define GARROW_IO_READABLE(obj)                                 \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),                            \
+                              GARROW_IO_TYPE_READABLE,          \
+                              GArrowIOReadableInterface))
+#define GARROW_IO_IS_READABLE(obj)                      \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),                    \
+                              GARROW_IO_TYPE_READABLE))
+#define GARROW_IO_READABLE_GET_IFACE(obj)                       \
+  (G_TYPE_INSTANCE_GET_INTERFACE((obj),                         \
+                                 GARROW_IO_TYPE_READABLE,       \
+                                 GArrowIOReadableInterface))
+
+typedef struct _GArrowIOReadable          GArrowIOReadable;
+typedef struct _GArrowIOReadableInterface GArrowIOReadableInterface;
+
+GType garrow_io_readable_get_type(void) G_GNUC_CONST;
+
+gboolean garrow_io_readable_read(GArrowIOReadable *readable,
+                                 gint64 n_bytes,
+                                 gint64 *n_read_bytes,
+                                 guint8 *buffer,
+                                 GError **error);
+
+G_END_DECLS

http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-readable.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-readable.hpp b/c_glib/arrow-glib/io-readable.hpp
new file mode 100644
index 0000000..3d27b3f
--- /dev/null
+++ b/c_glib/arrow-glib/io-readable.hpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <arrow/io/interfaces.h>
+
+#include <arrow-glib/io-readable.h>
+
+/**
+ * GArrowIOReadableInterface:
+ *
+ * It wraps `arrow::io::Readable`.
+ */
+struct _GArrowIOReadableInterface
+{
+  GTypeInterface parent_iface;
+
+  std::shared_ptr<arrow::io::Readable> (*get_raw)(GArrowIOReadable *file);
+};
+
+std::shared_ptr<arrow::io::Readable> garrow_io_readable_get_raw(GArrowIOReadable *readable);


Mime
View raw message