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

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

Introduction

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

Prototype

@Override
    public void writeFieldStop() throws TException 

Source Link

Usage

From source file:com.facebook.nifty.core.TestThriftFrameDecoder.java

License:Apache License

private void writeTestMessages(TBinaryProtocol protocol, int count) throws TException {
    for (int i = 0; i < count; i++) {
        protocol.writeMessageBegin(new TMessage("testmessage" + i, TMessageType.CALL, i));
        {/*w w  w  .  j av  a 2s  . com*/
            protocol.writeStructBegin(new TStruct());
            {
                protocol.writeFieldBegin(new TField("i32field", TType.I32, (short) 1));
                protocol.writeI32(123);
                protocol.writeFieldEnd();
            }
            {
                protocol.writeFieldBegin(new TField("strfield", TType.STRING, (short) 2));
                protocol.writeString("foo");
                protocol.writeFieldEnd();
            }
            {
                protocol.writeFieldBegin(new TField("boolfield", TType.BOOL, (short) 3));
                protocol.writeBool(true);
                protocol.writeFieldEnd();
            }
            protocol.writeFieldStop();
            protocol.writeStructEnd();
        }
        protocol.writeMessageEnd();
        protocol.getTransport().flush();
    }
}

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 source file:zipkin.reporter.libthrift.InternalScribeCodec.java

License:Apache License

static void write(byte[] category, byte[] span, TBinaryProtocol oprot) throws TException {
    oprot.writeFieldBegin(CATEGORY_FIELD_DESC);
    oprot.writeI32(category.length);/*from   w  ww  .  j a v  a  2s  .  co  m*/
    oprot.getTransport().write(category, 0, category.length);

    oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
    byte[] base64 = base64(span);
    oprot.writeI32(base64.length);
    oprot.getTransport().write(base64, 0, base64.length);
    oprot.writeFieldStop();
}