com.gu.contentapi.client.thrift.ThriftDeserializer.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of content-api-client_2.12 Show documentation
Show all versions of content-api-client_2.12 Show documentation
Scala client for the Guardian's Content API
The newest version!
package com.gu.contentapi.client.thrift
import java.io.ByteArrayInputStream
import com.twitter.scrooge.{ThriftStruct, ThriftStructCodec}
import org.apache.thrift.protocol.TCompactProtocol
import org.apache.thrift.transport.TIOStreamTransport
object ThriftDeserializer {
def deserialize[T <: ThriftStruct](responseBody: Array[Byte], codec: ThriftStructCodec[T]): T = {
val bbis = new ByteArrayInputStream(responseBody)
val transport = new TIOStreamTransport(bbis)
val protocol = new TCompactProtocol(transport)
codec.decode(protocol)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy