Writing With Typeclasses
Details on how output is converted to bytes and how the design can be extended and used
The Common Cases
The write method of Output and Seekable objects accepts several types of inputs with no effort required on the part of a developer. Several of the default types including integers, longs, doubles, etc... are have converter implementations.
import scalax.io._
import Resource._
val out = fromFileString("out")
// Selected Converter is OutputConverter.IntConverter
out.write(3)
// Selected Converter is OutputConverter.LongConverter
out.write(3L)
// Selected Converter is OutputConverter.ByteConverter
out.write(3.toByte)
// Selected Converter is OutputConverter.DoubleConverter
out.write(3.0)
// Selected Converter is OutputConverter.IntConverter
out.write(List[Byte](3))
// Selected Converter is OutputConverter.LongConverter
out.write(3L)
// Selected Converter is OutputConverter.ByteConverter
out.write(3.toByte)
// Selected Converter is OutputConverter.DoubleConverter
out.write(3.0)
// Selected Converter is OutputConverter.TraversableIntConverter
out.write(List(1,2,3,4))