Java 类org.apache.thrift.protocol.TStruct 实例源码

项目:EatDubbo    文件:ThriftNativeCodec.java   
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request request)
    throws IOException {
    Invocation invocation = (Invocation) request.getData();
    TProtocol protocol = newProtocol(channel.getUrl(), buffer);
    try {
        protocol.writeMessageBegin(new TMessage(
            invocation.getMethodName(), TMessageType.CALL, 
            thriftSeq.getAndIncrement()));
        protocol.writeStructBegin(new TStruct(invocation.getMethodName() + "_args"));
        for(int i = 0; i < invocation.getParameterTypes().length; i++) {
            Class<?> type = invocation.getParameterTypes()[i];

        }
    } catch (TException e) {
        throw new IOException(e.getMessage(), e);
    }

}
项目:dubbo2    文件:ThriftNativeCodec.java   
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request request)
    throws IOException {
    Invocation invocation = (Invocation) request.getData();
    TProtocol protocol = newProtocol(channel.getUrl(), buffer);
    try {
        protocol.writeMessageBegin(new TMessage(
            invocation.getMethodName(), TMessageType.CALL, 
            thriftSeq.getAndIncrement()));
        protocol.writeStructBegin(new TStruct(invocation.getMethodName() + "_args"));
        for(int i = 0; i < invocation.getParameterTypes().length; i++) {
            Class<?> type = invocation.getParameterTypes()[i];

        }
    } catch (TException e) {
        throw new IOException(e.getMessage(), e);
    }

}
项目:dubbox-hystrix    文件:ThriftNativeCodec.java   
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request request)
    throws IOException {
    Invocation invocation = (Invocation) request.getData();
    TProtocol protocol = newProtocol(channel.getUrl(), buffer);
    try {
        protocol.writeMessageBegin(new TMessage(
            invocation.getMethodName(), TMessageType.CALL, 
            thriftSeq.getAndIncrement()));
        protocol.writeStructBegin(new TStruct(invocation.getMethodName() + "_args"));
        for(int i = 0; i < invocation.getParameterTypes().length; i++) {
            Class<?> type = invocation.getParameterTypes()[i];

        }
    } catch (TException e) {
        throw new IOException(e.getMessage(), e);
    }

}
项目:dubbocloud    文件:ThriftNativeCodec.java   
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request request)
    throws IOException {
    Invocation invocation = (Invocation) request.getData();
    TProtocol protocol = newProtocol(channel.getUrl(), buffer);
    try {
        protocol.writeMessageBegin(new TMessage(
            invocation.getMethodName(), TMessageType.CALL, 
            thriftSeq.getAndIncrement()));
        protocol.writeStructBegin(new TStruct(invocation.getMethodName() + "_args"));
        for(int i = 0; i < invocation.getParameterTypes().length; i++) {
            Class<?> type = invocation.getParameterTypes()[i];

        }
    } catch (TException e) {
        throw new IOException(e.getMessage(), e);
    }

}
项目:dubbos    文件:ThriftNativeCodec.java   
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request request)
    throws IOException {
    Invocation invocation = (Invocation) request.getData();
    TProtocol protocol = newProtocol(channel.getUrl(), buffer);
    try {
        protocol.writeMessageBegin(new TMessage(
            invocation.getMethodName(), TMessageType.CALL, 
            thriftSeq.getAndIncrement()));
        protocol.writeStructBegin(new TStruct(invocation.getMethodName() + "_args"));
        for(int i = 0; i < invocation.getParameterTypes().length; i++) {
            Class<?> type = invocation.getParameterTypes()[i];

        }
    } catch (TException e) {
        throw new IOException(e.getMessage(), e);
    }

}
项目:dubbo-comments    文件:ThriftNativeCodec.java   
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request request)
    throws IOException {
    Invocation invocation = (Invocation) request.getData();
    TProtocol protocol = newProtocol(channel.getUrl(), buffer);
    try {
        protocol.writeMessageBegin(new TMessage(
            invocation.getMethodName(), TMessageType.CALL, 
            thriftSeq.getAndIncrement()));
        protocol.writeStructBegin(new TStruct(invocation.getMethodName() + "_args"));
        for(int i = 0; i < invocation.getParameterTypes().length; i++) {
            Class<?> type = invocation.getParameterTypes()[i];

        }
    } catch (TException e) {
        throw new IOException(e.getMessage(), e);
    }

}
项目:dubbox    文件:ThriftNativeCodec.java   
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request request)
    throws IOException {
    Invocation invocation = (Invocation) request.getData();
    TProtocol protocol = newProtocol(channel.getUrl(), buffer);
    try {
        protocol.writeMessageBegin(new TMessage(
            invocation.getMethodName(), TMessageType.CALL, 
            thriftSeq.getAndIncrement()));
        protocol.writeStructBegin(new TStruct(invocation.getMethodName() + "_args"));
        for(int i = 0; i < invocation.getParameterTypes().length; i++) {
            Class<?> type = invocation.getParameterTypes()[i];

        }
    } catch (TException e) {
        throw new IOException(e.getMessage(), e);
    }

}
项目:dubbo    文件:ThriftNativeCodec.java   
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request request)
    throws IOException {
    Invocation invocation = (Invocation) request.getData();
    TProtocol protocol = newProtocol(channel.getUrl(), buffer);
    try {
        protocol.writeMessageBegin(new TMessage(
            invocation.getMethodName(), TMessageType.CALL, 
            thriftSeq.getAndIncrement()));
        protocol.writeStructBegin(new TStruct(invocation.getMethodName() + "_args"));
        for(int i = 0; i < invocation.getParameterTypes().length; i++) {
            Class<?> type = invocation.getParameterTypes()[i];

        }
    } catch (TException e) {
        throw new IOException(e.getMessage(), e);
    }

}
项目:dubbo-learning    文件:ThriftNativeCodec.java   
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request request)
    throws IOException {
    Invocation invocation = (Invocation) request.getData();
    TProtocol protocol = newProtocol(channel.getUrl(), buffer);
    try {
        protocol.writeMessageBegin(new TMessage(
            invocation.getMethodName(), TMessageType.CALL, 
            thriftSeq.getAndIncrement()));
        protocol.writeStructBegin(new TStruct(invocation.getMethodName() + "_args"));
        for(int i = 0; i < invocation.getParameterTypes().length; i++) {
            Class<?> type = invocation.getParameterTypes()[i];

        }
    } catch (TException e) {
        throw new IOException(e.getMessage(), e);
    }

}
项目:DubboCode    文件:ThriftNativeCodec.java   
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request request)
    throws IOException {
    Invocation invocation = (Invocation) request.getData();
    TProtocol protocol = newProtocol(channel.getUrl(), buffer);
    try {
        protocol.writeMessageBegin(new TMessage(
            invocation.getMethodName(), TMessageType.CALL, 
            thriftSeq.getAndIncrement()));
        protocol.writeStructBegin(new TStruct(invocation.getMethodName() + "_args"));
        for(int i = 0; i < invocation.getParameterTypes().length; i++) {
            Class<?> type = invocation.getParameterTypes()[i];

        }
    } catch (TException e) {
        throw new IOException(e.getMessage(), e);
    }

}
项目:dubbo2study    文件:ThriftNativeCodec.java   
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request request)
    throws IOException {
    Invocation invocation = (Invocation) request.getData();
    TProtocol protocol = newProtocol(channel.getUrl(), buffer);
    try {
        protocol.writeMessageBegin(new TMessage(
            invocation.getMethodName(), TMessageType.CALL, 
            thriftSeq.getAndIncrement()));
        protocol.writeStructBegin(new TStruct(invocation.getMethodName() + "_args"));
        for(int i = 0; i < invocation.getParameterTypes().length; i++) {
            Class<?> type = invocation.getParameterTypes()[i];

        }
    } catch (TException e) {
        throw new IOException(e.getMessage(), e);
    }

}
项目:dubbo-comments    文件:ThriftNativeCodec.java   
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request request)
    throws IOException {
    Invocation invocation = (Invocation) request.getData();
    TProtocol protocol = newProtocol(channel.getUrl(), buffer);
    try {
        protocol.writeMessageBegin(new TMessage(
            invocation.getMethodName(), TMessageType.CALL, 
            thriftSeq.getAndIncrement()));
        protocol.writeStructBegin(new TStruct(invocation.getMethodName() + "_args"));
        for(int i = 0; i < invocation.getParameterTypes().length; i++) {
            Class<?> type = invocation.getParameterTypes()[i];

        }
    } catch (TException e) {
        throw new IOException(e.getMessage(), e);
    }

}
项目:providence    文件:TProtocolSerializer.java   
private void writeMessage(PMessage<?,?> message, TProtocol protocol) throws TException, SerializerException {
    PMessageDescriptor<?, ?> type = message.descriptor();

    protocol.writeStructBegin(new TStruct(message.descriptor()
                                                 .getQualifiedName()));

    for (PField field : type.getFields()) {
        if (!message.has(field.getId())) {
            continue;
        }

        protocol.writeFieldBegin(new TField(field.getName(),
                                            forType(field.getDescriptor().getType()),
                                            (short) field.getId()));

        writeTypedValue(message.get(field.getId()), field.getDescriptor(), protocol);

        protocol.writeFieldEnd();
    }

    protocol.writeFieldStop();
    protocol.writeStructEnd();
}
项目:dubbo-ex    文件:ThriftNativeCodec.java   
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request request)
    throws IOException {
    Invocation invocation = (Invocation) request.getData();
    TProtocol protocol = newProtocol(channel.getUrl(), buffer);
    try {
        protocol.writeMessageBegin(new TMessage(
            invocation.getMethodName(), TMessageType.CALL, 
            thriftSeq.getAndIncrement()));
        protocol.writeStructBegin(new TStruct(invocation.getMethodName() + "_args"));
        for(int i = 0; i < invocation.getParameterTypes().length; i++) {
            Class<?> type = invocation.getParameterTypes()[i];

        }
    } catch (TException e) {
        throw new IOException(e.getMessage(), e);
    }

}
项目:LetUsGo-Server    文件:ThriftNativeCodec.java   
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request request)
    throws IOException {
    Invocation invocation = (Invocation) request.getData();
    TProtocol protocol = newProtocol(channel.getUrl(), buffer);
    try {
        protocol.writeMessageBegin(new TMessage(
            invocation.getMethodName(), TMessageType.CALL, 
            thriftSeq.getAndIncrement()));
        protocol.writeStructBegin(new TStruct(invocation.getMethodName() + "_args"));
        for(int i = 0; i < invocation.getParameterTypes().length; i++) {
            Class<?> type = invocation.getParameterTypes()[i];

        }
    } catch (TException e) {
        throw new IOException(e.getMessage(), e);
    }

}
项目:exDubbo    文件:ThriftNativeCodec.java   
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request request)
    throws IOException {
    Invocation invocation = (Invocation) request.getData();
    TProtocol protocol = newProtocol(channel.getUrl(), buffer);
    try {
        protocol.writeMessageBegin(new TMessage(
            invocation.getMethodName(), TMessageType.CALL, 
            thriftSeq.getAndIncrement()));
        protocol.writeStructBegin(new TStruct(invocation.getMethodName() + "_args"));
        for(int i = 0; i < invocation.getParameterTypes().length; i++) {
            Class<?> type = invocation.getParameterTypes()[i];

        }
    } catch (TException e) {
        throw new IOException(e.getMessage(), e);
    }

}
项目:dangdangdotcom    文件:ThriftNativeCodec.java   
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request request)
    throws IOException {
    Invocation invocation = (Invocation) request.getData();
    TProtocol protocol = newProtocol(channel.getUrl(), buffer);
    try {
        protocol.writeMessageBegin(new TMessage(
            invocation.getMethodName(), TMessageType.CALL, 
            thriftSeq.getAndIncrement()));
        protocol.writeStructBegin(new TStruct(invocation.getMethodName() + "_args"));
        for(int i = 0; i < invocation.getParameterTypes().length; i++) {
            Class<?> type = invocation.getParameterTypes()[i];

        }
    } catch (TException e) {
        throw new IOException(e.getMessage(), e);
    }

}
项目:dubbo2.js    文件:ThriftNativeCodec.java   
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request request)
        throws IOException {
    Invocation invocation = (Invocation) request.getData();
    TProtocol protocol = newProtocol(channel.getUrl(), buffer);
    try {
        protocol.writeMessageBegin(new TMessage(
                invocation.getMethodName(), TMessageType.CALL,
                thriftSeq.getAndIncrement()));
        protocol.writeStructBegin(new TStruct(invocation.getMethodName() + "_args"));
        for (int i = 0; i < invocation.getParameterTypes().length; i++) {
            Class<?> type = invocation.getParameterTypes()[i];

        }
    } catch (TException e) {
        throw new IOException(e.getMessage(), e);
    }

}
项目:CadalWorkspace    文件:TApplicationException.java   
public void write(TProtocol oprot) throws TException {
  TStruct struct = new TStruct("TApplicationException");
  TField field = new TField();
  oprot.writeStructBegin(struct);
  if (getMessage() != null) {
    field.name = "message";
    field.type = TType.STRING;
    field.id = 1;
    oprot.writeFieldBegin(field);
    oprot.writeString(getMessage());
    oprot.writeFieldEnd();
  }
  field.name = "type";
  field.type = TType.I32;
  field.id = 2;
  oprot.writeFieldBegin(field);
  oprot.writeI32(type_);
  oprot.writeFieldEnd();
  oprot.writeFieldStop();
  oprot.writeStructEnd();

}
项目:nettythrift    文件:TSimpleJSONProtocol.java   
public TStruct readStructBegin() {
    BaseArray prevStruct = structStack.peek();
    if (prevStruct != null) {
        BaseArray e = prevStruct.getArray();
        structStack.push(e);
    } else {
        structStack.push(msgStruct);
    }
    return ANONYMOUS_STRUCT;
}
项目:human_readable_json_protocol    文件:HumanReadableJsonProtocol.java   
@Override
public TStruct readStructBegin() throws TException {
    if (err != null) {
        throw err;
    }
    return new TStruct();
}
项目:diqube    文件:TicketUtil.java   
@Override
public TStruct readStructBegin() throws TException {
  if (structLevel == 1) {
    if (topLevelStructToBeRecorded == topLevelStruct)
      rememberingTransport.startRemeberingReadBytes();
  }
  structLevel++;
  return super.readStructBegin();
}
项目:ThriftBook    文件:CompFileWrite.java   
public static void main(String[] args) throws TException {
    TTransport trans = new TSimpleFileTransport("data.comp", false, true);
    TProtocol proto = new TCompactProtocol(trans);          

    Trade trade = new Trade();
    trade.symbol = "F";
    trade.price = 13.10;
    trade.size = 2500;

    proto.writeStructBegin(new TStruct());

    proto.writeFieldBegin(new TField("symbol", 
                                     TType.STRING, 
                                     (short) 1));
    proto.writeString(trade.symbol);
    proto.writeFieldEnd();

    proto.writeFieldBegin(new TField("price", 
                                     TType.DOUBLE, 
                                     (short) 2));
    proto.writeDouble(trade.price);
    proto.writeFieldEnd();

    proto.writeFieldBegin(new TField("size", 
                                     TType.I32, 
                                     (short) 3));
    proto.writeI32(trade.size);
    proto.writeFieldEnd();

    proto.writeFieldStop();
    proto.writeStructEnd();

    System.out.println("Wrote trade to file");
}
项目:ThriftBook    文件:BinFileRead.java   
public static void main(String[] args) throws TException {
    TTransport trans = new TSimpleFileTransport("data", true, false);
    TProtocol proto = new TBinaryProtocol(trans);       

    Trade trade_read = new Trade();
    TField field = new TField();

    TStruct struct_obj = proto.readStructBegin();       
    while(true) {                       
        field = proto.readFieldBegin();         
        if (field.id == TType.STOP) {               
            break;
        }
        switch(field.id) {                  
        case 1:
            trade_read.symbol = proto.readString(); 
            break;
        case 2:
            trade_read.price = proto.readDouble();
            break;
        case 3:
            trade_read.size = proto.readI32();
            break;
        default:
            TProtocolUtil.skip(proto,field.type);   
            break;
        }
        proto.readFieldEnd();               
    }
    proto.readStructEnd();              

    System.out.println("Trade: " + trade_read.symbol + " " +
                       trade_read.size + " @ " + trade_read.price);
}
项目:parquet-mr    文件:ThriftRecordConverter.java   
private StructConverter(List<TProtocol> events, GroupType parquetSchema, ThriftField field) {
  this.events = events;
  this.name = field.getName();
  this.tStruct = new TStruct(name);
  this.thriftType = (StructType)field.getType();
  this.schemaSize = parquetSchema.getFieldCount();
  this.converters = new Converter[this.schemaSize];
  List<ThriftField> thriftChildren = thriftType.getChildren();
  for (int i = 0; i < schemaSize; i++) {
    Type schemaType = parquetSchema.getType(i);
    String fieldName = schemaType.getName();
    ThriftField matchingThrift = null;
    for (ThriftField childField: thriftChildren) {
      String thriftChildName = childField.getName();
      if (thriftChildName != null && thriftChildName.equalsIgnoreCase(fieldName)) {
        matchingThrift = childField;
        break;
      }
    }
    if (matchingThrift == null) {
        // this means the file did not contain that field
      // it will never be populated in this instance
      // other files might populate it
        continue;
    }
    if (schemaType.isPrimitive()) {
        converters[i] = new PrimitiveFieldHandler(newConverter(events, schemaType, matchingThrift).asPrimitiveConverter(), matchingThrift, events);
    } else {
        converters[i] = new GroupFieldhandler(newConverter(events, schemaType, matchingThrift).asGroupConverter(), matchingThrift, events);
    }
  }
}
项目:parquet-mr    文件:ProtocolReadToWrite.java   
private void readOneStruct(TProtocol in, TProtocol out) throws TException {
  final TStruct struct = in.readStructBegin();
  out.writeStructBegin(struct);
  TField field;
  while ((field = in.readFieldBegin()).type != TType.STOP) {
    out.writeFieldBegin(field);
    readOneValue(in, out, field.type);
    in.readFieldEnd();
    out.writeFieldEnd();
  }
  out.writeFieldStop();
  in.readStructEnd();
  out.writeStructEnd();
}
项目:ThriftMongoBridge    文件:TBSONProtocol.java   
public TStruct readStructBegin() throws TException {
    try {
        DBObject dbObject = null;
        Object thriftObject = null;

        if(!isContextEmpty()) {
            Context currentContext = peekContext();

            if (currentContext instanceof ListContext) {
                dbObject = (DBObject) ((ListContext) currentContext).next();
                thriftObject = ((ListContext) peekContext()).thriftObject;
            } else if (currentContext instanceof MapContext) {
                dbObject = (DBObject) ((MapContext) currentContext).next();
                thriftObject = ((MapContext) peekContext()).thriftObject;
            } else {
                return ANONYMOUS_STRUCT;
            }
        } else {
            thriftObject = threadSafeTBase.get();
            dbObject = getDBObject();
        }
     StructContext context = new StructContext(thriftObject.getClass().getSimpleName());
        context.setDbObject(dbObject);
        context.thriftObject = thriftObject;
        pushContext(context);

        return ANONYMOUS_STRUCT;
    } catch (Exception exp) {
     throw new TException("Unexpected readStructBegin", exp);
    }
}
项目:nettythrift    文件:TSimpleJSONProtocol.java   
public void writeStructBegin(TStruct struct) throws TException {
    writeContext_.write();
    trans_.write(LBRACE);
    pushWriteContext(new StructContext());
}
项目:ikasoa    文件:ArgsThriftBase.java   
@Override
protected TStruct getTStruct() {
    return STRUCT_DESC;
}
项目:ikasoa    文件:ResultThriftBase.java   
@Override
protected TStruct getTStruct() {
    return STRUCT_DESC;
}
项目:human_readable_json_protocol    文件:HumanReadableJsonProtocol.java   
@Override
public void writeStructBegin(TStruct tStruct) throws TException {
    oprot.writeStructBegin(tStruct);
}
项目:human_readable_json_protocol    文件:TSimpleJSONProtocol.java   
public void writeStructBegin(TStruct struct) throws TException {
    this.writeContext_.write();
    this.trans_.write(LBRACE);
    this.pushWriteContext(new TSimpleJSONProtocol.StructContext());
}
项目:human_readable_json_protocol    文件:TSimpleJSONProtocol.java   
public TStruct readStructBegin() {
    return ANONYMOUS_STRUCT;
}
项目:armeria    文件:TTextProtocol.java   
@Override
public void writeStructBegin(TStruct struct) throws TException {
    writeJsonObjectBegin(new StructContext(null));
}
项目:apm-agent    文件:TReplaceListProtocol.java   
@Override
public void writeStructBegin(TStruct struct) throws TException {
    if (!writeFieldBegin) {
        protocol.writeStructBegin(struct);
    }
}
项目:apm-agent    文件:TReplaceListProtocol.java   
@Override
public TStruct readStructBegin() throws TException {
    throw new TException("unsupported operation");
}
项目:parquet-format    文件:InterningProtocol.java   
public void writeStructBegin(TStruct struct) throws TException {
  delegate.writeStructBegin(struct);
}
项目:parquet-format    文件:InterningProtocol.java   
public TStruct readStructBegin() throws TException {
  return delegate.readStructBegin();
}
项目:parquet-mr    文件:DefaultEventsVisitor.java   
@Override
public TStruct readStructBegin() throws TException {
  return new TStruct(structName);
}
项目:parquet-mr    文件:ThriftRecordConverter.java   
@Override
public TStruct readStructBegin() throws TException {
  return tStruct;
}