Created
December 15, 2011 08:20
-
-
Save vetler/1480346 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.util.Marshal | |
import scala.io.Source | |
import scala.collection.immutable | |
import java.io._ | |
object Example { | |
class Foo(m: String) extends scala.Serializable { | |
val message = m | |
} | |
def main(args: Array[String]) { | |
val foo = new Foo("qweqwe") | |
val out = new FileOutputStream("out") | |
out.write(Marshal.dump(foo)) | |
out.close | |
val in = new FileInputStream("out") | |
val bytes = Stream.continually(in.read).takeWhile(-1 !=).map(_.toByte).toArray | |
val bar: Foo = Marshal.load[Foo](bytes) | |
println(bar.message) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ah: https://github.com/scala/pickling