Example usage for org.apache.thrift.protocol TBinaryProtocol writeListEnd

List of usage examples for org.apache.thrift.protocol TBinaryProtocol writeListEnd

Introduction

In this page you can find the example usage for org.apache.thrift.protocol TBinaryProtocol writeListEnd.

Prototype

@Override
    public void writeListEnd() throws TException 

Source Link

Usage

From source file:zipkin.interop.AsyncToScalaSpanStoreAdapter.java

License:Apache License

@Nullable
static java.util.List<zipkin.Span> invert(Seq<Span> input) {
    try {/* www .  jav  a  2s  .c o m*/
        TMemoryBuffer transport = new TMemoryBuffer(0);
        TBinaryProtocol oproto = new TBinaryProtocol(transport);
        oproto.writeListBegin(new TList(TType.STRUCT, input.size()));
        Iterator<Span> iterator = input.iterator();
        while (iterator.hasNext()) {
            com.twitter.zipkin.thriftscala.Span thriftSpan = thrift$.MODULE$.spanToThriftSpan(iterator.next())
                    .toThrift();
            thriftSpan.write(oproto);
        }
        oproto.writeListEnd();
        byte[] bytes = transport.getArray();
        return Codec.THRIFT.readSpans(bytes);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}