Index: tests/test_gio.py
===================================================================
--- tests/test_gio.py	(revision 941)
+++ tests/test_gio.py	(working copy)
@@ -545,6 +545,20 @@
         loop.run()
 
 
+class TestMemoryInputStream(unittest.TestCase):
+    def setUp(self):
+        self.stream = gio.MemoryInputStream()
+
+    def test_add_data(self):
+        self.stream.add_data('foobar')
+        self.assertEquals('foobar', self.stream.read())
+
+        self.stream.add_data('ham ')
+        self.stream.add_data(None)
+        self.stream.add_data('spam')
+        self.assertEquals('ham spam', self.stream.read())
+
+
 class TestOutputStream(unittest.TestCase):
     def setUp(self):
         self._f = open("outputstream.txt", "w")
@@ -614,6 +628,18 @@
         loop.run()
 
 
+class TestMemoryOutputStream(unittest.TestCase):
+    def setUp(self):
+        self.stream = gio.MemoryOutputStream()
+
+    def test_get_contents(self):
+        self.stream.write('foobar')
+        self.assertEquals('foobar', self.stream.get_contents())
+
+        self.stream.write('baz')
+        self.assertEquals('foobarbaz', self.stream.get_contents())
+
+
 class TestVolumeMonitor(unittest.TestCase):
     def setUp(self):
         self.monitor = gio.volume_monitor_get()
Index: gio/gio.defs
===================================================================
--- gio/gio.defs	(revision 939)
+++ gio/gio.defs	(working copy)
@@ -3667,7 +3667,8 @@
   )
 )
 
-(define-method get_data
+;; Note: name clash with gobject.GObject.get_data; renamed.
+(define-method get_contents
   (of-object "GMemoryOutputStream")
   (c-name "g_memory_output_stream_get_data")
   (return-type "gpointer")
Index: gio/ginputstream.override
===================================================================
--- gio/ginputstream.override	(revision 939)
+++ gio/ginputstream.override	(working copy)
@@ -285,5 +285,39 @@
   Py_INCREF(Py_None);
   return Py_None;
 }
+%%
+override g_memory_input_stream_add_data kwargs
+static PyObject *
+_wrap_g_memory_input_stream_add_data(PyGObject *self,
+				     PyObject *args,
+				     PyObject *kwargs)
+{
+    static char *kwlist[] = { "data", NULL };
+    PyObject *data;
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:gio.MemoryInputStream.add_data",
+				     kwlist, &data))
+	return NULL;
+
+    if (data != Py_None) {
+	char *copy;
+	int length;
+
+	if (!PyString_Check(data)) {
+	    PyErr_SetString(PyExc_TypeError, "data must be a string or None");
+	    return NULL;
+	}
+
+	length = PyString_Size(data);
+	copy = g_malloc(length);
+	memcpy(copy, PyString_AsString(data), length);
+
+	g_memory_input_stream_add_data(G_MEMORY_INPUT_STREAM(self->obj),
+				       copy, length, (GDestroyNotify) g_free);
+    }
+  
+    Py_INCREF(Py_None);
+    return Py_None;
+}
 /* GInputStream.read_all: No ArgType for void* */
 /* GInputStream.skip_async: No ArgType for GAsyncReadyCallback */
Index: gio/goutputstream.override
===================================================================
--- gio/goutputstream.override	(revision 939)
+++ gio/goutputstream.override	(working copy)
@@ -156,6 +156,31 @@
   Py_INCREF(Py_None);
   return Py_None;
 }
+%%
+override g_memory_output_stream_new noargs
+static int
+_wrap_g_memory_output_stream_new(PyGObject *self)
+{
+    self->obj = (GObject *)g_memory_output_stream_new(NULL, 0, g_realloc, g_free);
+
+    if (!self->obj) {
+        PyErr_SetString(PyExc_RuntimeError, "could not create gio.MemoryOutputStream object");
+        return -1;
+    }
+
+    pygobject_register_wrapper((PyObject *)self);
+    return 0;
+}
+%%
+override g_memory_output_stream_get_data noargs
+static PyObject *
+_wrap_g_memory_output_stream_get_data(PyGObject *self)
+{
+    GMemoryOutputStream *stream = G_MEMORY_OUTPUT_STREAM(self->obj);
+    return PyString_FromStringAndSize(g_memory_output_stream_get_data(stream),
+				      g_seekable_tell(G_SEEKABLE(stream)));
+}
+
 /* GOutputStream.write_all: No ArgType for const-void* */
 /* GOutputStream.splice_async: No ArgType for GAsyncReadyCallback */
 /* GOutputStream.flush_async: No ArgType for GAsyncReadyCallback */
