de.sciss.serial.impl.OptionWriter.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of serial_3.0.0-RC2 Show documentation
Show all versions of serial_3.0.0-RC2 Show documentation
Simple binary serialization library for Scala
The newest version!
/*
* OptionWriter.scala
* (Serial)
*
* Copyright (c) 2011-2021 Hanns Holger Rutz. All rights reserved.
*
* This software is published under the GNU Lesser General Public License v2.1+
*
*
* For further information, please contact Hanns Holger Rutz at
* [email protected]
*/
package de.sciss.serial
package impl
final class OptionWriter[A](peer: Writer[A])
extends Writer[Option[A]] {
def write(opt: Option[A], out: DataOutput): Unit =
opt match {
case Some(v) => out.writeByte(1); peer.write(v, out)
case _ => out.writeByte(0)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy