Rapture I/O is a fledgling library for Scala which provides a consistent, intuitive and extensible API for handling common I/O operations, such as sending HTTP requests and streaming data between files, URLs and sockets.
Rapture I/O offers the functionality of java.io, but unifies its features into simpler, more coherent and higher-level concepts, allowing tasks which once took several lines of code to be often accomplished in just one, taking full advantage of Scala's rich syntax.
> val url = Http / "rapture.io" / "welcome.txt"
> url > File / "home" / "download"
res: Int = 53 // bytes transferred
> implicit val enc = Encodings.`UTF-8`
> (Http / "rapture.io" / "welcome.txt").slurp[Char]
res: Int = "Congratulations! ..."
> val from = Http / "rapture.io" / "doc" / "package.html"
> from link Http / "rapture.io" / "home"
res: Link = ../home
> (Http / "rapture.io" / "welcome.txt").md5Sum()
res: String = 9C0CD5E22C4B1CF0FF4ECA7042CE3463
> val url = Http / "rapture.io" / "repeat"
> url.post(Map('say -> "Hi")).slurp[Char]
res: String = "You said Hi."
> val src = (Http / "rapture.io" / "json").slurp[Char]
res: Json = "Barack Obama"
> val dir = File / "home" / "work"
res: Date = Thu Nov 15 12:00:00 GMT 2012
> Base64.encode("Hello world!")
res: String = SGVsbG8gd29ybGQh
30th November 2013
Jon Pretty will be talking about Type Classes and how they are used in Rapture at the Scala eXchange in London on 2nd December.
7th September 2013
Rapture I/O 0.8.1 has been released with macro-based extraction of case classes from JSON
9th June 2013
Rapture I/O 0.8.0 has been released
8th April 2013
Jon Pretty will be giving a talk to the London Scala Users’ Group on Rapture I/O on 10th April.
6th March 2013
Jon Pretty will be talking about and demonstrating Rapture I/O at Scala Camp in Kraków on 20th March.
14th February 2013
Rapture I/O 0.7.2 has been released on Sonatype
21st November 2012
Video from Jon Pretty's Rapture I/O presentation at the Scala eXchange is now available!
16th November 2012
Rapture I/O version 0.7.0 has been released!
1th November 2012
Jon Pretty will be presenting Rapture I/O at the Scala eXchange 2012 in London on 19th & 20th November.
Rapture I/O is supplied as an OSGi-ready JAR file, and depends only on scala-library.jar.
Just include io.jar on your classpath,
import rapture.io._, and start using it!
We are working to make version 0.8.1 available on Sonatype, though this has been more difficult than expected. Your patience is appreciated. While you are waiting, you may like to play a game about the experience of publishing a Scala library to Sonatype.