def deserialize[T <: ThriftStruct : ThriftStructCodec]()

in src/main/scala/com/gu/thrift/serializer/ThriftDeserializer.scala [15:29]


  def deserialize[T <: ThriftStruct : ThriftStructCodec](buffer: ByteBuffer, noHeader: Boolean): Try[T] = Try {
    //ensure that we get reliable behaviour if this method is called more than once (as it is by the convenience methods without `noheader`
    buffer.rewind()
    if(!noHeader) {
      val settings = buffer.get() //also increments buffer position by 1, so buffer.slice() below returns the "tail"
      val compressionType = compression(settings)
      compressionType match {
        case NoneType => payload(buffer.slice())
        case GzipType => payload(GzipCompression.uncompress(buffer.slice()))
        case ZstdType => payload(ZstdCompression.uncompress(buffer.slice()))
      }
    } else {
      payload(buffer)
    }
  }