简体   繁体   English

Scala:如何将protobuf ByteString对象转换为字节?

[英]Scala: How to convert a protobuf ByteString object to bytes?

I have function that returns a ByteString object: 我有返回ByteString对象的函数:

private def getEvent(value: DataOutputValue): com.google.protobuf.ByteString = {
  value.getRecordedEvent.getEvent.getEvent
}

How do I get just the bytes from this in Scala? 如何在Scala中仅从中获取字节?

调用toByteArray

val bytes = getEvent(someDateOutput).toByteArray

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM