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/30 17:08:19 UTC

arrow git commit: ARROW-916: [GLib] Add GArrowBufferOutputStream

Repository: arrow
Updated Branches:
  refs/heads/master 53c093b52 -> ed5a1d4f9


ARROW-916: [GLib] Add GArrowBufferOutputStream

Author: Kouhei Sutou <ko...@clear-code.com>

Closes #616 from kou/glib-buffer-output-stream and squashes the following commits:

75c89cb [Kouhei Sutou] [GLib] Add GArrowBufferOutputStream


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/ed5a1d4f
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/ed5a1d4f
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/ed5a1d4f

Branch: refs/heads/master
Commit: ed5a1d4f9ae13c0474418d2b0534cbacdca57ef8
Parents: 53c093b
Author: Kouhei Sutou <ko...@clear-code.com>
Authored: Sun Apr 30 13:08:13 2017 -0400
Committer: Wes McKinney <we...@twosigma.com>
Committed: Sun Apr 30 13:08:13 2017 -0400

----------------------------------------------------------------------
 c_glib/arrow-glib/output-stream.cpp    | 204 ++++++++++++++++------------
 c_glib/arrow-glib/output-stream.h      |  99 ++++++++++++--
 c_glib/arrow-glib/output-stream.hpp    |  17 +--
 c_glib/test/test-buffer-output-file.rb |  26 ++++
 4 files changed, 237 insertions(+), 109 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/ed5a1d4f/c_glib/arrow-glib/output-stream.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/output-stream.cpp b/c_glib/arrow-glib/output-stream.cpp
index 037814c..b757d44 100644
--- a/c_glib/arrow-glib/output-stream.cpp
+++ b/c_glib/arrow-glib/output-stream.cpp
@@ -22,7 +22,9 @@
 #endif
 
 #include <arrow/api.h>
+#include <arrow/io/memory.h>
 
+#include <arrow-glib/buffer.hpp>
 #include <arrow-glib/error.hpp>
 #include <arrow-glib/file.hpp>
 #include <arrow-glib/output-stream.hpp>
@@ -40,114 +42,87 @@ G_BEGIN_DECLS
  * output is file based and writeable
  *
  * #GArrowFileOutputStream is a class for file output stream.
+ *
+ * #GArrowBufferOutputStream is a class for buffer output stream.
  */
 
-G_DEFINE_INTERFACE(GArrowOutputStream,
-                   garrow_output_stream,
-                   G_TYPE_OBJECT)
-
-static void
-garrow_output_stream_default_init (GArrowOutputStreamInterface *iface)
-{
-}
-
-
-typedef struct GArrowFileOutputStreamPrivate_ {
-  std::shared_ptr<arrow::io::FileOutputStream> file_output_stream;
-} GArrowFileOutputStreamPrivate;
+typedef struct GArrowOutputStreamPrivate_ {
+  std::shared_ptr<arrow::io::OutputStream> output_stream;
+} GArrowOutputStreamPrivate;
 
 enum {
   PROP_0,
-  PROP_FILE_OUTPUT_STREAM
+  PROP_OUTPUT_STREAM
 };
 
 static std::shared_ptr<arrow::io::FileInterface>
-garrow_file_output_stream_get_raw_file_interface(GArrowFile *file)
+garrow_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;
+  auto output_stream = GARROW_OUTPUT_STREAM(file);
+  auto arrow_output_stream = garrow_output_stream_get_raw(output_stream);
+  return arrow_output_stream;
 }
 
 static void
-garrow_file_interface_init(GArrowFileInterface *iface)
+garrow_output_stream_file_interface_init(GArrowFileInterface *iface)
 {
-  iface->get_raw = garrow_file_output_stream_get_raw_file_interface;
+  iface->get_raw = garrow_output_stream_get_raw_file_interface;
 }
 
 static std::shared_ptr<arrow::io::Writeable>
-garrow_file_output_stream_get_raw_writeable_interface(GArrowWriteable *writeable)
+garrow_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;
+  auto output_stream = GARROW_OUTPUT_STREAM(writeable);
+  auto arrow_output_stream = garrow_output_stream_get_raw(output_stream);
+  return arrow_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)
+garrow_output_stream_writeable_interface_init(GArrowWriteableInterface *iface)
 {
-  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;
+  iface->get_raw = garrow_output_stream_get_raw_writeable_interface;
 }
 
-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_DEFINE_TYPE_WITH_CODE(GArrowOutputStream,
+                        garrow_output_stream,
                         G_TYPE_OBJECT,
-                        G_ADD_PRIVATE(GArrowFileOutputStream)
+                        G_ADD_PRIVATE(GArrowOutputStream)
                         G_IMPLEMENT_INTERFACE(GARROW_TYPE_FILE,
-                                              garrow_file_interface_init)
+                                              garrow_output_stream_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));
+                                              garrow_output_stream_writeable_interface_init));
 
-#define GARROW_FILE_OUTPUT_STREAM_GET_PRIVATE(obj)              \
+#define GARROW_OUTPUT_STREAM_GET_PRIVATE(obj)                   \
   (G_TYPE_INSTANCE_GET_PRIVATE((obj),                           \
-                               GARROW_TYPE_FILE_OUTPUT_STREAM,  \
-                               GArrowFileOutputStreamPrivate))
+                               GARROW_TYPE_OUTPUT_STREAM,       \
+                               GArrowOutputStreamPrivate))
 
 static void
-garrow_file_output_stream_finalize(GObject *object)
+garrow_output_stream_finalize(GObject *object)
 {
-  GArrowFileOutputStreamPrivate *priv;
+  GArrowOutputStreamPrivate *priv;
 
-  priv = GARROW_FILE_OUTPUT_STREAM_GET_PRIVATE(object);
+  priv = GARROW_OUTPUT_STREAM_GET_PRIVATE(object);
 
-  priv->file_output_stream = nullptr;
+  priv->output_stream = nullptr;
 
-  G_OBJECT_CLASS(garrow_file_output_stream_parent_class)->finalize(object);
+  G_OBJECT_CLASS(garrow_output_stream_parent_class)->finalize(object);
 }
 
 static void
-garrow_file_output_stream_set_property(GObject *object,
+garrow_output_stream_set_property(GObject *object,
                                           guint prop_id,
                                           const GValue *value,
                                           GParamSpec *pspec)
 {
-  GArrowFileOutputStreamPrivate *priv;
+  GArrowOutputStreamPrivate *priv;
 
-  priv = GARROW_FILE_OUTPUT_STREAM_GET_PRIVATE(object);
+  priv = GARROW_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));
+  case PROP_OUTPUT_STREAM:
+    priv->output_stream =
+      *static_cast<std::shared_ptr<arrow::io::OutputStream> *>(g_value_get_pointer(value));
     break;
   default:
     G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
@@ -156,7 +131,7 @@ garrow_file_output_stream_set_property(GObject *object,
 }
 
 static void
-garrow_file_output_stream_get_property(GObject *object,
+garrow_output_stream_get_property(GObject *object,
                                           guint prop_id,
                                           GValue *value,
                                           GParamSpec *pspec)
@@ -169,28 +144,43 @@ garrow_file_output_stream_get_property(GObject *object,
 }
 
 static void
-garrow_file_output_stream_init(GArrowFileOutputStream *object)
+garrow_output_stream_init(GArrowOutputStream *object)
 {
 }
 
 static void
-garrow_file_output_stream_class_init(GArrowFileOutputStreamClass *klass)
+garrow_output_stream_class_init(GArrowOutputStreamClass *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;
+  gobject_class->finalize     = garrow_output_stream_finalize;
+  gobject_class->set_property = garrow_output_stream_set_property;
+  gobject_class->get_property = garrow_output_stream_get_property;
 
-  spec = g_param_spec_pointer("file-output-stream",
-                              "io::FileOutputStream",
-                              "The raw std::shared<arrow::io::FileOutputStream> *",
+  spec = g_param_spec_pointer("output-stream",
+                              "io::OutputStream",
+                              "The raw std::shared<arrow::io::OutputStream> *",
                               static_cast<GParamFlags>(G_PARAM_WRITABLE |
                                                        G_PARAM_CONSTRUCT_ONLY));
-  g_object_class_install_property(gobject_class, PROP_FILE_OUTPUT_STREAM, spec);
+  g_object_class_install_property(gobject_class, PROP_OUTPUT_STREAM, spec);
+}
+
+
+G_DEFINE_TYPE(GArrowFileOutputStream,
+              garrow_file_output_stream,
+              GARROW_TYPE_OUTPUT_STREAM);
+
+static void
+garrow_file_output_stream_init(GArrowFileOutputStream *file_output_stream)
+{
+}
+
+static void
+garrow_file_output_stream_class_init(GArrowFileOutputStreamClass *klass)
+{
 }
 
 /**
@@ -204,8 +194,8 @@ garrow_file_output_stream_class_init(GArrowFileOutputStreamClass *klass)
  */
 GArrowFileOutputStream *
 garrow_file_output_stream_open(const gchar *path,
-                                  gboolean append,
-                                  GError **error)
+                               gboolean append,
+                               GError **error)
 {
   std::shared_ptr<arrow::io::FileOutputStream> arrow_file_output_stream;
   auto status =
@@ -223,13 +213,56 @@ garrow_file_output_stream_open(const gchar *path,
   }
 }
 
+
+G_DEFINE_TYPE(GArrowBufferOutputStream,
+              garrow_buffer_output_stream,
+              GARROW_TYPE_OUTPUT_STREAM);
+
+static void
+garrow_buffer_output_stream_init(GArrowBufferOutputStream *buffer_output_stream)
+{
+}
+
+static void
+garrow_buffer_output_stream_class_init(GArrowBufferOutputStreamClass *klass)
+{
+}
+
+/**
+ * garrow_buffer_output_stream_new:
+ * @buffer: The resizable buffer to be output.
+ *
+ * Returns: (transfer full): A newly created #GArrowBufferOutputStream.
+ */
+GArrowBufferOutputStream *
+garrow_buffer_output_stream_new(GArrowResizableBuffer *buffer)
+{
+  auto arrow_buffer = garrow_buffer_get_raw(GARROW_BUFFER(buffer));
+  auto arrow_resizable_buffer =
+    std::static_pointer_cast<arrow::ResizableBuffer>(arrow_buffer);
+  auto arrow_buffer_output_stream =
+    std::make_shared<arrow::io::BufferOutputStream>(arrow_resizable_buffer);
+  return garrow_buffer_output_stream_new_raw(&arrow_buffer_output_stream);
+}
 G_END_DECLS
 
+GArrowOutputStream *
+garrow_output_stream_new_raw(std::shared_ptr<arrow::io::OutputStream> *arrow_output_stream)
+{
+  auto output_stream =
+    GARROW_OUTPUT_STREAM(g_object_new(GARROW_TYPE_OUTPUT_STREAM,
+                                      "output-stream", arrow_output_stream,
+                                      NULL));
+  return output_stream;
+}
+
 std::shared_ptr<arrow::io::OutputStream>
 garrow_output_stream_get_raw(GArrowOutputStream *output_stream)
 {
-  auto *iface = GARROW_OUTPUT_STREAM_GET_IFACE(output_stream);
-  return iface->get_raw(output_stream);
+  GArrowOutputStreamPrivate *priv;
+
+  priv = GARROW_OUTPUT_STREAM_GET_PRIVATE(output_stream);
+  return priv->output_stream;
 }
 
 
@@ -238,16 +271,17 @@ garrow_file_output_stream_new_raw(std::shared_ptr<arrow::io::FileOutputStream> *
 {
   auto file_output_stream =
     GARROW_FILE_OUTPUT_STREAM(g_object_new(GARROW_TYPE_FILE_OUTPUT_STREAM,
-                                           "file-output-stream", arrow_file_output_stream,
+                                           "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)
+GArrowBufferOutputStream *
+garrow_buffer_output_stream_new_raw(std::shared_ptr<arrow::io::BufferOutputStream> *arrow_buffer_output_stream)
 {
-  GArrowFileOutputStreamPrivate *priv;
-
-  priv = GARROW_FILE_OUTPUT_STREAM_GET_PRIVATE(file_output_stream);
-  return priv->file_output_stream;
+  auto buffer_output_stream =
+    GARROW_BUFFER_OUTPUT_STREAM(g_object_new(GARROW_TYPE_BUFFER_OUTPUT_STREAM,
+                                             "output-stream", arrow_buffer_output_stream,
+                                             NULL));
+  return buffer_output_stream;
 }

http://git-wip-us.apache.org/repos/asf/arrow/blob/ed5a1d4f/c_glib/arrow-glib/output-stream.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/output-stream.h b/c_glib/arrow-glib/output-stream.h
index 043832e..2a14a24 100644
--- a/c_glib/arrow-glib/output-stream.h
+++ b/c_glib/arrow-glib/output-stream.h
@@ -21,24 +21,53 @@
 
 #include <glib-object.h>
 
+#include <arrow-glib/buffer.h>
+
 G_BEGIN_DECLS
 
-#define GARROW_TYPE_OUTPUT_STREAM            \
+#define GARROW_TYPE_OUTPUT_STREAM               \
   (garrow_output_stream_get_type())
-#define GARROW_OUTPUT_STREAM(obj)                            \
+#define GARROW_OUTPUT_STREAM(obj)                               \
   (G_TYPE_CHECK_INSTANCE_CAST((obj),                            \
-                              GARROW_TYPE_OUTPUT_STREAM,     \
+                              GARROW_TYPE_OUTPUT_STREAM,        \
                               GArrowOutputStream))
-#define GARROW_IS_OUTPUT_STREAM(obj)                         \
+#define GARROW_OUTPUT_STREAM_CLASS(klass)               \
+  (G_TYPE_CHECK_CLASS_CAST((klass),                     \
+                           GARROW_TYPE_OUTPUT_STREAM,   \
+                           GArrowOutputStreamClass))
+#define GARROW_IS_OUTPUT_STREAM(obj)                            \
   (G_TYPE_CHECK_INSTANCE_TYPE((obj),                            \
                               GARROW_TYPE_OUTPUT_STREAM))
-#define GARROW_OUTPUT_STREAM_GET_IFACE(obj)                          \
-  (G_TYPE_INSTANCE_GET_INTERFACE((obj),                                 \
-                                 GARROW_TYPE_OUTPUT_STREAM,          \
-                                 GArrowOutputStreamInterface))
+#define GARROW_IS_OUTPUT_STREAM_CLASS(klass)            \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),                     \
+                           GARROW_TYPE_OUTPUT_STREAM))
+#define GARROW_OUTPUT_STREAM_GET_CLASS(obj)             \
+  (G_TYPE_INSTANCE_GET_CLASS((obj),                     \
+                             GARROW_TYPE_OUTPUT_STREAM, \
+                             GArrowOutputStreamClass))
 
 typedef struct _GArrowOutputStream          GArrowOutputStream;
-typedef struct _GArrowOutputStreamInterface GArrowOutputStreamInterface;
+#ifndef __GTK_DOC_IGNORE__
+typedef struct _GArrowOutputStreamClass     GArrowOutputStreamClass;
+#endif
+
+/**
+ * GArrowOutputStream:
+ *
+ * It wraps `arrow::io::OutputStream`.
+ */
+struct _GArrowOutputStream
+{
+  /*< private >*/
+  GObject parent_instance;
+};
+
+#ifndef __GTK_DOC_IGNORE__
+struct _GArrowOutputStreamClass
+{
+  GObjectClass parent_class;
+};
+#endif
 
 GType garrow_output_stream_get_type(void) G_GNUC_CONST;
 
@@ -77,13 +106,13 @@ typedef struct _GArrowFileOutputStreamClass    GArrowFileOutputStreamClass;
 struct _GArrowFileOutputStream
 {
   /*< private >*/
-  GObject parent_instance;
+  GArrowOutputStream parent_instance;
 };
 
 #ifndef __GTK_DOC_IGNORE__
 struct _GArrowFileOutputStreamClass
 {
-  GObjectClass parent_class;
+  GArrowOutputStreamClass parent_class;
 };
 #endif
 
@@ -94,4 +123,52 @@ GArrowFileOutputStream *garrow_file_output_stream_open(const gchar *path,
                                                        GError **error);
 
 
+#define GARROW_TYPE_BUFFER_OUTPUT_STREAM        \
+  (garrow_buffer_output_stream_get_type())
+#define GARROW_BUFFER_OUTPUT_STREAM(obj)                        \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),                            \
+                              GARROW_TYPE_BUFFER_OUTPUT_STREAM, \
+                              GArrowBufferOutputStream))
+#define GARROW_BUFFER_OUTPUT_STREAM_CLASS(klass)                \
+  (G_TYPE_CHECK_CLASS_CAST((klass),                             \
+                           GARROW_TYPE_BUFFER_OUTPUT_STREAM,    \
+                           GArrowBufferOutputStreamClass))
+#define GARROW_IS_BUFFER_OUTPUT_STREAM(obj)                             \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),                                    \
+                              GARROW_TYPE_BUFFER_OUTPUT_STREAM))
+#define GARROW_IS_BUFFER_OUTPUT_STREAM_CLASS(klass)             \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),                             \
+                           GARROW_TYPE_BUFFER_OUTPUT_STREAM))
+#define GARROW_BUFFER_OUTPUT_STREAM_GET_CLASS(obj)              \
+  (G_TYPE_INSTANCE_GET_CLASS((obj),                             \
+                             GARROW_TYPE_BUFFER_OUTPUT_STREAM,  \
+                             GArrowBufferOutputStreamClass))
+
+typedef struct _GArrowBufferOutputStream         GArrowBufferOutputStream;
+#ifndef __GTK_DOC_IGNORE__
+typedef struct _GArrowBufferOutputStreamClass    GArrowBufferOutputStreamClass;
+#endif
+
+/**
+ * GArrowBufferOutputStream:
+ *
+ * It wraps `arrow::io::BufferOutputStream`.
+ */
+struct _GArrowBufferOutputStream
+{
+  /*< private >*/
+  GArrowOutputStream parent_instance;
+};
+
+#ifndef __GTK_DOC_IGNORE__
+struct _GArrowBufferOutputStreamClass
+{
+  GArrowOutputStreamClass parent_class;
+};
+#endif
+
+GType garrow_buffer_output_stream_get_type(void) G_GNUC_CONST;
+
+GArrowBufferOutputStream *garrow_buffer_output_stream_new(GArrowResizableBuffer *buffer);
+
 G_END_DECLS

http://git-wip-us.apache.org/repos/asf/arrow/blob/ed5a1d4f/c_glib/arrow-glib/output-stream.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/output-stream.hpp b/c_glib/arrow-glib/output-stream.hpp
index e8e7321..5d22f1d 100644
--- a/c_glib/arrow-glib/output-stream.hpp
+++ b/c_glib/arrow-glib/output-stream.hpp
@@ -20,22 +20,13 @@
 #pragma once
 
 #include <arrow/io/file.h>
+#include <arrow/io/memory.h>
 
 #include <arrow-glib/output-stream.h>
 
-/**
- * GArrowOutputStreamInterface:
- *
- * It wraps `arrow::io::OutputStream`.
- */
-struct _GArrowOutputStreamInterface
-{
-  GTypeInterface parent_iface;
-
-  std::shared_ptr<arrow::io::OutputStream> (*get_raw)(GArrowOutputStream *file);
-};
-
+GArrowOutputStream *garrow_output_stream_new_raw(std::shared_ptr<arrow::io::OutputStream> *arrow_output_stream);
 std::shared_ptr<arrow::io::OutputStream> garrow_output_stream_get_raw(GArrowOutputStream *output_stream);
 
+
 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);
+GArrowBufferOutputStream *garrow_buffer_output_stream_new_raw(std::shared_ptr<arrow::io::BufferOutputStream> *arrow_buffer_output_stream);

http://git-wip-us.apache.org/repos/asf/arrow/blob/ed5a1d4f/c_glib/test/test-buffer-output-file.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-buffer-output-file.rb b/c_glib/test/test-buffer-output-file.rb
new file mode 100644
index 0000000..1b7fae9
--- /dev/null
+++ b/c_glib/test/test-buffer-output-file.rb
@@ -0,0 +1,26 @@
+# 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.
+
+class TestBufferOutputStream < Test::Unit::TestCase
+  def test_new
+    buffer = Arrow::PoolBuffer.new
+    output_stream = Arrow::BufferOutputStream.new(buffer)
+    output_stream.write("Hello")
+    output_stream.close
+    assert_equal("Hello", buffer.data.to_s)
+  end
+end