Skip to content

Instantly share code, notes, and snippets.

@imownbey
Created April 1, 2011 21:58
Show Gist options
  • Save imownbey/898940 to your computer and use it in GitHub Desktop.
Save imownbey/898940 to your computer and use it in GitHub Desktop.
def apply(iprot: TProtocol) = {
var field: TField = null
var message: String = null
var another: Int = 0
while(true) {
field = iprot.readFieldBegin
if(field.`type` == TType.STOP) {
break
}
field.id match {
case 1 => {
field.`type` match {
case TType.STRING => message = iprot.readString
case _ => TProtocolUtil.skip(iprot, field.`type`)
}
break
}
case 2 => {
field.`type` match {
case TType.I32 => another = iprot.readI32()
case _ => TProtocolUtil.skip(iprot, field.`type`)
}
}
case _ => TProtocolUtil.skip(iprot, field.`type`)
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
new Bonk(message, author)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment