• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.thrift.protocol.TList的典型用法代码示例。如果您正苦于以下问题:Java TList类的具体用法?Java TList怎么用?Java TList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TList类属于org.apache.thrift.protocol包,在下文中一共展示了TList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: listOf

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
/**
 * To consume a list of elements
 * @param c the type of the list content
 * @param consumer the consumer that will receive the list
 * @return a ListConsumer that can be passed to the DelegatingFieldConsumer
 */
public static <T extends TBase<T,? extends TFieldIdEnum>> ListConsumer listOf(Class<T> c, final Consumer<List<T>> consumer) {
  class ListConsumer implements Consumer<T> {
    List<T> list;
    @Override
    public void consume(T t) {
      list.add(t);
    }
  }
  final ListConsumer co = new ListConsumer();
  return new DelegatingListElementsConsumer(struct(c, co)) {
    @Override
    public void consumeList(TProtocol protocol,
        EventBasedThriftReader reader, TList tList) throws TException {
      co.list = new ArrayList<T>();
      super.consumeList(protocol, reader, tList);
      consumer.consume(co.list);
    }
  };
}
 
开发者ID:apache,项目名称:parquet-format,代码行数:26,代码来源:Consumers.java


示例2: visit

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
@Override
public Void visit(final ThriftType.ListType listType, Void v) {
  dummyEvents.add(new ParquetProtocol("readListBegin()") {
    @Override
    public TList readListBegin() throws TException {
      return new TList();
    }
  });

  dummyEvents.add(new ParquetProtocol("readListEnd()") {
    @Override
    public void readListEnd() throws TException {
    }
  });

  return null;
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:18,代码来源:DefaultEventsVisitor.java


示例3: readOneList

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
private boolean readOneList(TProtocol in, List<Action> buffer, ListType expectedType) throws TException {
  final TList list = in.readListBegin();
  buffer.add(new Action() {
    @Override
    public void write(TProtocol out) throws TException {
      out.writeListBegin(list);
    }

    @Override
    public String toDebugString() {
      return "<e=" + list.elemType + ", s=" + list.size + ">{";
    }
  });
  boolean hasFieldsIgnored = readCollectionElements(in, list.size, list.elemType, buffer, expectedType.getValues().getType());
  in.readListEnd();
  buffer.add(LIST_END);
  return hasFieldsIgnored;
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:19,代码来源:BufferedProtocolReadToWrite.java


示例4: writeListBegin

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
public void writeListBegin(TList list) throws TException {
	assertContextIsNotMapKey(LIST);
	writeContext_.write();
	trans_.write(LBRACKET);
	pushWriteContext(new ListContext());
	// No metadata!
}
 
开发者ID:houkx,项目名称:nettythrift,代码行数:8,代码来源:TSimpleJSONProtocol.java


示例5: readListBegin

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
public TList readListBegin() throws TException {
	BaseArray prevStruct = structStack.peek();
	BaseArray obj = prevStruct.getArray();
	structStack.push(obj);

	ListMetaData lm = (ListMetaData) obj.getMetaData();
	return new TList(lm.elemMetaData.type, obj.length());
}
 
开发者ID:houkx,项目名称:nettythrift,代码行数:9,代码来源:TSimpleJSONProtocol.java


示例6: write

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
@Override
public void write(List list, TProtocol protocol) throws TException {
    protocol.writeListBegin(new TList(valueTypeAdapter.getTType(), list.size()));
    for (Object o : list) {
        valueTypeAdapter.write(o, protocol);
    }
    protocol.writeListEnd();
}
 
开发者ID:meituan,项目名称:Firefly,代码行数:9,代码来源:ListTypeAdapterFactory.java


示例7: read

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
@Override
public List read(TProtocol protocol) throws TException {
    TList tlist = protocol.readListBegin();
    ArrayList arrayList = new ArrayList(tlist.size);
    for (int i = 0, n = tlist.size; i < n; i++) {
        arrayList.add(valueTypeAdapter.read(protocol));
    }
    protocol.readListEnd();
    return arrayList;
}
 
开发者ID:meituan,项目名称:Firefly,代码行数:11,代码来源:ListTypeAdapterFactory.java


示例8: writeListBegin

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
@Override
public void writeListBegin(TList list) throws TException {
    if (!writeFieldBegin) {
        protocol.writeListBegin(list);
        return;
    }

    if (writeListDepth == 0 && currentField != null) {
        List<ByteArrayOutput> outputs = replaceFields.get(currentField.name);
        if (outputs == null) {
            throw new TException("not found replace field - " + currentField.name);
        }

        final TList replaceList = new TList(list.elemType, outputs.size());
        protocol.writeListBegin(replaceList);
        for (ByteArrayOutput output : outputs) {
            try {
                final OutputStream out = ((ByteArrayOutputStreamTransport) getTransport()).getByteArrayOutputStream();
                output.writeTo(out);
            } catch (IOException e) {
                throw new TException(e);
            }
        }
    }

    writeListDepth++;
}
 
开发者ID:masonmei,项目名称:apm-agent,代码行数:28,代码来源:TReplaceListProtocol.java


示例9: readListContent

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
/**
 * reads the list content (elements) from the underlying protocol and passes the events to the list event consumer
 * @param eventConsumer the consumer
 * @param tList the list descriptor
 * @throws TException
 */
public void readListContent(ListConsumer eventConsumer, TList tList)
    throws TException {
  for (int i = 0; i < tList.size; i++) {
    eventConsumer.consumeElement(protocol, this, tList.elemType);
  }
}
 
开发者ID:apache,项目名称:parquet-format,代码行数:13,代码来源:EventBasedThriftReader.java


示例10: collectionStart

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
@Override
void collectionStart(final int count, final byte type) {
  parentEvents.add(new ParquetProtocol("readListBegin()") {
    @Override
    public TList readListBegin() throws TException {
      return new TList(type, count);
    }
  });
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:10,代码来源:ThriftRecordConverter.java


示例11: readOneList

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
private void readOneList(TProtocol in, TProtocol out) throws TException {
  final TList list = in.readListBegin();
  out.writeListBegin(list);
  readCollectionElements(in, out, list.size, list.elemType);
  in.readListEnd();
  out.writeListEnd();
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:8,代码来源:ProtocolReadToWrite.java


示例12: readListBegin

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
public TList readListBegin() throws TException {
	StructContext context = (StructContext) peekContext();
	if(context.fieldsStack.isEmpty()) {
     return EMPTY_LIST;
   }
   String fieldName = context.fieldsStack.peek();

   ListContext listContext = new ListContext();
   BasicDBList dbList = (BasicDBList) context.dbObject.get(fieldName);

   listContext.dbList = dbList;
   listContext.thriftObject = getThriftObject(context.thriftObject, fieldName);
   pushContext(listContext);
   return new TList(TType.LIST, dbList.size());
}
 
开发者ID:BreizhBeans,项目名称:ThriftMongoBridge,代码行数:16,代码来源:TBSONProtocol.java


示例13: readListBegin

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
@Override
public TList readListBegin() throws TException {
    return new TList((Byte) params.pollFirst(), (Integer) params.pollFirst());
}
 
开发者ID:degupta,项目名称:human_readable_json_protocol,代码行数:5,代码来源:HumanReadableJsonProtocol.java


示例14: writeListBegin

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
@Override
public void writeListBegin(TList tList) throws TException {
    oprot.writeListBegin(tList);
}
 
开发者ID:degupta,项目名称:human_readable_json_protocol,代码行数:5,代码来源:HumanReadableJsonProtocol.java


示例15: writeListBegin

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
public void writeListBegin(TList list) throws TException {
    this.assertContextIsNotMapKey("list");
    this.writeContext_.write();
    this.trans_.write(LBRACKET);
    this.pushWriteContext(new TSimpleJSONProtocol.ListContext());
}
 
开发者ID:degupta,项目名称:human_readable_json_protocol,代码行数:7,代码来源:TSimpleJSONProtocol.java


示例16: readListBegin

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
public TList readListBegin() throws TException {
    return EMPTY_LIST;
}
 
开发者ID:degupta,项目名称:human_readable_json_protocol,代码行数:4,代码来源:TSimpleJSONProtocol.java


示例17: writeListBegin

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
@Override
public void writeListBegin(TList list) throws TException {
    writeSequenceBegin(list.size);
}
 
开发者ID:line,项目名称:armeria,代码行数:5,代码来源:TTextProtocol.java


示例18: readListBegin

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
@Override
public TList readListBegin() throws TException {
    int size = readSequenceBegin();
    return new TList(UNUSED_TYPE, size);
}
 
开发者ID:line,项目名称:armeria,代码行数:6,代码来源:TTextProtocol.java


示例19: readListBegin

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
@Override
public TList readListBegin() throws TException {
    throw new TException("unsupported operation");
}
 
开发者ID:masonmei,项目名称:apm-agent,代码行数:5,代码来源:TReplaceListProtocol.java


示例20: writeListBegin

import org.apache.thrift.protocol.TList; //导入依赖的package包/类
public void writeListBegin(TList list) throws TException {
  delegate.writeListBegin(list);
}
 
开发者ID:apache,项目名称:parquet-format,代码行数:4,代码来源:InterningProtocol.java



注:本文中的org.apache.thrift.protocol.TList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WebViewClient类代码示例发布时间:2022-05-21
下一篇:
Java ExecutorThreadPool类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap