diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-07-11 15:17:34 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-07-11 15:17:34 +0000 |
commit | 8110e02ec28c2a5e79a6740869700e7f059f41fa (patch) | |
tree | cf61a1ea7551bb7af2f6a8a75d5b1ecf1132c13c /test/files/run | |
parent | 74db0a59ad28f49bcf98ef839359697b680289cf (diff) | |
download | scala-8110e02ec28c2a5e79a6740869700e7f059f41fa.tar.gz scala-8110e02ec28c2a5e79a6740869700e7f059f41fa.tar.bz2 scala-8110e02ec28c2a5e79a6740869700e7f059f41fa.zip |
Making empty streams serializable.
No review.
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/serialize-stream.check | 6 | ||||
-rw-r--r-- | test/files/run/serialize-stream.scala | 20 |
2 files changed, 26 insertions, 0 deletions
diff --git a/test/files/run/serialize-stream.check b/test/files/run/serialize-stream.check new file mode 100644 index 0000000000..e2a9f57aa7 --- /dev/null +++ b/test/files/run/serialize-stream.check @@ -0,0 +1,6 @@ +Stream(1, ?) +List(1, 2, 3) +Stream(1, ?) +List(1) +Stream() +List() 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()) + } +} |