List of usage examples for org.apache.thrift.protocol TBinaryProtocol writeListBegin
@Override
public void writeListBegin(TList list) throws TException
From source file:zipkin.interop.AsyncToScalaSpanStoreAdapter.java
License:Apache License
@Nullable static java.util.List<zipkin.Span> invert(Seq<Span> input) { try {/*from w ww.ja va 2s .co 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; } }
From source file:zipkin.reporter.libthrift.InternalScribeCodec.java
License:Apache License
public static void writeLogRequest(byte[] category, List<byte[]> encodedSpans, int seqid, TBinaryProtocol oprot) throws TException { oprot.writeMessageBegin(new TMessage("Log", TMessageType.CALL, seqid)); oprot.writeFieldBegin(MESSAGES_FIELD_DESC); oprot.writeListBegin(new TList(TType.STRUCT, encodedSpans.size())); for (byte[] encodedSpan : encodedSpans) write(category, encodedSpan, oprot); oprot.writeFieldStop();/*from ww w . j av a 2 s . c om*/ }