summaryrefslogblamecommitdiff
path: root/test/files/run/serialize-stream.scala
blob: e424d5b629826b4128a079075a755b1978e5268e (plain) (tree)
1
2
3
4
5
6
7
8






                                                 
    




                                                                                              
  





                                 
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())
  }
}