Package org.apache.thrift.protocol

Examples of org.apache.thrift.protocol.TList


    }

    public <E> List<E> readList(ThriftCodec<E> elementCodec)
            throws Exception
    {
        TList tList = protocol.readListBegin();
        List<E> list = new ArrayList<>();
        for (int i = 0; i < tList.size; i++) {
            E element = elementCodec.read(protocol);
            list.add(element);
        }
View Full Code Here


    {
        if (list == null) {
            return;
        }

        protocol.writeListBegin(new TList(elementCodec.getType().getProtocolType().getType(), list.size()));

        for (T element : list) {
            elementCodec.write(element, protocol);
        }
View Full Code Here

  }

  @Override
  public ArrayList<Object> deserialize(Object reuse, TProtocol iprot)
      throws SerDeException, TException, IllegalAccessException {
    TList thelist = iprot.readListBegin();
    if (thelist == null) {
      return null;
    }

    ArrayList<Object> deserializeReuse;
View Full Code Here

    WriteNullsProtocol nullProtocol =
        (oprot instanceof WriteNullsProtocol) ? (WriteNullsProtocol) oprot : null;

    if (o instanceof List) {
      List<?> list = (List<?>) o;
      oprot.writeListBegin(new TList(mt.getType(), list.size()));
      for (Object element : list) {
        if (element == null) {
          assert (nullProtocol != null);
          nullProtocol.writeNull();
        } else {
          mt.serialize(element, elementObjectInspector, oprot);
        }
      }
    } else {
      Object[] list = (Object[]) o;
      oprot.writeListBegin(new TList(mt.getType(), list.length));
      for (Object element : list) {
        if (element == null && nullProtocol != null) {
          assert (nullProtocol != null);
          nullProtocol.writeNull();
        } else {
View Full Code Here

    wrapped.readMapEnd();
  }

  @Override
  public TList readListBegin() throws TException {
    TList list = wrapped.readListBegin();
    checkContainerElemType(list.elemType);
    return list;
  }
View Full Code Here

    return map;
  }

  @Override
  public TList readListBegin() throws TException {
    TList list = super.readListBegin();
    checkContainerElemType(list.elemType);
    return list;
  }
View Full Code Here

TOP

Related Classes of org.apache.thrift.protocol.TList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.