You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2017/04/12 14:54:52 UTC
[4/4] arrow git commit: ARROW-810: [GLib] Remove io/ipc prefix
ARROW-810: [GLib] Remove io/ipc prefix
Author: Kouhei Sutou <ko...@clear-code.com>
Closes #530 from kou/glib-remove-io-ipc-prefix and squashes the following commits:
adfad7c [Kouhei Sutou] [GLib] Remove io/ipc prefix
Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/6443b828
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/6443b828
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/6443b828
Branch: refs/heads/master
Commit: 6443b82878489ed6a308d1e5ace33088788a060e
Parents: 5e5a587
Author: Kouhei Sutou <ko...@clear-code.com>
Authored: Wed Apr 12 10:54:42 2017 -0400
Committer: Wes McKinney <we...@twosigma.com>
Committed: Wed Apr 12 10:54:42 2017 -0400
----------------------------------------------------------------------
c_glib/arrow-glib/Makefile.am | 90 +++----
c_glib/arrow-glib/arrow-glib.h | 30 +--
c_glib/arrow-glib/arrow-glib.hpp | 28 +--
c_glib/arrow-glib/file-mode.cpp | 63 +++++
c_glib/arrow-glib/file-mode.h | 40 ++++
c_glib/arrow-glib/file-mode.hpp | 27 +++
c_glib/arrow-glib/file-output-stream.cpp | 231 ++++++++++++++++++
c_glib/arrow-glib/file-output-stream.h | 72 ++++++
c_glib/arrow-glib/file-output-stream.hpp | 28 +++
c_glib/arrow-glib/file-reader.cpp | 247 +++++++++++++++++++
c_glib/arrow-glib/file-reader.h | 83 +++++++
c_glib/arrow-glib/file-reader.hpp | 28 +++
c_glib/arrow-glib/file-writer.cpp | 158 +++++++++++++
c_glib/arrow-glib/file-writer.h | 78 ++++++
c_glib/arrow-glib/file-writer.hpp | 28 +++
c_glib/arrow-glib/file.cpp | 116 +++++++++
c_glib/arrow-glib/file.h | 51 ++++
c_glib/arrow-glib/file.hpp | 38 +++
c_glib/arrow-glib/input-stream.cpp | 56 +++++
c_glib/arrow-glib/input-stream.h | 45 ++++
c_glib/arrow-glib/input-stream.hpp | 38 +++
c_glib/arrow-glib/io-file-mode.cpp | 63 -----
c_glib/arrow-glib/io-file-mode.h | 40 ----
c_glib/arrow-glib/io-file-mode.hpp | 27 ---
c_glib/arrow-glib/io-file-output-stream.cpp | 231 ------------------
c_glib/arrow-glib/io-file-output-stream.h | 72 ------
c_glib/arrow-glib/io-file-output-stream.hpp | 28 ---
c_glib/arrow-glib/io-file.cpp | 116 ---------
c_glib/arrow-glib/io-file.h | 51 ----
c_glib/arrow-glib/io-file.hpp | 38 ---
c_glib/arrow-glib/io-input-stream.cpp | 56 -----
c_glib/arrow-glib/io-input-stream.h | 45 ----
c_glib/arrow-glib/io-input-stream.hpp | 38 ---
c_glib/arrow-glib/io-memory-mapped-file.cpp | 287 -----------------------
c_glib/arrow-glib/io-memory-mapped-file.h | 72 ------
c_glib/arrow-glib/io-memory-mapped-file.hpp | 28 ---
c_glib/arrow-glib/io-output-stream.cpp | 56 -----
c_glib/arrow-glib/io-output-stream.h | 45 ----
c_glib/arrow-glib/io-output-stream.hpp | 38 ---
c_glib/arrow-glib/io-random-access-file.cpp | 128 ----------
c_glib/arrow-glib/io-random-access-file.h | 55 -----
c_glib/arrow-glib/io-random-access-file.hpp | 38 ---
c_glib/arrow-glib/io-readable.cpp | 84 -------
c_glib/arrow-glib/io-readable.h | 51 ----
c_glib/arrow-glib/io-readable.hpp | 38 ---
c_glib/arrow-glib/io-writeable-file.cpp | 84 -------
c_glib/arrow-glib/io-writeable-file.h | 51 ----
c_glib/arrow-glib/io-writeable-file.hpp | 38 ---
c_glib/arrow-glib/io-writeable.cpp | 106 ---------
c_glib/arrow-glib/io-writeable.h | 52 ----
c_glib/arrow-glib/io-writeable.hpp | 38 ---
c_glib/arrow-glib/ipc-file-reader.cpp | 247 -------------------
c_glib/arrow-glib/ipc-file-reader.h | 83 -------
c_glib/arrow-glib/ipc-file-reader.hpp | 28 ---
c_glib/arrow-glib/ipc-file-writer.cpp | 158 -------------
c_glib/arrow-glib/ipc-file-writer.h | 78 ------
c_glib/arrow-glib/ipc-file-writer.hpp | 28 ---
c_glib/arrow-glib/ipc-metadata-version.cpp | 63 -----
c_glib/arrow-glib/ipc-metadata-version.h | 41 ----
c_glib/arrow-glib/ipc-metadata-version.hpp | 27 ---
c_glib/arrow-glib/ipc-stream-reader.cpp | 221 -----------------
c_glib/arrow-glib/ipc-stream-reader.h | 80 -------
c_glib/arrow-glib/ipc-stream-reader.hpp | 28 ---
c_glib/arrow-glib/ipc-stream-writer.cpp | 232 ------------------
c_glib/arrow-glib/ipc-stream-writer.h | 82 -------
c_glib/arrow-glib/ipc-stream-writer.hpp | 28 ---
c_glib/arrow-glib/memory-mapped-file.cpp | 287 +++++++++++++++++++++++
c_glib/arrow-glib/memory-mapped-file.h | 72 ++++++
c_glib/arrow-glib/memory-mapped-file.hpp | 28 +++
c_glib/arrow-glib/metadata-version.cpp | 63 +++++
c_glib/arrow-glib/metadata-version.h | 41 ++++
c_glib/arrow-glib/metadata-version.hpp | 27 +++
c_glib/arrow-glib/output-stream.cpp | 56 +++++
c_glib/arrow-glib/output-stream.h | 45 ++++
c_glib/arrow-glib/output-stream.hpp | 38 +++
c_glib/arrow-glib/random-access-file.cpp | 128 ++++++++++
c_glib/arrow-glib/random-access-file.h | 55 +++++
c_glib/arrow-glib/random-access-file.hpp | 38 +++
c_glib/arrow-glib/readable.cpp | 84 +++++++
c_glib/arrow-glib/readable.h | 51 ++++
c_glib/arrow-glib/readable.hpp | 38 +++
c_glib/arrow-glib/stream-reader.cpp | 221 +++++++++++++++++
c_glib/arrow-glib/stream-reader.h | 80 +++++++
c_glib/arrow-glib/stream-reader.hpp | 28 +++
c_glib/arrow-glib/stream-writer.cpp | 232 ++++++++++++++++++
c_glib/arrow-glib/stream-writer.h | 82 +++++++
c_glib/arrow-glib/stream-writer.hpp | 28 +++
c_glib/arrow-glib/writeable-file.cpp | 84 +++++++
c_glib/arrow-glib/writeable-file.h | 51 ++++
c_glib/arrow-glib/writeable-file.hpp | 38 +++
c_glib/arrow-glib/writeable.cpp | 106 +++++++++
c_glib/arrow-glib/writeable.h | 52 ++++
c_glib/arrow-glib/writeable.hpp | 38 +++
c_glib/doc/reference/Makefile.am | 2 +-
c_glib/doc/reference/arrow-glib-docs.sgml | 62 ++---
c_glib/example/read-batch.c | 18 +-
c_glib/example/read-stream.c | 16 +-
c_glib/test/test-file-output-stream.rb | 38 +++
c_glib/test/test-file-writer.rb | 45 ++++
c_glib/test/test-io-file-output-stream.rb | 38 ---
c_glib/test/test-io-memory-mapped-file.rb | 138 -----------
c_glib/test/test-ipc-file-writer.rb | 45 ----
c_glib/test/test-ipc-stream-writer.rb | 53 -----
c_glib/test/test-memory-mapped-file.rb | 138 +++++++++++
c_glib/test/test-stream-writer.rb | 53 +++++
105 files changed, 3915 insertions(+), 3915 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/Makefile.am
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/Makefile.am b/c_glib/arrow-glib/Makefile.am
index e719ccc..387707c 100644
--- a/c_glib/arrow-glib/Makefile.am
+++ b/c_glib/arrow-glib/Makefile.am
@@ -102,23 +102,23 @@ libarrow_glib_la_headers = \
uint64-data-type.h
libarrow_glib_la_headers += \
- io-file.h \
- io-file-mode.h \
- io-file-output-stream.h \
- io-input-stream.h \
- io-memory-mapped-file.h \
- io-output-stream.h \
- io-random-access-file.h \
- io-readable.h \
- io-writeable.h \
- io-writeable-file.h
+ file.h \
+ file-mode.h \
+ file-output-stream.h \
+ input-stream.h \
+ memory-mapped-file.h \
+ output-stream.h \
+ random-access-file.h \
+ readable.h \
+ writeable.h \
+ writeable-file.h
libarrow_glib_la_headers += \
- ipc-file-reader.h \
- ipc-file-writer.h \
- ipc-stream-reader.h \
- ipc-stream-writer.h \
- ipc-metadata-version.h
+ file-reader.h \
+ file-writer.h \
+ stream-reader.h \
+ stream-writer.h \
+ metadata-version.h
libarrow_glib_la_generated_headers = \
enums.h
@@ -190,23 +190,23 @@ libarrow_glib_la_sources = \
$(libarrow_glib_la_generated_sources)
libarrow_glib_la_sources += \
- io-file.cpp \
- io-file-mode.cpp \
- io-file-output-stream.cpp \
- io-input-stream.cpp \
- io-memory-mapped-file.cpp \
- io-output-stream.cpp \
- io-random-access-file.cpp \
- io-readable.cpp \
- io-writeable.cpp \
- io-writeable-file.cpp
+ file.cpp \
+ file-mode.cpp \
+ file-output-stream.cpp \
+ input-stream.cpp \
+ memory-mapped-file.cpp \
+ output-stream.cpp \
+ random-access-file.cpp \
+ readable.cpp \
+ writeable.cpp \
+ writeable-file.cpp
libarrow_glib_la_sources += \
- ipc-file-reader.cpp \
- ipc-file-writer.cpp \
- ipc-metadata-version.cpp \
- ipc-stream-reader.cpp \
- ipc-stream-writer.cpp
+ file-reader.cpp \
+ file-writer.cpp \
+ metadata-version.cpp \
+ stream-reader.cpp \
+ stream-writer.cpp
libarrow_glib_la_cpp_headers = \
array.hpp \
@@ -223,23 +223,23 @@ libarrow_glib_la_cpp_headers = \
type.hpp
libarrow_glib_la_cpp_headers += \
- io-file.hpp \
- io-file-mode.hpp \
- io-file-output-stream.hpp \
- io-input-stream.hpp \
- io-memory-mapped-file.hpp \
- io-output-stream.hpp \
- io-random-access-file.hpp \
- io-readable.hpp \
- io-writeable.hpp \
- io-writeable-file.hpp
+ file.hpp \
+ file-mode.hpp \
+ file-output-stream.hpp \
+ input-stream.hpp \
+ memory-mapped-file.hpp \
+ output-stream.hpp \
+ random-access-file.hpp \
+ readable.hpp \
+ writeable.hpp \
+ writeable-file.hpp
libarrow_glib_la_cpp_headers += \
- ipc-file-reader.hpp \
- ipc-file-writer.hpp \
- ipc-metadata-version.hpp \
- ipc-stream-reader.hpp \
- ipc-stream-writer.hpp
+ file-reader.hpp \
+ file-writer.hpp \
+ metadata-version.hpp \
+ stream-reader.hpp \
+ stream-writer.hpp
libarrow_glib_la_SOURCES = \
$(libarrow_glib_la_sources) \
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/arrow-glib.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/arrow-glib.h b/c_glib/arrow-glib/arrow-glib.h
index 9b03175..b15c56f 100644
--- a/c_glib/arrow-glib/arrow-glib.h
+++ b/c_glib/arrow-glib/arrow-glib.h
@@ -79,19 +79,19 @@
#include <arrow-glib/uint64-array-builder.h>
#include <arrow-glib/uint64-data-type.h>
-#include <arrow-glib/io-file.h>
-#include <arrow-glib/io-file-mode.h>
-#include <arrow-glib/io-file-output-stream.h>
-#include <arrow-glib/io-input-stream.h>
-#include <arrow-glib/io-memory-mapped-file.h>
-#include <arrow-glib/io-output-stream.h>
-#include <arrow-glib/io-random-access-file.h>
-#include <arrow-glib/io-readable.h>
-#include <arrow-glib/io-writeable.h>
-#include <arrow-glib/io-writeable-file.h>
+#include <arrow-glib/file.h>
+#include <arrow-glib/file-mode.h>
+#include <arrow-glib/file-output-stream.h>
+#include <arrow-glib/input-stream.h>
+#include <arrow-glib/memory-mapped-file.h>
+#include <arrow-glib/output-stream.h>
+#include <arrow-glib/random-access-file.h>
+#include <arrow-glib/readable.h>
+#include <arrow-glib/writeable.h>
+#include <arrow-glib/writeable-file.h>
-#include <arrow-glib/ipc-file-reader.h>
-#include <arrow-glib/ipc-file-writer.h>
-#include <arrow-glib/ipc-metadata-version.h>
-#include <arrow-glib/ipc-stream-reader.h>
-#include <arrow-glib/ipc-stream-writer.h>
+#include <arrow-glib/file-reader.h>
+#include <arrow-glib/file-writer.h>
+#include <arrow-glib/metadata-version.h>
+#include <arrow-glib/stream-reader.h>
+#include <arrow-glib/stream-writer.h>
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/arrow-glib.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/arrow-glib.hpp b/c_glib/arrow-glib/arrow-glib.hpp
index fd59d4a..3404d4d 100644
--- a/c_glib/arrow-glib/arrow-glib.hpp
+++ b/c_glib/arrow-glib/arrow-glib.hpp
@@ -36,18 +36,18 @@
#include <arrow-glib/table.hpp>
#include <arrow-glib/type.hpp>
-#include <arrow-glib/io-file.hpp>
-#include <arrow-glib/io-file-mode.hpp>
-#include <arrow-glib/io-file-output-stream.hpp>
-#include <arrow-glib/io-input-stream.hpp>
-#include <arrow-glib/io-memory-mapped-file.hpp>
-#include <arrow-glib/io-output-stream.hpp>
-#include <arrow-glib/io-random-access-file.hpp>
-#include <arrow-glib/io-readable.hpp>
-#include <arrow-glib/io-writeable.hpp>
+#include <arrow-glib/file.hpp>
+#include <arrow-glib/file-mode.hpp>
+#include <arrow-glib/file-output-stream.hpp>
+#include <arrow-glib/input-stream.hpp>
+#include <arrow-glib/memory-mapped-file.hpp>
+#include <arrow-glib/output-stream.hpp>
+#include <arrow-glib/random-access-file.hpp>
+#include <arrow-glib/readable.hpp>
+#include <arrow-glib/writeable.hpp>
-#include <arrow-glib/ipc-file-reader.hpp>
-#include <arrow-glib/ipc-file-writer.hpp>
-#include <arrow-glib/ipc-metadata-version.hpp>
-#include <arrow-glib/ipc-stream-reader.hpp>
-#include <arrow-glib/ipc-stream-writer.hpp>
+#include <arrow-glib/file-reader.hpp>
+#include <arrow-glib/file-writer.hpp>
+#include <arrow-glib/metadata-version.hpp>
+#include <arrow-glib/stream-reader.hpp>
+#include <arrow-glib/stream-writer.hpp>
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/file-mode.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/file-mode.cpp b/c_glib/arrow-glib/file-mode.cpp
new file mode 100644
index 0000000..1fb1706
--- /dev/null
+++ b/c_glib/arrow-glib/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/file-mode.hpp>
+
+/**
+ * SECTION: file-mode
+ * @title: GArrowFileMode
+ * @short_description: File mode mapping between Arrow and arrow-glib
+ *
+ * #GArrowFileMode provides file modes corresponding to
+ * `arrow::io::FileMode::type` values.
+ */
+
+GArrowFileMode
+garrow_file_mode_from_raw(arrow::io::FileMode::type mode)
+{
+ switch (mode) {
+ case arrow::io::FileMode::type::READ:
+ return GARROW_FILE_MODE_READ;
+ case arrow::io::FileMode::type::WRITE:
+ return GARROW_FILE_MODE_WRITE;
+ case arrow::io::FileMode::type::READWRITE:
+ return GARROW_FILE_MODE_READWRITE;
+ default:
+ return GARROW_FILE_MODE_READ;
+ }
+}
+
+arrow::io::FileMode::type
+garrow_file_mode_to_raw(GArrowFileMode mode)
+{
+ switch (mode) {
+ case GARROW_FILE_MODE_READ:
+ return arrow::io::FileMode::type::READ;
+ case GARROW_FILE_MODE_WRITE:
+ return arrow::io::FileMode::type::WRITE;
+ case GARROW_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/6443b828/c_glib/arrow-glib/file-mode.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/file-mode.h b/c_glib/arrow-glib/file-mode.h
new file mode 100644
index 0000000..8812af8
--- /dev/null
+++ b/c_glib/arrow-glib/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
+
+/**
+ * GArrowFileMode:
+ * @GARROW_FILE_MODE_READ: For read.
+ * @GARROW_FILE_MODE_WRITE: For write.
+ * @GARROW_FILE_MODE_READWRITE: For read-write.
+ *
+ * They are corresponding to `arrow::io::FileMode::type` values.
+ */
+typedef enum {
+ GARROW_FILE_MODE_READ,
+ GARROW_FILE_MODE_WRITE,
+ GARROW_FILE_MODE_READWRITE
+} GArrowFileMode;
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/file-mode.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/file-mode.hpp b/c_glib/arrow-glib/file-mode.hpp
new file mode 100644
index 0000000..2b67379
--- /dev/null
+++ b/c_glib/arrow-glib/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/file-mode.h>
+
+GArrowFileMode garrow_file_mode_from_raw(arrow::io::FileMode::type mode);
+arrow::io::FileMode::type garrow_file_mode_to_raw(GArrowFileMode mode);
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/file-output-stream.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/file-output-stream.cpp b/c_glib/arrow-glib/file-output-stream.cpp
new file mode 100644
index 0000000..b6ca42a
--- /dev/null
+++ b/c_glib/arrow-glib/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/file.hpp>
+#include <arrow-glib/file-output-stream.hpp>
+#include <arrow-glib/output-stream.hpp>
+#include <arrow-glib/writeable.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: file-output-stream
+ * @short_description: A file output stream.
+ *
+ * The #GArrowFileOutputStream is a class for file output stream.
+ */
+
+typedef struct GArrowFileOutputStreamPrivate_ {
+ std::shared_ptr<arrow::io::FileOutputStream> file_output_stream;
+} GArrowFileOutputStreamPrivate;
+
+enum {
+ PROP_0,
+ PROP_FILE_OUTPUT_STREAM
+};
+
+static std::shared_ptr<arrow::io::FileInterface>
+garrow_file_output_stream_get_raw_file_interface(GArrowFile *file)
+{
+ auto file_output_stream = GARROW_FILE_OUTPUT_STREAM(file);
+ auto arrow_file_output_stream =
+ garrow_file_output_stream_get_raw(file_output_stream);
+ return arrow_file_output_stream;
+}
+
+static void
+garrow_file_interface_init(GArrowFileInterface *iface)
+{
+ iface->get_raw = garrow_file_output_stream_get_raw_file_interface;
+}
+
+static std::shared_ptr<arrow::io::Writeable>
+garrow_file_output_stream_get_raw_writeable_interface(GArrowWriteable *writeable)
+{
+ auto file_output_stream = GARROW_FILE_OUTPUT_STREAM(writeable);
+ auto arrow_file_output_stream =
+ garrow_file_output_stream_get_raw(file_output_stream);
+ return arrow_file_output_stream;
+}
+
+static void
+garrow_writeable_interface_init(GArrowWriteableInterface *iface)
+{
+ iface->get_raw = garrow_file_output_stream_get_raw_writeable_interface;
+}
+
+static std::shared_ptr<arrow::io::OutputStream>
+garrow_file_output_stream_get_raw_output_stream_interface(GArrowOutputStream *output_stream)
+{
+ auto file_output_stream = GARROW_FILE_OUTPUT_STREAM(output_stream);
+ auto arrow_file_output_stream =
+ garrow_file_output_stream_get_raw(file_output_stream);
+ return arrow_file_output_stream;
+}
+
+static void
+garrow_output_stream_interface_init(GArrowOutputStreamInterface *iface)
+{
+ iface->get_raw = garrow_file_output_stream_get_raw_output_stream_interface;
+}
+
+G_DEFINE_TYPE_WITH_CODE(GArrowFileOutputStream,
+ garrow_file_output_stream,
+ G_TYPE_OBJECT,
+ G_ADD_PRIVATE(GArrowFileOutputStream)
+ G_IMPLEMENT_INTERFACE(GARROW_TYPE_FILE,
+ garrow_file_interface_init)
+ G_IMPLEMENT_INTERFACE(GARROW_TYPE_WRITEABLE,
+ garrow_writeable_interface_init)
+ G_IMPLEMENT_INTERFACE(GARROW_TYPE_OUTPUT_STREAM,
+ garrow_output_stream_interface_init));
+
+#define GARROW_FILE_OUTPUT_STREAM_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+ GARROW_TYPE_FILE_OUTPUT_STREAM, \
+ GArrowFileOutputStreamPrivate))
+
+static void
+garrow_file_output_stream_finalize(GObject *object)
+{
+ GArrowFileOutputStreamPrivate *priv;
+
+ priv = GARROW_FILE_OUTPUT_STREAM_GET_PRIVATE(object);
+
+ priv->file_output_stream = nullptr;
+
+ G_OBJECT_CLASS(garrow_file_output_stream_parent_class)->finalize(object);
+}
+
+static void
+garrow_file_output_stream_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GArrowFileOutputStreamPrivate *priv;
+
+ priv = GARROW_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_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_file_output_stream_init(GArrowFileOutputStream *object)
+{
+}
+
+static void
+garrow_file_output_stream_class_init(GArrowFileOutputStreamClass *klass)
+{
+ GObjectClass *gobject_class;
+ GParamSpec *spec;
+
+ gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->finalize = garrow_file_output_stream_finalize;
+ gobject_class->set_property = garrow_file_output_stream_set_property;
+ gobject_class->get_property = garrow_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_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
+ * #GArrowFileOutputStream or %NULL on error.
+ */
+GArrowFileOutputStream *
+garrow_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_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
+
+GArrowFileOutputStream *
+garrow_file_output_stream_new_raw(std::shared_ptr<arrow::io::FileOutputStream> *arrow_file_output_stream)
+{
+ auto file_output_stream =
+ GARROW_FILE_OUTPUT_STREAM(g_object_new(GARROW_TYPE_FILE_OUTPUT_STREAM,
+ "file-output-stream", arrow_file_output_stream,
+ NULL));
+ return file_output_stream;
+}
+
+std::shared_ptr<arrow::io::FileOutputStream>
+garrow_file_output_stream_get_raw(GArrowFileOutputStream *file_output_stream)
+{
+ GArrowFileOutputStreamPrivate *priv;
+
+ priv = GARROW_FILE_OUTPUT_STREAM_GET_PRIVATE(file_output_stream);
+ return priv->file_output_stream;
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/file-output-stream.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/file-output-stream.h b/c_glib/arrow-glib/file-output-stream.h
new file mode 100644
index 0000000..bef3700
--- /dev/null
+++ b/c_glib/arrow-glib/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_TYPE_FILE_OUTPUT_STREAM \
+ (garrow_file_output_stream_get_type())
+#define GARROW_FILE_OUTPUT_STREAM(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_FILE_OUTPUT_STREAM, \
+ GArrowFileOutputStream))
+#define GARROW_FILE_OUTPUT_STREAM_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_FILE_OUTPUT_STREAM, \
+ GArrowFileOutputStreamClass))
+#define GARROW_IS_FILE_OUTPUT_STREAM(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_FILE_OUTPUT_STREAM))
+#define GARROW_IS_FILE_OUTPUT_STREAM_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_FILE_OUTPUT_STREAM))
+#define GARROW_FILE_OUTPUT_STREAM_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_FILE_OUTPUT_STREAM, \
+ GArrowFileOutputStreamClass))
+
+typedef struct _GArrowFileOutputStream GArrowFileOutputStream;
+typedef struct _GArrowFileOutputStreamClass GArrowFileOutputStreamClass;
+
+/**
+ * GArrowFileOutputStream:
+ *
+ * It wraps `arrow::io::FileOutputStream`.
+ */
+struct _GArrowFileOutputStream
+{
+ /*< private >*/
+ GObject parent_instance;
+};
+
+struct _GArrowFileOutputStreamClass
+{
+ GObjectClass parent_class;
+};
+
+GType garrow_file_output_stream_get_type(void) G_GNUC_CONST;
+
+GArrowFileOutputStream *garrow_file_output_stream_open(const gchar *path,
+ gboolean append,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/file-output-stream.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/file-output-stream.hpp b/c_glib/arrow-glib/file-output-stream.hpp
new file mode 100644
index 0000000..0b10418
--- /dev/null
+++ b/c_glib/arrow-glib/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/file-output-stream.h>
+
+GArrowFileOutputStream *garrow_file_output_stream_new_raw(std::shared_ptr<arrow::io::FileOutputStream> *arrow_file_output_stream);
+std::shared_ptr<arrow::io::FileOutputStream> garrow_file_output_stream_get_raw(GArrowFileOutputStream *file_output_stream);
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/file-reader.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/file-reader.cpp b/c_glib/arrow-glib/file-reader.cpp
new file mode 100644
index 0000000..c2aeabe
--- /dev/null
+++ b/c_glib/arrow-glib/file-reader.cpp
@@ -0,0 +1,247 @@
+/*
+ * 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/ipc/api.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/record-batch.hpp>
+#include <arrow-glib/schema.hpp>
+
+#include <arrow-glib/random-access-file.hpp>
+
+#include <arrow-glib/file-reader.hpp>
+#include <arrow-glib/metadata-version.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: file-reader
+ * @short_description: File reader class
+ *
+ * #GArrowFileReader is a class for receiving data by file based IPC.
+ */
+
+typedef struct GArrowFileReaderPrivate_ {
+ std::shared_ptr<arrow::ipc::FileReader> file_reader;
+} GArrowFileReaderPrivate;
+
+enum {
+ PROP_0,
+ PROP_FILE_READER
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowFileReader,
+ garrow_file_reader,
+ G_TYPE_OBJECT);
+
+#define GARROW_FILE_READER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+ GARROW_TYPE_FILE_READER, \
+ GArrowFileReaderPrivate))
+
+static void
+garrow_file_reader_finalize(GObject *object)
+{
+ GArrowFileReaderPrivate *priv;
+
+ priv = GARROW_FILE_READER_GET_PRIVATE(object);
+
+ priv->file_reader = nullptr;
+
+ G_OBJECT_CLASS(garrow_file_reader_parent_class)->finalize(object);
+}
+
+static void
+garrow_file_reader_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GArrowFileReaderPrivate *priv;
+
+ priv = GARROW_FILE_READER_GET_PRIVATE(object);
+
+ switch (prop_id) {
+ case PROP_FILE_READER:
+ priv->file_reader =
+ *static_cast<std::shared_ptr<arrow::ipc::FileReader> *>(g_value_get_pointer(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_file_reader_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_file_reader_init(GArrowFileReader *object)
+{
+}
+
+static void
+garrow_file_reader_class_init(GArrowFileReaderClass *klass)
+{
+ GObjectClass *gobject_class;
+ GParamSpec *spec;
+
+ gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->finalize = garrow_file_reader_finalize;
+ gobject_class->set_property = garrow_file_reader_set_property;
+ gobject_class->get_property = garrow_file_reader_get_property;
+
+ spec = g_param_spec_pointer("file-reader",
+ "ipc::FileReader",
+ "The raw std::shared<arrow::ipc::FileReader> *",
+ static_cast<GParamFlags>(G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property(gobject_class, PROP_FILE_READER, spec);
+}
+
+/**
+ * garrow_file_reader_open:
+ * @file: The file to be read.
+ * @error: (nullable): Return locatipcn for a #GError or %NULL.
+ *
+ * Returns: (nullable) (transfer full): A newly opened
+ * #GArrowFileReader or %NULL on error.
+ */
+GArrowFileReader *
+garrow_file_reader_open(GArrowRandomAccessFile *file,
+ GError **error)
+{
+ std::shared_ptr<arrow::ipc::FileReader> arrow_file_reader;
+ auto status =
+ arrow::ipc::FileReader::Open(garrow_random_access_file_get_raw(file),
+ &arrow_file_reader);
+ if (status.ok()) {
+ return garrow_file_reader_new_raw(&arrow_file_reader);
+ } else {
+ garrow_error_set(error, status, "[ipc][file-reader][open]");
+ return NULL;
+ }
+}
+
+/**
+ * garrow_file_reader_get_schema:
+ * @file_reader: A #GArrowFileReader.
+ *
+ * Returns: (transfer full): The schema in the file.
+ */
+GArrowSchema *
+garrow_file_reader_get_schema(GArrowFileReader *file_reader)
+{
+ auto arrow_file_reader =
+ garrow_file_reader_get_raw(file_reader);
+ auto arrow_schema = arrow_file_reader->schema();
+ return garrow_schema_new_raw(&arrow_schema);
+}
+
+/**
+ * garrow_file_reader_get_n_record_batches:
+ * @file_reader: A #GArrowFileReader.
+ *
+ * Returns: The number of record batches in the file.
+ */
+guint
+garrow_file_reader_get_n_record_batches(GArrowFileReader *file_reader)
+{
+ auto arrow_file_reader =
+ garrow_file_reader_get_raw(file_reader);
+ return arrow_file_reader->num_record_batches();
+}
+
+/**
+ * garrow_file_reader_get_version:
+ * @file_reader: A #GArrowFileReader.
+ *
+ * Returns: The format version in the file.
+ */
+GArrowMetadataVersion
+garrow_file_reader_get_version(GArrowFileReader *file_reader)
+{
+ auto arrow_file_reader =
+ garrow_file_reader_get_raw(file_reader);
+ auto arrow_version = arrow_file_reader->version();
+ return garrow_metadata_version_from_raw(arrow_version);
+}
+
+/**
+ * garrow_file_reader_get_record_batch:
+ * @file_reader: A #GArrowFileReader.
+ * @i: The index of the target record batch.
+ * @error: (nullable): Return locatipcn for a #GError or %NULL.
+ *
+ * Returns: (nullable) (transfer full):
+ * The i-th record batch in the file or %NULL on error.
+ */
+GArrowRecordBatch *
+garrow_file_reader_get_record_batch(GArrowFileReader *file_reader,
+ guint i,
+ GError **error)
+{
+ auto arrow_file_reader =
+ garrow_file_reader_get_raw(file_reader);
+ std::shared_ptr<arrow::RecordBatch> arrow_record_batch;
+ auto status = arrow_file_reader->GetRecordBatch(i, &arrow_record_batch);
+
+ if (status.ok()) {
+ return garrow_record_batch_new_raw(&arrow_record_batch);
+ } else {
+ garrow_error_set(error, status, "[ipc][file-reader][get-record-batch]");
+ return NULL;
+ }
+}
+
+G_END_DECLS
+
+GArrowFileReader *
+garrow_file_reader_new_raw(std::shared_ptr<arrow::ipc::FileReader> *arrow_file_reader)
+{
+ auto file_reader =
+ GARROW_FILE_READER(g_object_new(GARROW_TYPE_FILE_READER,
+ "file-reader", arrow_file_reader,
+ NULL));
+ return file_reader;
+}
+
+std::shared_ptr<arrow::ipc::FileReader>
+garrow_file_reader_get_raw(GArrowFileReader *file_reader)
+{
+ GArrowFileReaderPrivate *priv;
+
+ priv = GARROW_FILE_READER_GET_PRIVATE(file_reader);
+ return priv->file_reader;
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/file-reader.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/file-reader.h b/c_glib/arrow-glib/file-reader.h
new file mode 100644
index 0000000..084f714
--- /dev/null
+++ b/c_glib/arrow-glib/file-reader.h
@@ -0,0 +1,83 @@
+/*
+ * 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/record-batch.h>
+#include <arrow-glib/schema.h>
+
+#include <arrow-glib/random-access-file.h>
+
+#include <arrow-glib/metadata-version.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_FILE_READER \
+ (garrow_file_reader_get_type())
+#define GARROW_FILE_READER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_FILE_READER, \
+ GArrowFileReader))
+#define GARROW_FILE_READER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_FILE_READER, \
+ GArrowFileReaderClass))
+#define GARROW_IS_FILE_READER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_FILE_READER))
+#define GARROW_IS_FILE_READER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_FILE_READER))
+#define GARROW_FILE_READER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_FILE_READER, \
+ GArrowFileReaderClass))
+
+typedef struct _GArrowFileReader GArrowFileReader;
+typedef struct _GArrowFileReaderClass GArrowFileReaderClass;
+
+/**
+ * GArrowFileReader:
+ *
+ * It wraps `arrow::ipc::FileReader`.
+ */
+struct _GArrowFileReader
+{
+ /*< private >*/
+ GObject parent_instance;
+};
+
+struct _GArrowFileReaderClass
+{
+ GObjectClass parent_class;
+};
+
+GType garrow_file_reader_get_type(void) G_GNUC_CONST;
+
+GArrowFileReader *garrow_file_reader_open(GArrowRandomAccessFile *file,
+ GError **error);
+
+GArrowSchema *garrow_file_reader_get_schema(GArrowFileReader *file_reader);
+guint garrow_file_reader_get_n_record_batches(GArrowFileReader *file_reader);
+GArrowMetadataVersion garrow_file_reader_get_version(GArrowFileReader *file_reader);
+GArrowRecordBatch *garrow_file_reader_get_record_batch(GArrowFileReader *file_reader,
+ guint i,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/file-reader.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/file-reader.hpp b/c_glib/arrow-glib/file-reader.hpp
new file mode 100644
index 0000000..152379b
--- /dev/null
+++ b/c_glib/arrow-glib/file-reader.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/ipc/api.h>
+
+#include <arrow-glib/file-reader.h>
+
+GArrowFileReader *garrow_file_reader_new_raw(std::shared_ptr<arrow::ipc::FileReader> *arrow_file_reader);
+std::shared_ptr<arrow::ipc::FileReader> garrow_file_reader_get_raw(GArrowFileReader *file_reader);
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/file-writer.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/file-writer.cpp b/c_glib/arrow-glib/file-writer.cpp
new file mode 100644
index 0000000..68eca2e
--- /dev/null
+++ b/c_glib/arrow-glib/file-writer.cpp
@@ -0,0 +1,158 @@
+/*
+ * 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/ipc/api.h>
+
+#include <arrow-glib/array.hpp>
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/record-batch.hpp>
+#include <arrow-glib/schema.hpp>
+
+#include <arrow-glib/output-stream.hpp>
+
+#include <arrow-glib/stream-writer.hpp>
+#include <arrow-glib/file-writer.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: file-writer
+ * @short_description: File writer class
+ *
+ * #GArrowFileWriter is a class for sending data by file based IPC.
+ */
+
+G_DEFINE_TYPE(GArrowFileWriter,
+ garrow_file_writer,
+ GARROW_TYPE_STREAM_WRITER);
+
+static void
+garrow_file_writer_init(GArrowFileWriter *object)
+{
+}
+
+static void
+garrow_file_writer_class_init(GArrowFileWriterClass *klass)
+{
+}
+
+/**
+ * garrow_file_writer_open:
+ * @sink: The output of the writer.
+ * @schema: The schema of the writer.
+ * @error: (nullable): Return locatipcn for a #GError or %NULL.
+ *
+ * Returns: (nullable) (transfer full): A newly opened
+ * #GArrowFileWriter or %NULL on error.
+ */
+GArrowFileWriter *
+garrow_file_writer_open(GArrowOutputStream *sink,
+ GArrowSchema *schema,
+ GError **error)
+{
+ std::shared_ptr<arrow::ipc::FileWriter> arrow_file_writer;
+ auto status =
+ arrow::ipc::FileWriter::Open(garrow_output_stream_get_raw(sink).get(),
+ garrow_schema_get_raw(schema),
+ &arrow_file_writer);
+ if (status.ok()) {
+ return garrow_file_writer_new_raw(&arrow_file_writer);
+ } else {
+ garrow_error_set(error, status, "[ipc][file-writer][open]");
+ return NULL;
+ }
+}
+
+/**
+ * garrow_file_writer_write_record_batch:
+ * @file_writer: A #GArrowFileWriter.
+ * @record_batch: The record batch to be written.
+ * @error: (nullable): Return locatipcn for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_file_writer_write_record_batch(GArrowFileWriter *file_writer,
+ GArrowRecordBatch *record_batch,
+ GError **error)
+{
+ auto arrow_file_writer =
+ garrow_file_writer_get_raw(file_writer);
+ auto arrow_record_batch =
+ garrow_record_batch_get_raw(record_batch);
+ auto arrow_record_batch_raw =
+ arrow_record_batch.get();
+
+ auto status = arrow_file_writer->WriteRecordBatch(*arrow_record_batch_raw);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[ipc][file-writer][write-record-batch]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_file_writer_close:
+ * @file_writer: A #GArrowFileWriter.
+ * @error: (nullable): Return locatipcn for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_file_writer_close(GArrowFileWriter *file_writer,
+ GError **error)
+{
+ auto arrow_file_writer =
+ garrow_file_writer_get_raw(file_writer);
+
+ auto status = arrow_file_writer->Close();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[ipc][file-writer][close]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
+
+GArrowFileWriter *
+garrow_file_writer_new_raw(std::shared_ptr<arrow::ipc::FileWriter> *arrow_file_writer)
+{
+ auto file_writer =
+ GARROW_FILE_WRITER(g_object_new(GARROW_TYPE_FILE_WRITER,
+ "stream-writer", arrow_file_writer,
+ NULL));
+ return file_writer;
+}
+
+arrow::ipc::FileWriter *
+garrow_file_writer_get_raw(GArrowFileWriter *file_writer)
+{
+ auto arrow_stream_writer =
+ garrow_stream_writer_get_raw(GARROW_STREAM_WRITER(file_writer));
+ auto arrow_file_writer_raw =
+ dynamic_cast<arrow::ipc::FileWriter *>(arrow_stream_writer.get());
+ return arrow_file_writer_raw;
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/file-writer.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/file-writer.h b/c_glib/arrow-glib/file-writer.h
new file mode 100644
index 0000000..7f9a4f0
--- /dev/null
+++ b/c_glib/arrow-glib/file-writer.h
@@ -0,0 +1,78 @@
+/*
+ * 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/stream-writer.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_FILE_WRITER \
+ (garrow_file_writer_get_type())
+#define GARROW_FILE_WRITER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_FILE_WRITER, \
+ GArrowFileWriter))
+#define GARROW_FILE_WRITER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_FILE_WRITER, \
+ GArrowFileWriterClass))
+#define GARROW_IS_FILE_WRITER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_FILE_WRITER))
+#define GARROW_IS_FILE_WRITER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_FILE_WRITER))
+#define GARROW_FILE_WRITER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_FILE_WRITER, \
+ GArrowFileWriterClass))
+
+typedef struct _GArrowFileWriter GArrowFileWriter;
+typedef struct _GArrowFileWriterClass GArrowFileWriterClass;
+
+/**
+ * GArrowFileWriter:
+ *
+ * It wraps `arrow::ipc::FileWriter`.
+ */
+struct _GArrowFileWriter
+{
+ /*< private >*/
+ GArrowStreamWriter parent_instance;
+};
+
+struct _GArrowFileWriterClass
+{
+ GObjectClass parent_class;
+};
+
+GType garrow_file_writer_get_type(void) G_GNUC_CONST;
+
+GArrowFileWriter *garrow_file_writer_open(GArrowOutputStream *sink,
+ GArrowSchema *schema,
+ GError **error);
+
+gboolean garrow_file_writer_write_record_batch(GArrowFileWriter *file_writer,
+ GArrowRecordBatch *record_batch,
+ GError **error);
+gboolean garrow_file_writer_close(GArrowFileWriter *file_writer,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/file-writer.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/file-writer.hpp b/c_glib/arrow-glib/file-writer.hpp
new file mode 100644
index 0000000..f6a720a
--- /dev/null
+++ b/c_glib/arrow-glib/file-writer.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/ipc/api.h>
+
+#include <arrow-glib/file-writer.h>
+
+GArrowFileWriter *garrow_file_writer_new_raw(std::shared_ptr<arrow::ipc::FileWriter> *arrow_file_writer);
+arrow::ipc::FileWriter *garrow_file_writer_get_raw(GArrowFileWriter *file_writer);
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/file.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/file.cpp b/c_glib/arrow-glib/file.cpp
new file mode 100644
index 0000000..0d0fe1d
--- /dev/null
+++ b/c_glib/arrow-glib/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/file.hpp>
+#include <arrow-glib/file-mode.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: file
+ * @title: GArrowFile
+ * @short_description: File interface
+ *
+ * #GArrowFile is an interface for file.
+ */
+
+G_DEFINE_INTERFACE(GArrowFile,
+ garrow_file,
+ G_TYPE_OBJECT)
+
+static void
+garrow_file_default_init (GArrowFileInterface *iface)
+{
+}
+
+/**
+ * garrow_file_close:
+ * @file: A #GArrowFile.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_file_close(GArrowFile *file,
+ GError **error)
+{
+ auto arrow_file = garrow_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_file_tell:
+ * @file: A #GArrowFile.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: The current offset on success, -1 if there was an error.
+ */
+gint64
+garrow_file_tell(GArrowFile *file,
+ GError **error)
+{
+ auto arrow_file = garrow_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_file_get_mode:
+ * @file: A #GArrowFile.
+ *
+ * Returns: The mode of the file.
+ */
+GArrowFileMode
+garrow_file_get_mode(GArrowFile *file)
+{
+ auto arrow_file = garrow_file_get_raw(file);
+
+ auto arrow_mode = arrow_file->mode();
+ return garrow_file_mode_from_raw(arrow_mode);
+}
+
+G_END_DECLS
+
+std::shared_ptr<arrow::io::FileInterface>
+garrow_file_get_raw(GArrowFile *file)
+{
+ auto *iface = GARROW_FILE_GET_IFACE(file);
+ return iface->get_raw(file);
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/file.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/file.h b/c_glib/arrow-glib/file.h
new file mode 100644
index 0000000..68054aa
--- /dev/null
+++ b/c_glib/arrow-glib/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/file-mode.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_FILE \
+ (garrow_file_get_type())
+#define GARROW_FILE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_FILE, \
+ GArrowFile))
+#define GARROW_IS_FILE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_FILE))
+#define GARROW_FILE_GET_IFACE(obj) \
+ (G_TYPE_INSTANCE_GET_INTERFACE((obj), \
+ GARROW_TYPE_FILE, \
+ GArrowFileInterface))
+
+typedef struct _GArrowFile GArrowFile;
+typedef struct _GArrowFileInterface GArrowFileInterface;
+
+GType garrow_file_get_type(void) G_GNUC_CONST;
+
+gboolean garrow_file_close(GArrowFile *file,
+ GError **error);
+gint64 garrow_file_tell(GArrowFile *file,
+ GError **error);
+GArrowFileMode garrow_file_get_mode(GArrowFile *file);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/file.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/file.hpp b/c_glib/arrow-glib/file.hpp
new file mode 100644
index 0000000..c4cc787
--- /dev/null
+++ b/c_glib/arrow-glib/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/file.h>
+
+/**
+ * GArrowFileInterface:
+ *
+ * It wraps `arrow::io::FileInterface`.
+ */
+struct _GArrowFileInterface
+{
+ GTypeInterface parent_iface;
+
+ std::shared_ptr<arrow::io::FileInterface> (*get_raw)(GArrowFile *file);
+};
+
+std::shared_ptr<arrow::io::FileInterface> garrow_file_get_raw(GArrowFile *file);
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/input-stream.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/input-stream.cpp b/c_glib/arrow-glib/input-stream.cpp
new file mode 100644
index 0000000..36bef80
--- /dev/null
+++ b/c_glib/arrow-glib/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/input-stream.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: input-stream
+ * @title: GArrowInputStream
+ * @short_description: Stream input interface
+ *
+ * #GArrowInputStream is an interface for stream input. Stream input
+ * is file based and readable.
+ */
+
+G_DEFINE_INTERFACE(GArrowInputStream,
+ garrow_input_stream,
+ G_TYPE_OBJECT)
+
+static void
+garrow_input_stream_default_init (GArrowInputStreamInterface *iface)
+{
+}
+
+G_END_DECLS
+
+std::shared_ptr<arrow::io::InputStream>
+garrow_input_stream_get_raw(GArrowInputStream *input_stream)
+{
+ auto *iface = GARROW_INPUT_STREAM_GET_IFACE(input_stream);
+ return iface->get_raw(input_stream);
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/input-stream.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/input-stream.h b/c_glib/arrow-glib/input-stream.h
new file mode 100644
index 0000000..4b331b9
--- /dev/null
+++ b/c_glib/arrow-glib/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_TYPE_INPUT_STREAM \
+ (garrow_input_stream_get_type())
+#define GARROW_INPUT_STREAM(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_INPUT_STREAM, \
+ GArrowInputStream))
+#define GARROW_IS_INPUT_STREAM(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_INPUT_STREAM))
+#define GARROW_INPUT_STREAM_GET_IFACE(obj) \
+ (G_TYPE_INSTANCE_GET_INTERFACE((obj), \
+ GARROW_TYPE_INPUT_STREAM, \
+ GArrowInputStreamInterface))
+
+typedef struct _GArrowInputStream GArrowInputStream;
+typedef struct _GArrowInputStreamInterface GArrowInputStreamInterface;
+
+GType garrow_input_stream_get_type(void) G_GNUC_CONST;
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/c_glib/arrow-glib/input-stream.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/input-stream.hpp b/c_glib/arrow-glib/input-stream.hpp
new file mode 100644
index 0000000..7958df1
--- /dev/null
+++ b/c_glib/arrow-glib/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/input-stream.h>
+
+/**
+ * GArrowInputStreamInterface:
+ *
+ * It wraps `arrow::io::InputStream`.
+ */
+struct _GArrowInputStreamInterface
+{
+ GTypeInterface parent_iface;
+
+ std::shared_ptr<arrow::io::InputStream> (*get_raw)(GArrowInputStream *file);
+};
+
+std::shared_ptr<arrow::io::InputStream> garrow_input_stream_get_raw(GArrowInputStream *input_stream);
http://git-wip-us.apache.org/repos/asf/arrow/blob/6443b828/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
deleted file mode 100644
index 7998d3f..0000000
--- a/c_glib/arrow-glib/io-file-mode.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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/6443b828/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
deleted file mode 100644
index 03eca35..0000000
--- a/c_glib/arrow-glib/io-file-mode.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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/6443b828/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
deleted file mode 100644
index b3d8ac6..0000000
--- a/c_glib/arrow-glib/io-file-mode.hpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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/6443b828/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
deleted file mode 100644
index 673e8cd..0000000
--- a/c_glib/arrow-glib/io-file-output-stream.cpp
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * 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/6443b828/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
deleted file mode 100644
index 032b125..0000000
--- a/c_glib/arrow-glib/io-file-output-stream.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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/6443b828/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
deleted file mode 100644
index 76b8e91..0000000
--- a/c_glib/arrow-glib/io-file-output-stream.hpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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);