Skip to content

Instantly share code, notes, and snippets.

@Maksim-Zhuravlev Maksim-Zhuravlev/Decoder.scala Secret
Created Apr 17, 2016

What would you like to do?
Example of scodec
package GIFReader
import scodec._
import bits._
import codecs._
import java.nio.file.{Files, Paths}
case class GIFHeader(width : Int, height : Int)
* Created by maxim on 17.04.2016.
class Decoder(path : String) {
val byteArray = Files.readAllBytes(Paths.get(path))
val bitVector = BitVector(byteArray)
val headerCodec = (constant(hex"474946383961".bits) :: uint16L :: uint16L).as[GIFHeader] //GIF89a
val decoded = headerCodec.decode(bitVector)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.