List of usage examples for org.apache.thrift.protocol TList TList
public TList(byte t, int s)
From source file:com.baidu.oped.apm.thrift.io.TReplaceListProtocol.java
License:Apache License
@Override public void writeListBegin(TList list) throws TException { if (!writeFieldBegin) { protocol.writeListBegin(list);/*ww w . j av a2 s . c o m*/ 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++; }
From source file:com.bigdata.dastor.thrift.KeySlice.java
License:Apache License
public void write(TProtocol oprot) throws TException { validate();/*from www. j a v a 2 s . c om*/ oprot.writeStructBegin(STRUCT_DESC); if (this.key != null) { oprot.writeFieldBegin(KEY_FIELD_DESC); oprot.writeString(this.key); oprot.writeFieldEnd(); } if (this.columns != null) { oprot.writeFieldBegin(COLUMNS_FIELD_DESC); { oprot.writeListBegin(new TList(TType.STRUCT, this.columns.size())); for (ColumnOrSuperColumn _iter11 : this.columns) { _iter11.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }
From source file:com.bigdata.dastor.thrift.SlicePredicate.java
License:Apache License
public void write(TProtocol oprot) throws TException { validate();/*w w w . j av a 2 s . c om*/ oprot.writeStructBegin(STRUCT_DESC); if (this.column_names != null) { if (isSetColumn_names()) { oprot.writeFieldBegin(COLUMN_NAMES_FIELD_DESC); { oprot.writeListBegin(new TList(TType.STRING, this.column_names.size())); for (byte[] _iter7 : this.column_names) { oprot.writeBinary(_iter7); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } } if (this.slice_range != null) { if (isSetSlice_range()) { oprot.writeFieldBegin(SLICE_RANGE_FIELD_DESC); this.slice_range.write(oprot); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
From source file:com.bigdata.dastor.thrift.SuperColumn.java
License:Apache License
public void write(TProtocol oprot) throws TException { validate();/*from w w w.j a va2s .co m*/ oprot.writeStructBegin(STRUCT_DESC); if (this.name != null) { oprot.writeFieldBegin(NAME_FIELD_DESC); oprot.writeBinary(this.name); oprot.writeFieldEnd(); } if (this.columns != null) { oprot.writeFieldBegin(COLUMNS_FIELD_DESC); { oprot.writeListBegin(new TList(TType.STRUCT, this.columns.size())); for (Column _iter3 : this.columns) { _iter3.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }
From source file:com.bigdata.dastor.thrift.TokenRange.java
License:Apache License
public void write(TProtocol oprot) throws TException { validate();//from w w w .j a v a 2s . c o m oprot.writeStructBegin(STRUCT_DESC); if (this.start_token != null) { oprot.writeFieldBegin(START_TOKEN_FIELD_DESC); oprot.writeString(this.start_token); oprot.writeFieldEnd(); } if (this.end_token != null) { oprot.writeFieldBegin(END_TOKEN_FIELD_DESC); oprot.writeString(this.end_token); oprot.writeFieldEnd(); } if (this.endpoints != null) { oprot.writeFieldBegin(ENDPOINTS_FIELD_DESC); { oprot.writeListBegin(new TList(TType.STRING, this.endpoints.size())); for (String _iter15 : this.endpoints) { oprot.writeString(_iter15); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }
From source file:com.ebay.nest.io.sede.dynamic_type.DynamicSerDeTypeList.java
License:Apache License
@Override public void serialize(Object o, ObjectInspector oi, TProtocol oprot) throws TException, SerDeException, NoSuchFieldException, IllegalAccessException { ListObjectInspector loi = (ListObjectInspector) oi; ObjectInspector elementObjectInspector = loi.getListElementObjectInspector(); DynamicSerDeTypeBase mt = getElementType(); 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); }/* ww w. java2 s. com*/ } } 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 { mt.serialize(element, elementObjectInspector, oprot); } } } // in theory, the below call isn't needed in non thrift_mode, but let's not // get too crazy oprot.writeListEnd(); }
From source file:com.facebook.swift.codec.internal.TProtocolWriter.java
License:Apache License
public void writeBoolArray(boolean[] array) throws TException { protocol.writeListBegin(new TList(TType.BOOL, array.length)); for (boolean booleanValue : array) { writeBool(booleanValue);//w w w.j a v a 2s . c om } protocol.writeListEnd(); }
From source file:com.facebook.swift.codec.internal.TProtocolWriter.java
License:Apache License
public void writeI16Array(short[] array) throws TException { protocol.writeListBegin(new TList(TType.I16, array.length)); for (int i16 : array) { writeI32(i16);/*from ww w .j av a2 s . c om*/ } protocol.writeListEnd(); }
From source file:com.facebook.swift.codec.internal.TProtocolWriter.java
License:Apache License
public void writeI32Array(int[] array) throws TException { protocol.writeListBegin(new TList(TType.I32, array.length)); for (int i32 : array) { writeI32(i32);//from w w w . ja v a 2 s . c o m } protocol.writeListEnd(); }
From source file:com.facebook.swift.codec.internal.TProtocolWriter.java
License:Apache License
public void writeI64Array(long[] array) throws TException { protocol.writeListBegin(new TList(TType.I64, array.length)); for (long i64 : array) { writeI64(i64);//ww w . j av a 2s .com } protocol.writeListEnd(); }