diff options
Diffstat (limited to 'test/files/run/serialize-stream.scala')
-rw-r--r-- | test/files/run/serialize-stream.scala | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/files/run/serialize-stream.scala b/test/files/run/serialize-stream.scala new file mode 100644 index 0000000000..3ab9f2df34 --- /dev/null +++ b/test/files/run/serialize-stream.scala @@ -0,0 +1,20 @@ + + +object Test { + def ser[T](s: Stream[T]) { + val bos = new java.io.ByteArrayOutputStream() + val oos = new java.io.ObjectOutputStream(bos) + oos.writeObject(s) + + val ois = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(bos.toByteArray)) + val obj = ois.readObject() + println(obj) + println(obj.asInstanceOf[Seq[T]].toList) + } + + def main(args: Array[String]) { + ser(Stream(1, 2, 3)) + ser(Stream(1)) + ser(Stream()) + } +} |