public HeapDataOutputStream.LongUpdater reserveLong() { return this.hdos.reserveLong(); }
public HeapDataOutputStream.LongUpdater reserveLong() { return this.hdos.reserveLong(); }
@Override public void toData(DataOutput out) throws IOException { boolean isStruct = this.collectionType.getElementType().isStructType(); DataSerializer.writeObject(this.collectionType.getElementType(), out); HeapDataOutputStream hdos = new HeapDataOutputStream(1024, null); LongUpdater lu = hdos.reserveLong(); Iterator<E> iter = this.iterator(); int numElements = 0; while (iter.hasNext()) { E data = iter.next(); if (isStruct) { Object[] fields = ((Struct) data).getFieldValues(); DataSerializer.writeObjectArray(fields, out); } else { DataSerializer.writeObject(data, hdos); } ++numElements; } lu.update(numElements); hdos.sendTo(out); }
@Override public void toData(DataOutput out) throws IOException { boolean isStruct = this.collectionType.getElementType().isStructType(); DataSerializer.writeObject(this.collectionType.getElementType(), out); DataSerializer.writePrimitiveBoolean(this.isDistinct, out); HeapDataOutputStream hdos = new HeapDataOutputStream(1024, null); LongUpdater lu = hdos.reserveLong(); Iterator<E> iter = this.iterator(); int numElements = 0; while (iter.hasNext()) { E data = iter.next(); if(isStruct) { Object[] fields = ((Struct)data).getFieldValues(); DataSerializer.writeObjectArray(fields, out); }else { DataSerializer.writeObject(data, hdos); } ++numElements; } lu.update(numElements); hdos.sendTo(out); }